from line 1
1---
2title: API Keys
3url: https://platform.claude.com/docs/en/api/admin/api_keys
4---
5
61# API Keys
72
83## Retrieve API Key (Admin API)
94
10**get** `/v1/organizations/api_keys/{api_key_id}`
5**GET** `/v1/organizations/api_keys/{api_key_id}`
116
127Retrieve information about a single API key in your organization, looked up by its ID. This Admin API endpoint requires an Admin API key, is intended for programmatic key management, and never returns the key's secret value. To view or create your own API keys, go to [API keys](https://platform.claude.com/settings/keys) in the Claude Console.
138
14### Path Parameters
9### Path parameters
1510
1611- `api_key_id: string`
1712
from line 14
1914
2015### Returns
2116
22- `APIKey object { id, created_at, created_by, 7 more }`
17- `APIKey object`
2318
2419 - `id: string`
2520
from line 24
2924
3025 RFC 3339 datetime string indicating when the API Key was created.
3126
32 - `created_by: object { id, type } or null`
27 format: date-time
3328
29 - `created_by: object or null`
30
3431 The ID and type of the actor that created the API key, or `null` when the
3532 creator is not recorded (legacy, workload-identity-federated, or
3633 system-created keys).
from line 44
4744
4845 RFC 3339 datetime string indicating when the API Key expires, or `null` if it never expires.
4946
47 format: date-time
48
5049 - `name: string`
5150
5251 Name of the API key.
from line 54
5554
5655 Partially redacted hint for the API key.
5756
58 - `principal: object { id, type } or null`
57 - `principal: object or null`
5958
6059 The ID and type of the principal the API key acts as, or `null` if the key is not bound to a principal.
6160
from line 88
8988
9089 For API Keys, this is always `"api_key"`.
9190
92 - `"api_key"`
91 default: api_key
9392
9493 - `workspace_id: string or null`
9594
from line 96
9796
9897### Example
9998
100```http
99```bash
101100curl https://api.anthropic.com/v1/organizations/api_keys/$API_KEY_ID \
102101 -H 'anthropic-version: 2023-06-01' \
103102 -H "Authorization: Bearer $ANTHROPIC_OAUTH_TOKEN"
104103```
105104
106#### Response
105#### Response (200)
107106
108107```json
109108{
from line 127
128127
129128## List API Keys
130129
131**get** `/v1/organizations/api_keys`
130**GET** `/v1/organizations/api_keys`
132131
133132List API Keys
134133
135### Query Parameters
134### Query parameters
136135
137136- `after_id: optional string`
138137
from line 151
152151
153152 Defaults to `20`. Ranges from `1` to `1000`.
154153
154 default: 20, maximum: 1000, minimum: 1
155
155156- `status: optional "active" or "archived" or "expired" or "inactive"`
156157
157158 Filter by API key status.
from line 181
180181
181182 RFC 3339 datetime string indicating when the API Key was created.
182183
183 - `created_by: object { id, type } or null`
184 format: date-time
184185
186 - `created_by: object or null`
187
185188 The ID and type of the actor that created the API key, or `null` when the
186189 creator is not recorded (legacy, workload-identity-federated, or
187190 system-created keys).
from line 201
198201
199202 RFC 3339 datetime string indicating when the API Key expires, or `null` if it never expires.
200203
204 format: date-time
205
201206 - `name: string`
202207
203208 Name of the API key.
from line 211
206211
207212 Partially redacted hint for the API key.
208213
209 - `principal: object { id, type } or null`
214 - `principal: object or null`
210215
211216 The ID and type of the principal the API key acts as, or `null` if the key is not bound to a principal.
212217
from line 245
240245
241246 For API Keys, this is always `"api_key"`.
242247
243 - `"api_key"`
248 default: api_key
244249
245250 - `workspace_id: string or null`
246251
from line 265
260265
261266### Example
262267
263```http
268```bash
264269curl https://api.anthropic.com/v1/organizations/api_keys \
265270 -H 'anthropic-version: 2023-06-01' \
266271 -H "Authorization: Bearer $ANTHROPIC_OAUTH_TOKEN"
267272```
268273
269#### Response
274#### Response (200)
270275
271276```json
272277{
from line 303
298303
299304## Update API Key
300305
301**post** `/v1/organizations/api_keys/{api_key_id}`
306**POST** `/v1/organizations/api_keys/{api_key_id}`
302307
303308Update API Key
304309
305### Path Parameters
310### Path parameters
306311
307312- `api_key_id: string`
308313
309314 ID of the API key.
310315
311### Body Parameters
316### Body parameters
312317
313318- `name: optional string or null`
314319
315320 Name of the API key.
316321
322 maxLength: 500, minLength: 1
323
317324- `status: optional "active" or "archived" or "inactive" or null`
318325
319326 Status of the API key.
from line 333
326333
327334### Returns
328335
329- `APIKey object { id, created_at, created_by, 7 more }`
336- `APIKey object`
330337
331338 - `id: string`
332339
from line 343
336343
337344 RFC 3339 datetime string indicating when the API Key was created.
338345
339 - `created_by: object { id, type } or null`
346 format: date-time
340347
348 - `created_by: object or null`
349
341350 The ID and type of the actor that created the API key, or `null` when the
342351 creator is not recorded (legacy, workload-identity-federated, or
343352 system-created keys).
from line 363
354363
355364 RFC 3339 datetime string indicating when the API Key expires, or `null` if it never expires.
356365
366 format: date-time
367
357368 - `name: string`
358369
359370 Name of the API key.
from line 373
362373
363374 Partially redacted hint for the API key.
364375
365 - `principal: object { id, type } or null`
376 - `principal: object or null`
366377
367378 The ID and type of the principal the API key acts as, or `null` if the key is not bound to a principal.
368379
from line 407
396407
397408 For API Keys, this is always `"api_key"`.
398409
399 - `"api_key"`
410 default: api_key
400411
401412 - `workspace_id: string or null`
402413
from line 415
404415
405416### Example
406417
407```http
418```bash
408419curl https://api.anthropic.com/v1/organizations/api_keys/$API_KEY_ID \
409420 -H 'Content-Type: application/json' \
410421 -H 'anthropic-version: 2023-06-01' \
from line 423
412423 -d '{}'
413424```
414425
415#### Response
426#### Response (200)
416427
417428```json
418429{
No line in this hunk matches that.