from line 1
1---
2title: Create Credential
3url: https://platform.claude.com/docs/en/api/beta/vaults/credentials/create
4---
1# Create Credential
52
6## Create Credential
3**POST** `/v1/vaults/{vault_id}/credentials`
74
8**post** `/v1/vaults/{vault_id}/credentials`
9
105Create Credential
116
12### Path Parameters
7## Path parameters
138
149- `vault_id: string`
1510
16### Header Parameters
11## Headers
1712
1813- `"anthropic-beta": optional array of AnthropicBeta`
1914
from line 86
9186
9287 - `"mid-conversation-tool-changes-2026-07-01"`
9388
94### Body Parameters
89## Body parameters
9590
9691- `auth: BetaManagedAgentsMCPOAuthCreateParams or BetaManagedAgentsStaticBearerCreateParams or BetaManagedAgentsEnvironmentVariableCreateParams`
9792
9893 Authentication details for creating a credential.
9994
100 - `BetaManagedAgentsMCPOAuthCreateParams object { access_token, mcp_server_url, type, 2 more }`
95 - `BetaManagedAgentsMCPOAuthCreateParams object`
10196
10297 Parameters for creating an MCP OAuth credential.
10398
from line 100
105100
106101 OAuth access token.
107102
103 minLength: 1, maxLength: 8192
104
108105 - `mcp_server_url: string`
109106
110107 URL of the MCP server this credential authenticates against.
111108
109 minLength: 1, maxLength: 2047
110
112111 - `type: "mcp_oauth"`
113112
114 - `"mcp_oauth"`
115
116113 - `expires_at: optional string or null`
117114
118115 A timestamp in RFC 3339 format
119116
117 format: date-time
118
120119 - `refresh: optional BetaManagedAgentsMCPOAuthRefreshParams or null`
121120
122121 OAuth refresh token parameters for creating a credential with refresh support.
from line 124
125124
126125 OAuth client ID.
127126
127 minLength: 1, maxLength: 1024
128
128129 - `refresh_token: string`
129130
130131 OAuth refresh token.
131132
133 minLength: 1, maxLength: 4096
134
132135 - `token_endpoint: string`
133136
134137 Token endpoint URL used to refresh the access token.
135138
139 minLength: 1, maxLength: 2047
140
136141 - `token_endpoint_auth: BetaManagedAgentsTokenEndpointAuthNoneParam or BetaManagedAgentsTokenEndpointAuthBasicParam or BetaManagedAgentsTokenEndpointAuthPostParam`
137142
138143 Token endpoint requires no client authentication.
139144
140 - `BetaManagedAgentsTokenEndpointAuthNoneParam object { type }`
145 - `BetaManagedAgentsTokenEndpointAuthNoneParam object`
141146
142147 Token endpoint requires no client authentication.
143148
144149 - `type: "none"`
145150
146 - `"none"`
151 - `BetaManagedAgentsTokenEndpointAuthBasicParam object`
147152
148 - `BetaManagedAgentsTokenEndpointAuthBasicParam object { client_secret, type }`
149
150153 Token endpoint uses HTTP Basic authentication with client credentials.
151154
152155 - `client_secret: string`
from line 156
153156
154157 OAuth client secret.
155158
159 minLength: 1, maxLength: 512
160
156161 - `type: "client_secret_basic"`
157162
158 - `"client_secret_basic"`
163 - `BetaManagedAgentsTokenEndpointAuthPostParam object`
159164
160 - `BetaManagedAgentsTokenEndpointAuthPostParam object { client_secret, type }`
161
162165 Token endpoint uses POST body authentication with client credentials.
163166
164167 - `client_secret: string`
from line 168
165168
166169 OAuth client secret.
167170
171 minLength: 1, maxLength: 512
172
168173 - `type: "client_secret_post"`
169174
170 - `"client_secret_post"`
171
172175 - `resource: optional string or null`
173176
174177 OAuth resource indicator.
175178
179 minLength: 1, maxLength: 2047
180
176181 - `scope: optional string or null`
177182
178183 OAuth scope for the refresh request.
179184
180 - `BetaManagedAgentsStaticBearerCreateParams object { token, mcp_server_url, type }`
185 minLength: 1, maxLength: 8192
181186
187 - `BetaManagedAgentsStaticBearerCreateParams object`
188
182189 Parameters for creating a static bearer token credential.
183190
184191 - `token: string`
from line 192
185192
186193 Static bearer token value.
187194
195 minLength: 1, maxLength: 8192
196
188197 - `mcp_server_url: string`
189198
190199 URL of the MCP server this credential authenticates against.
191200
201 minLength: 1, maxLength: 2047
202
192203 - `type: "static_bearer"`
193204
194 - `"static_bearer"`
205 - `BetaManagedAgentsEnvironmentVariableCreateParams object`
195206
196 - `BetaManagedAgentsEnvironmentVariableCreateParams object { networking, secret_name, secret_value, 2 more }`
197
198207 Parameters for creating an environment variable credential.
199208
200209 - `networking: BetaManagedAgentsCredentialNetworkingParams`
from line 210
201210
202211 Outbound hosts the secret value is substituted on.
203212
204 - `BetaManagedAgentsUnrestrictedCredentialNetworkingParams object { type }`
213 - `BetaManagedAgentsUnrestrictedCredentialNetworkingParams object`
205214
206215 Substitute the secret on any host the session's Environment network policy permits egress to. The Environment's network policy is the only boundary on where the secret can reach.
207216
208217 - `type: "unrestricted"`
209218
210 - `"unrestricted"`
219 - `BetaManagedAgentsLimitedCredentialNetworkingParams object`
211220
212 - `BetaManagedAgentsLimitedCredentialNetworkingParams object { allowed_hosts, type }`
213
214221 Substitute the secret only on requests to the listed hosts.
215222
216223 - `allowed_hosts: array of string`
from line 226
219226
220227 - `type: "limited"`
221228
222 - `"limited"`
223
224229 - `secret_name: string`
225230
226231 Name of the environment variable. Immutable after create.
227232
233 minLength: 1, maxLength: 255
234
228235 - `secret_value: string`
229236
230237 Secret value. Write-only; never returned in responses.
231238
239 minLength: 1, maxLength: 4096
240
232241 - `type: "environment_variable"`
233242
234 - `"environment_variable"`
235
236243 - `injection_location: optional BetaManagedAgentsInjectionLocationParams`
237244
238245 Where in the outbound request the secret value may be substituted.
from line 256
249256
250257 Human-readable name for the credential. Up to 255 characters.
251258
259 maxLength: 255
260
252261- `metadata: optional map[string]`
253262
254263 Arbitrary key-value metadata to attach to the credential. Maximum 16 pairs, keys up to 64 chars, values up to 512 chars.
255264
256### Returns
265## Returns
257266
258- `BetaManagedAgentsCredential object { id, archived_at, auth, 6 more }`
267- `BetaManagedAgentsCredential object`
259268
260269 A credential stored in a vault. Sensitive fields are never returned in responses.
261270
from line 276
267276
268277 A timestamp in RFC 3339 format
269278
279 format: date-time
280
270281 - `auth: BetaManagedAgentsMCPOAuthAuthResponse or BetaManagedAgentsStaticBearerAuthResponse or BetaManagedAgentsEnvironmentVariableAuthResponse`
271282
272283 Authentication details for a credential.
273284
274 - `BetaManagedAgentsMCPOAuthAuthResponse object { mcp_server_url, type, expires_at, refresh }`
285 - `BetaManagedAgentsMCPOAuthAuthResponse object`
275286
276287 OAuth credential details for an MCP server.
277288
from line 292
281292
282293 - `type: "mcp_oauth"`
283294
284 - `"mcp_oauth"`
285
286295 - `expires_at: optional string or null`
287296
288297 A timestamp in RFC 3339 format
289298
299 format: date-time
300
290301 - `refresh: optional BetaManagedAgentsMCPOAuthRefreshResponse or null`
291302
292303 OAuth refresh token configuration returned in credential responses.
from line 314
303314
304315 Token endpoint requires no client authentication.
305316
306 - `BetaManagedAgentsTokenEndpointAuthNoneResponse object { type }`
317 - `BetaManagedAgentsTokenEndpointAuthNoneResponse object`
307318
308319 Token endpoint requires no client authentication.
309320
310321 - `type: "none"`
311322
312 - `"none"`
323 - `BetaManagedAgentsTokenEndpointAuthBasicResponse object`
313324
314 - `BetaManagedAgentsTokenEndpointAuthBasicResponse object { type }`
315
316325 Token endpoint uses HTTP Basic authentication with client credentials.
317326
318327 - `type: "client_secret_basic"`
319328
320 - `"client_secret_basic"`
329 - `BetaManagedAgentsTokenEndpointAuthPostResponse object`
321330
322 - `BetaManagedAgentsTokenEndpointAuthPostResponse object { type }`
323
324331 Token endpoint uses POST body authentication with client credentials.
325332
326333 - `type: "client_secret_post"`
327334
328 - `"client_secret_post"`
329
330335 - `resource: optional string or null`
331336
332337 OAuth resource indicator.
from line 340
335340
336341 OAuth scope for the refresh request.
337342
338 - `BetaManagedAgentsStaticBearerAuthResponse object { mcp_server_url, type }`
343 - `BetaManagedAgentsStaticBearerAuthResponse object`
339344
340345 Static bearer token credential details for an MCP server.
341346
from line 350
345350
346351 - `type: "static_bearer"`
347352
348 - `"static_bearer"`
353 - `BetaManagedAgentsEnvironmentVariableAuthResponse object`
349354
350 - `BetaManagedAgentsEnvironmentVariableAuthResponse object { injection_location, networking, secret_name, type }`
351
352355 Environment variable credential details. The secret value is never returned.
353356
354357 - `injection_location: BetaManagedAgentsInjectionLocationResponse`
from line 370
367370
368371 Outbound hosts the secret value is substituted on.
369372
370 - `BetaManagedAgentsUnrestrictedCredentialNetworkingResponse object { type }`
373 - `BetaManagedAgentsUnrestrictedCredentialNetworkingResponse object`
371374
372375 The secret is substituted on any host the session's Environment network policy permits egress to.
373376
374377 - `type: "unrestricted"`
375378
376 - `"unrestricted"`
379 - `BetaManagedAgentsLimitedCredentialNetworkingResponse object`
377380
378 - `BetaManagedAgentsLimitedCredentialNetworkingResponse object { allowed_hosts, type }`
379
380381 The secret is substituted only on requests to the listed hosts.
381382
382383 - `allowed_hosts: array of string`
from line 386
385386
386387 - `type: "limited"`
387388
388 - `"limited"`
389
390389 - `secret_name: string`
391390
392391 Name of the environment variable.
from line 392
393392
394393 - `type: "environment_variable"`
395394
396 - `"environment_variable"`
397
398395 - `created_at: string`
399396
400397 A timestamp in RFC 3339 format
401398
399 format: date-time
400
402401 - `metadata: map[string]`
403402
404403 Arbitrary key-value metadata attached to the credential.
from line 404
405404
406405 - `type: "vault_credential"`
407406
408 - `"vault_credential"`
409
410407 - `updated_at: string`
411408
412409 A timestamp in RFC 3339 format
413410
411 format: date-time
412
414413 - `vault_id: string`
415414
416415 Identifier of the vault this credential belongs to.
from line 418
419418
420419 Human-readable name for the credential.
421420
422### Example
421## Example
423422
424```http
423```bash
425424curl https://api.anthropic.com/v1/vaults/$VAULT_ID/credentials \
426425 -H 'Content-Type: application/json' \
427426 -H 'anthropic-version: 2023-06-01' \
from line 439
440439 }'
441440```
442441
443#### Response
442### Response (200)
444443
445444```json
446445{
No line in this hunk matches that.