API Keys
api/admin/api_keys
Nearest release: v2.1.245, published an hour after this site recorded the change. Shown because the two are within 24 hours of each other. Nothing here says the release caused the edit.
api/admin/api_keys Changed · +40 / -29 lines
### Path parameters #### Response (200) ### Query parameters #### Response (200) ### Path parameters ### Body parameters #### Response (200) ### Path Parameters #### Response ### Query Parameters #### Response ### Path Parameters ### Body Parameters #### Response
---- -title: API Keys -url: https://platform.claude.com/docs/en/api/admin/api_keys ---- - # API Keys ## Retrieve API Key (Admin API) -**get** `/v1/organizations/api_keys/{api_key_id}` +**GET** `/v1/organizations/api_keys/{api_key_id}` Retrieve 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. -### Path Parameters +### Path parameters - `api_key_id: string`
### Returns -- `APIKey object { id, created_at, created_by, 7 more }` +- `APIKey object` - `id: string`
RFC 3339 datetime string indicating when the API Key was created. - - `created_by: object { id, type } or null` + format: date-time + - `created_by: object or null` + The ID and type of the actor that created the API key, or `null` when the creator is not recorded (legacy, workload-identity-federated, or system-created keys).
RFC 3339 datetime string indicating when the API Key expires, or `null` if it never expires. + format: date-time + - `name: string` Name of the API key.
Partially redacted hint for the API key. - - `principal: object { id, type } or null` + - `principal: object or null` The ID and type of the principal the API key acts as, or `null` if the key is not bound to a principal.
For API Keys, this is always `"api_key"`. - - `"api_key"` + default: api_key - `workspace_id: string or null`
### Example -```http +```bash curl https://api.anthropic.com/v1/organizations/api_keys/$API_KEY_ID \ -H 'anthropic-version: 2023-06-01' \ -H "Authorization: Bearer $ANTHROPIC_OAUTH_TOKEN" ``` -#### Response +#### Response (200) ```json {
## List API Keys -**get** `/v1/organizations/api_keys` +**GET** `/v1/organizations/api_keys` List API Keys -### Query Parameters +### Query parameters - `after_id: optional string`
Defaults to `20`. Ranges from `1` to `1000`. + default: 20, maximum: 1000, minimum: 1 + - `status: optional "active" or "archived" or "expired" or "inactive"` Filter by API key status.
RFC 3339 datetime string indicating when the API Key was created. - - `created_by: object { id, type } or null` + format: date-time + - `created_by: object or null` + The ID and type of the actor that created the API key, or `null` when the creator is not recorded (legacy, workload-identity-federated, or system-created keys).
RFC 3339 datetime string indicating when the API Key expires, or `null` if it never expires. + format: date-time + - `name: string` Name of the API key.
Partially redacted hint for the API key. - - `principal: object { id, type } or null` + - `principal: object or null` The ID and type of the principal the API key acts as, or `null` if the key is not bound to a principal.
For API Keys, this is always `"api_key"`. - - `"api_key"` + default: api_key - `workspace_id: string or null`
### Example -```http +```bash curl https://api.anthropic.com/v1/organizations/api_keys \ -H 'anthropic-version: 2023-06-01' \ -H "Authorization: Bearer $ANTHROPIC_OAUTH_TOKEN" ``` -#### Response +#### Response (200) ```json {
## Update API Key -**post** `/v1/organizations/api_keys/{api_key_id}` +**POST** `/v1/organizations/api_keys/{api_key_id}` Update API Key -### Path Parameters +### Path parameters - `api_key_id: string` ID of the API key. -### Body Parameters +### Body parameters - `name: optional string or null` Name of the API key. + maxLength: 500, minLength: 1 + - `status: optional "active" or "archived" or "inactive" or null` Status of the API key.
### Returns -- `APIKey object { id, created_at, created_by, 7 more }` +- `APIKey object` - `id: string`
RFC 3339 datetime string indicating when the API Key was created. - - `created_by: object { id, type } or null` + format: date-time + - `created_by: object or null` + The ID and type of the actor that created the API key, or `null` when the creator is not recorded (legacy, workload-identity-federated, or system-created keys).
RFC 3339 datetime string indicating when the API Key expires, or `null` if it never expires. + format: date-time + - `name: string` Name of the API key.
Partially redacted hint for the API key. - - `principal: object { id, type } or null` + - `principal: object or null` The ID and type of the principal the API key acts as, or `null` if the key is not bound to a principal.
For API Keys, this is always `"api_key"`. - - `"api_key"` + default: api_key - `workspace_id: string or null`
### Example -```http +```bash curl https://api.anthropic.com/v1/organizations/api_keys/$API_KEY_ID \ -H 'Content-Type: application/json' \ -H 'anthropic-version: 2023-06-01' \
-d '{}' ``` -#### Response +#### Response (200) ```json {