# API Keys

Use these operations to interact with [API keys](/configure/settings/api-keys.md) in Cortex.

### Required permissions

Your API token must have the `Edit API keys` permission.

### Roles

When creating an API key, you must specify roles. Each role requires a `type` field set to `DEFAULT` or `CUSTOM`. You can assign multiple roles (both default and custom) to a single API key.

**Default roles** use the `role` field to specify the permission level. Allowed values: `READ_ONLY`, `USER`, `ADMIN`.

```json
{
  "type": "DEFAULT",
  "role": "READ_ONLY"
}
```

**Custom roles** use the `tag` field (not `role`) to reference a [custom role](https://docs.cortex.io/docs/walkthroughs/workspace-settings/permissioning/custom-roles) by its unique tag:

```json
{
  "type": "CUSTOM",
  "tag": "custom-role-tag"
}
```

**Example payload with multiple roles:**

```json
{
  "name": "Entities scanner",
  "roles": [
    { "type": "DEFAULT", "role": "ADMIN" },
    { "type": "CUSTOM", "tag": "custom-role-tag" }
  ]
}
```

{% hint style="info" %}
Note: Users with custom roles can only create API keys assigned to roles with equal or fewer permissions than their own.
{% endhint %}

## Operations

## List API keys

> List API keys\
> \
> The API key used to make the request must have the \`Edit API keys\` permission

```json
{"openapi":"3.0.1","info":{"title":"Cortex API","version":"v1"},"tags":[{"name":"API Keys"}],"servers":[{"url":"https://api.getcortexapp.com","description":"Cortex Cloud API host"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"bearerFormat":"JWT","description":"All requests to the Cortex API need to provide an `Authorization: Bearer <token>` header, where `<token>` is an API key created in the Settings page of your workspace.","scheme":"bearer","type":"http"}},"schemas":{"ListApiKeyResponse":{"required":["apiKeys","page","total","totalPages"],"type":"object","properties":{"apiKeys":{"type":"array","description":"List of API keys","items":{"$ref":"#/components/schemas/ApiKeyDefinition"}},"page":{"type":"integer","description":"Current page number, 0-indexed","format":"int32"},"total":{"type":"integer","description":"Total number of results","format":"int32"},"totalPages":{"type":"integer","description":"Total number of pages","format":"int32"}}},"ApiKeyDefinition":{"required":["cid","createdDate","last4","roles"],"type":"object","properties":{"cid":{"type":"string","description":"ID of the API key"},"createdDate":{"type":"string","description":"Creation date of the API key","format":"date-time"},"description":{"type":"string","description":"Description of the API key"},"expirationDate":{"type":"string","description":"Expiration date of the API key","format":"date-time"},"last4":{"type":"string","description":"Last 4 characters of the API key"},"name":{"type":"string","description":"Name of the API key"},"roles":{"type":"array","description":"Roles assigned to the API key","items":{"$ref":"#/components/schemas/ApiKeyRole"}}}},"ApiKeyRole":{"required":["type"],"type":"object","properties":{"type":{"type":"string","description":"The type of the role","enum":["DEFAULT","CUSTOM"]}},"description":"Roles assigned to the API key","discriminator":{"propertyName":"type"},"oneOf":[{"$ref":"#/components/schemas/DEFAULT"},{"$ref":"#/components/schemas/CUSTOM"}]},"DEFAULT":{"required":["role","type"],"type":"object","allOf":[{"$ref":"#/components/schemas/ApiKeyRole"},{"type":"object","properties":{"role":{"type":"string","description":"The role of the API key","enum":["READ_ONLY","USER","ADMIN"]},"type":{"type":"string"}}}]},"CUSTOM":{"required":["tag","type"],"type":"object","allOf":[{"$ref":"#/components/schemas/ApiKeyRole"},{"type":"object","properties":{"tag":{"type":"string","description":"Tag of the [custom role](https://docs.cortex.io/docs/walkthroughs/workspace-settings/permissioning/custom-roles)"},"type":{"type":"string"}}}]},"ErrorResponse":{"required":["message","type"],"type":"object","properties":{"details":{"type":"string"},"gatewayHttpStatus":{"type":"integer","format":"int32"},"httpStatus":{"type":"integer","format":"int32"},"message":{"type":"string"},"requestId":{"type":"string"},"type":{"type":"string","enum":["INTEGRATION_MISSING","INTEGRATION_UNREGISTERED","INTEGRATION_UNSUPPORTED","INTEGRATION_GRAPHQL_ERROR","INTEGRATION_BAD_REQUEST","INTEGRATION_UNAUTHORIZED","INTEGRATION_FORBIDDEN","INTEGRATION_NOT_FOUND","INTEGRATION_UNPROCESSABLE_CONTENT","INTEGRATION_RATE_LIMITED","INTEGRATION_INTERNAL_ERROR","INTEGRATION_NOT_IMPLEMENTED","INTEGRATION_BAD_GATEWAY","INTEGRATION_UNAVAILABLE","INTEGRATION_GATEWAY_TIMEOUT","INTEGRATION_TIMED_OUT","INTEGRATION_CACHE_ERROR","INTEGRATION_UNHANDLED_HTTP_ERROR","INTEGRATION_UNHANDLED_EXCEPTION","INTEGRATION_UNEXPECTED_ERROR","ILLEGAL_ARGUMENT_ERROR","BAD_REQUEST","FORBIDDEN","NOT_FOUND","REQUEST_TIMEOUT","CONFLICT","UNHANDLED_EXCEPTION","UNCATEGORIZED","SERVICE_CREATOR","UNKNOWN_HOST","TOO_MANY_REQUESTS"]}}},"TooManyRequestsProblemDetail":{"required":["type","title","status"],"type":"object","properties":{"detail":{"type":"string"},"instance":{"type":"string","format":"uri-reference"},"retryAfter":{"minimum":0,"type":"integer","description":"The number of seconds until the rate limiting resets.","format":"int32"},"status":{"maximum":599,"minimum":100,"type":"integer","format":"int32","enum":[429]},"title":{"type":"string"},"type":{"type":"string","format":"uri-reference"}}}},"responses":{"TooManyRequests":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/TooManyRequestsProblemDetail"}}},"description":"The client has exceeded the rate limit by performing too many requests in a short period. Retry the request after a delay.","headers":{"Retry-After":{"description":"The number of seconds until the rate limiting resets.","schema":{"minimum":0,"type":"integer","format":"int32"}}}}}},"paths":{"/api/v1/auth/key":{"get":{"description":"List API keys\n\nThe API key used to make the request must have the `Edit API keys` permission","operationId":"listApiKey","parameters":[{"description":"Number of results to return per page, between 1 and 1000. Default 250.","in":"query","name":"pageSize","required":true,"schema":{"type":"integer","format":"int32","default":250}},{"description":"Page number to return, 0-indexed. Default 0.","in":"query","name":"page","required":true,"schema":{"type":"integer","format":"int32","default":0}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ListApiKeyResponse"}},"application/yaml":{"schema":{"$ref":"#/components/schemas/ListApiKeyResponse"}}},"description":"Successfully found API keys"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}},"application/yaml":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"429":{"$ref":"#/components/responses/TooManyRequests"}},"summary":"List API keys","tags":["API Keys"]}}}}
```

## Get API key

> Get API key

```json
{"openapi":"3.0.1","info":{"title":"Cortex API","version":"v1"},"tags":[{"name":"API Keys"}],"servers":[{"url":"https://api.getcortexapp.com","description":"Cortex Cloud API host"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"bearerFormat":"JWT","description":"All requests to the Cortex API need to provide an `Authorization: Bearer <token>` header, where `<token>` is an API key created in the Settings page of your workspace.","scheme":"bearer","type":"http"}},"schemas":{"ApiKeyDefinition":{"required":["cid","createdDate","last4","roles"],"type":"object","properties":{"cid":{"type":"string","description":"ID of the API key"},"createdDate":{"type":"string","description":"Creation date of the API key","format":"date-time"},"description":{"type":"string","description":"Description of the API key"},"expirationDate":{"type":"string","description":"Expiration date of the API key","format":"date-time"},"last4":{"type":"string","description":"Last 4 characters of the API key"},"name":{"type":"string","description":"Name of the API key"},"roles":{"type":"array","description":"Roles assigned to the API key","items":{"$ref":"#/components/schemas/ApiKeyRole"}}}},"ApiKeyRole":{"required":["type"],"type":"object","properties":{"type":{"type":"string","description":"The type of the role","enum":["DEFAULT","CUSTOM"]}},"description":"Roles assigned to the API key","discriminator":{"propertyName":"type"},"oneOf":[{"$ref":"#/components/schemas/DEFAULT"},{"$ref":"#/components/schemas/CUSTOM"}]},"DEFAULT":{"required":["role","type"],"type":"object","allOf":[{"$ref":"#/components/schemas/ApiKeyRole"},{"type":"object","properties":{"role":{"type":"string","description":"The role of the API key","enum":["READ_ONLY","USER","ADMIN"]},"type":{"type":"string"}}}]},"CUSTOM":{"required":["tag","type"],"type":"object","allOf":[{"$ref":"#/components/schemas/ApiKeyRole"},{"type":"object","properties":{"tag":{"type":"string","description":"Tag of the [custom role](https://docs.cortex.io/docs/walkthroughs/workspace-settings/permissioning/custom-roles)"},"type":{"type":"string"}}}]},"ErrorResponse":{"required":["message","type"],"type":"object","properties":{"details":{"type":"string"},"gatewayHttpStatus":{"type":"integer","format":"int32"},"httpStatus":{"type":"integer","format":"int32"},"message":{"type":"string"},"requestId":{"type":"string"},"type":{"type":"string","enum":["INTEGRATION_MISSING","INTEGRATION_UNREGISTERED","INTEGRATION_UNSUPPORTED","INTEGRATION_GRAPHQL_ERROR","INTEGRATION_BAD_REQUEST","INTEGRATION_UNAUTHORIZED","INTEGRATION_FORBIDDEN","INTEGRATION_NOT_FOUND","INTEGRATION_UNPROCESSABLE_CONTENT","INTEGRATION_RATE_LIMITED","INTEGRATION_INTERNAL_ERROR","INTEGRATION_NOT_IMPLEMENTED","INTEGRATION_BAD_GATEWAY","INTEGRATION_UNAVAILABLE","INTEGRATION_GATEWAY_TIMEOUT","INTEGRATION_TIMED_OUT","INTEGRATION_CACHE_ERROR","INTEGRATION_UNHANDLED_HTTP_ERROR","INTEGRATION_UNHANDLED_EXCEPTION","INTEGRATION_UNEXPECTED_ERROR","ILLEGAL_ARGUMENT_ERROR","BAD_REQUEST","FORBIDDEN","NOT_FOUND","REQUEST_TIMEOUT","CONFLICT","UNHANDLED_EXCEPTION","UNCATEGORIZED","SERVICE_CREATOR","UNKNOWN_HOST","TOO_MANY_REQUESTS"]}}},"TooManyRequestsProblemDetail":{"required":["type","title","status"],"type":"object","properties":{"detail":{"type":"string"},"instance":{"type":"string","format":"uri-reference"},"retryAfter":{"minimum":0,"type":"integer","description":"The number of seconds until the rate limiting resets.","format":"int32"},"status":{"maximum":599,"minimum":100,"type":"integer","format":"int32","enum":[429]},"title":{"type":"string"},"type":{"type":"string","format":"uri-reference"}}}},"responses":{"TooManyRequests":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/TooManyRequestsProblemDetail"}}},"description":"The client has exceeded the rate limit by performing too many requests in a short period. Retry the request after a delay.","headers":{"Retry-After":{"description":"The number of seconds until the rate limiting resets.","schema":{"minimum":0,"type":"integer","format":"int32"}}}}}},"paths":{"/api/v1/auth/key/{cid}":{"get":{"description":"Get API key","operationId":"getApiKey","parameters":[{"description":"The unique, auto-generated identifier for the API key","in":"path","name":"cid","required":true,"schema":{"type":"string","description":"The unique, auto-generated identifier for the API key"}}],"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyDefinition"}},"application/yaml":{"schema":{"$ref":"#/components/schemas/ApiKeyDefinition"}}},"description":"Successfully found API key"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}},"application/yaml":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}},"application/yaml":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"API key not found"},"429":{"$ref":"#/components/responses/TooManyRequests"}},"summary":"Get API key","tags":["API Keys"]}}}}
```

## Create API key

> Create new API key.\
> \
> The API key used to make the request must have the \`Edit API keys\` permission

```json
{"openapi":"3.0.1","info":{"title":"Cortex API","version":"v1"},"tags":[{"name":"API Keys"}],"servers":[{"url":"https://api.getcortexapp.com","description":"Cortex Cloud API host"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"bearerFormat":"JWT","description":"All requests to the Cortex API need to provide an `Authorization: Bearer <token>` header, where `<token>` is an API key created in the Settings page of your workspace.","scheme":"bearer","type":"http"}},"schemas":{"CreateApiRequest":{"required":["name","roles"],"type":"object","properties":{"description":{"type":"string","description":"Description of the API key"},"expirationDate":{"type":"string","description":"Expiration date of the API key. Format: ISO8601 with timezone offset","format":"date-time"},"name":{"type":"string","description":"Name of the API key"},"roles":{"type":"array","description":"Roles assigned to the API key","items":{"$ref":"#/components/schemas/ApiKeyRole"}}}},"ApiKeyRole":{"required":["type"],"type":"object","properties":{"type":{"type":"string","description":"The type of the role","enum":["DEFAULT","CUSTOM"]}},"description":"Roles assigned to the API key","discriminator":{"propertyName":"type"},"oneOf":[{"$ref":"#/components/schemas/DEFAULT"},{"$ref":"#/components/schemas/CUSTOM"}]},"DEFAULT":{"required":["role","type"],"type":"object","allOf":[{"$ref":"#/components/schemas/ApiKeyRole"},{"type":"object","properties":{"role":{"type":"string","description":"The role of the API key","enum":["READ_ONLY","USER","ADMIN"]},"type":{"type":"string"}}}]},"CUSTOM":{"required":["tag","type"],"type":"object","allOf":[{"$ref":"#/components/schemas/ApiKeyRole"},{"type":"object","properties":{"tag":{"type":"string","description":"Tag of the [custom role](https://docs.cortex.io/docs/walkthroughs/workspace-settings/permissioning/custom-roles)"},"type":{"type":"string"}}}]},"CreateApiResponse":{"required":["apiKey","roles"],"type":"object","properties":{"apiKey":{"type":"string","description":"Value of the API key created. **You will not be able to see this key again**"},"description":{"type":"string","description":"Description of the API key"},"expirationDate":{"type":"string","description":"Expiration date of the API key","format":"date-time"},"name":{"type":"string","description":"Name of the API key"},"roles":{"type":"array","description":"Roles assigned to the API key","items":{"$ref":"#/components/schemas/ApiKeyRole"}}}},"ErrorResponse":{"required":["message","type"],"type":"object","properties":{"details":{"type":"string"},"gatewayHttpStatus":{"type":"integer","format":"int32"},"httpStatus":{"type":"integer","format":"int32"},"message":{"type":"string"},"requestId":{"type":"string"},"type":{"type":"string","enum":["INTEGRATION_MISSING","INTEGRATION_UNREGISTERED","INTEGRATION_UNSUPPORTED","INTEGRATION_GRAPHQL_ERROR","INTEGRATION_BAD_REQUEST","INTEGRATION_UNAUTHORIZED","INTEGRATION_FORBIDDEN","INTEGRATION_NOT_FOUND","INTEGRATION_UNPROCESSABLE_CONTENT","INTEGRATION_RATE_LIMITED","INTEGRATION_INTERNAL_ERROR","INTEGRATION_NOT_IMPLEMENTED","INTEGRATION_BAD_GATEWAY","INTEGRATION_UNAVAILABLE","INTEGRATION_GATEWAY_TIMEOUT","INTEGRATION_TIMED_OUT","INTEGRATION_CACHE_ERROR","INTEGRATION_UNHANDLED_HTTP_ERROR","INTEGRATION_UNHANDLED_EXCEPTION","INTEGRATION_UNEXPECTED_ERROR","ILLEGAL_ARGUMENT_ERROR","BAD_REQUEST","FORBIDDEN","NOT_FOUND","REQUEST_TIMEOUT","CONFLICT","UNHANDLED_EXCEPTION","UNCATEGORIZED","SERVICE_CREATOR","UNKNOWN_HOST","TOO_MANY_REQUESTS"]}}},"TooManyRequestsProblemDetail":{"required":["type","title","status"],"type":"object","properties":{"detail":{"type":"string"},"instance":{"type":"string","format":"uri-reference"},"retryAfter":{"minimum":0,"type":"integer","description":"The number of seconds until the rate limiting resets.","format":"int32"},"status":{"maximum":599,"minimum":100,"type":"integer","format":"int32","enum":[429]},"title":{"type":"string"},"type":{"type":"string","format":"uri-reference"}}}},"responses":{"TooManyRequests":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/TooManyRequestsProblemDetail"}}},"description":"The client has exceeded the rate limit by performing too many requests in a short period. Retry the request after a delay.","headers":{"Retry-After":{"description":"The number of seconds until the rate limiting resets.","schema":{"minimum":0,"type":"integer","format":"int32"}}}}}},"paths":{"/api/v1/auth/key":{"post":{"description":"Create new API key.\n\nThe API key used to make the request must have the `Edit API keys` permission","operationId":"createApiKey","requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateApiRequest"}},"application/yaml":{"schema":{"$ref":"#/components/schemas/CreateApiRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateApiResponse"}},"application/yaml":{"schema":{"$ref":"#/components/schemas/CreateApiResponse"}}},"description":"Successfully created API key"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}},"application/yaml":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}},"application/yaml":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Access denied"},"429":{"$ref":"#/components/responses/TooManyRequests"}},"summary":"Create API key","tags":["API Keys"]}}}}
```

## Update API key

> Update API key\
> \
> The API key used to make the request must have the \`Edit API keys\` permission

```json
{"openapi":"3.0.1","info":{"title":"Cortex API","version":"v1"},"tags":[{"name":"API Keys"}],"servers":[{"url":"https://api.getcortexapp.com","description":"Cortex Cloud API host"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"bearerFormat":"JWT","description":"All requests to the Cortex API need to provide an `Authorization: Bearer <token>` header, where `<token>` is an API key created in the Settings page of your workspace.","scheme":"bearer","type":"http"}},"schemas":{"UpdateApiRequest":{"required":["name"],"type":"object","properties":{"description":{"type":"string","description":"Description of the API key"},"name":{"type":"string","description":"Name of the API key"}}},"ApiKeyDefinition":{"required":["cid","createdDate","last4","roles"],"type":"object","properties":{"cid":{"type":"string","description":"ID of the API key"},"createdDate":{"type":"string","description":"Creation date of the API key","format":"date-time"},"description":{"type":"string","description":"Description of the API key"},"expirationDate":{"type":"string","description":"Expiration date of the API key","format":"date-time"},"last4":{"type":"string","description":"Last 4 characters of the API key"},"name":{"type":"string","description":"Name of the API key"},"roles":{"type":"array","description":"Roles assigned to the API key","items":{"$ref":"#/components/schemas/ApiKeyRole"}}}},"ApiKeyRole":{"required":["type"],"type":"object","properties":{"type":{"type":"string","description":"The type of the role","enum":["DEFAULT","CUSTOM"]}},"description":"Roles assigned to the API key","discriminator":{"propertyName":"type"},"oneOf":[{"$ref":"#/components/schemas/DEFAULT"},{"$ref":"#/components/schemas/CUSTOM"}]},"DEFAULT":{"required":["role","type"],"type":"object","allOf":[{"$ref":"#/components/schemas/ApiKeyRole"},{"type":"object","properties":{"role":{"type":"string","description":"The role of the API key","enum":["READ_ONLY","USER","ADMIN"]},"type":{"type":"string"}}}]},"CUSTOM":{"required":["tag","type"],"type":"object","allOf":[{"$ref":"#/components/schemas/ApiKeyRole"},{"type":"object","properties":{"tag":{"type":"string","description":"Tag of the [custom role](https://docs.cortex.io/docs/walkthroughs/workspace-settings/permissioning/custom-roles)"},"type":{"type":"string"}}}]},"ErrorResponse":{"required":["message","type"],"type":"object","properties":{"details":{"type":"string"},"gatewayHttpStatus":{"type":"integer","format":"int32"},"httpStatus":{"type":"integer","format":"int32"},"message":{"type":"string"},"requestId":{"type":"string"},"type":{"type":"string","enum":["INTEGRATION_MISSING","INTEGRATION_UNREGISTERED","INTEGRATION_UNSUPPORTED","INTEGRATION_GRAPHQL_ERROR","INTEGRATION_BAD_REQUEST","INTEGRATION_UNAUTHORIZED","INTEGRATION_FORBIDDEN","INTEGRATION_NOT_FOUND","INTEGRATION_UNPROCESSABLE_CONTENT","INTEGRATION_RATE_LIMITED","INTEGRATION_INTERNAL_ERROR","INTEGRATION_NOT_IMPLEMENTED","INTEGRATION_BAD_GATEWAY","INTEGRATION_UNAVAILABLE","INTEGRATION_GATEWAY_TIMEOUT","INTEGRATION_TIMED_OUT","INTEGRATION_CACHE_ERROR","INTEGRATION_UNHANDLED_HTTP_ERROR","INTEGRATION_UNHANDLED_EXCEPTION","INTEGRATION_UNEXPECTED_ERROR","ILLEGAL_ARGUMENT_ERROR","BAD_REQUEST","FORBIDDEN","NOT_FOUND","REQUEST_TIMEOUT","CONFLICT","UNHANDLED_EXCEPTION","UNCATEGORIZED","SERVICE_CREATOR","UNKNOWN_HOST","TOO_MANY_REQUESTS"]}}},"TooManyRequestsProblemDetail":{"required":["type","title","status"],"type":"object","properties":{"detail":{"type":"string"},"instance":{"type":"string","format":"uri-reference"},"retryAfter":{"minimum":0,"type":"integer","description":"The number of seconds until the rate limiting resets.","format":"int32"},"status":{"maximum":599,"minimum":100,"type":"integer","format":"int32","enum":[429]},"title":{"type":"string"},"type":{"type":"string","format":"uri-reference"}}}},"responses":{"TooManyRequests":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/TooManyRequestsProblemDetail"}}},"description":"The client has exceeded the rate limit by performing too many requests in a short period. Retry the request after a delay.","headers":{"Retry-After":{"description":"The number of seconds until the rate limiting resets.","schema":{"minimum":0,"type":"integer","format":"int32"}}}}}},"paths":{"/api/v1/auth/key/{cid}":{"put":{"description":"Update API key\n\nThe API key used to make the request must have the `Edit API keys` permission","operationId":"updateApiKey","parameters":[{"description":"The unique, auto-generated identifier for the API key","in":"path","name":"cid","required":true,"schema":{"type":"string","description":"The unique, auto-generated identifier for the API key"}}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateApiRequest"}},"application/yaml":{"schema":{"$ref":"#/components/schemas/UpdateApiRequest"}}},"required":true},"responses":{"200":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiKeyDefinition"}},"application/yaml":{"schema":{"$ref":"#/components/schemas/ApiKeyDefinition"}}},"description":"Successfully updated API key"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}},"application/yaml":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}},"application/yaml":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Access denied"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}},"application/yaml":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"API key not found"},"429":{"$ref":"#/components/responses/TooManyRequests"}},"summary":"Update API key","tags":["API Keys"]}}}}
```

## Delete API key

> Delete API key\
> \
> The API key used to make the request must have the \`Edit API keys\` permission

```json
{"openapi":"3.0.1","info":{"title":"Cortex API","version":"v1"},"tags":[{"name":"API Keys"}],"servers":[{"url":"https://api.getcortexapp.com","description":"Cortex Cloud API host"}],"security":[{"bearerAuth":[]}],"components":{"securitySchemes":{"bearerAuth":{"bearerFormat":"JWT","description":"All requests to the Cortex API need to provide an `Authorization: Bearer <token>` header, where `<token>` is an API key created in the Settings page of your workspace.","scheme":"bearer","type":"http"}},"schemas":{"ErrorResponse":{"required":["message","type"],"type":"object","properties":{"details":{"type":"string"},"gatewayHttpStatus":{"type":"integer","format":"int32"},"httpStatus":{"type":"integer","format":"int32"},"message":{"type":"string"},"requestId":{"type":"string"},"type":{"type":"string","enum":["INTEGRATION_MISSING","INTEGRATION_UNREGISTERED","INTEGRATION_UNSUPPORTED","INTEGRATION_GRAPHQL_ERROR","INTEGRATION_BAD_REQUEST","INTEGRATION_UNAUTHORIZED","INTEGRATION_FORBIDDEN","INTEGRATION_NOT_FOUND","INTEGRATION_UNPROCESSABLE_CONTENT","INTEGRATION_RATE_LIMITED","INTEGRATION_INTERNAL_ERROR","INTEGRATION_NOT_IMPLEMENTED","INTEGRATION_BAD_GATEWAY","INTEGRATION_UNAVAILABLE","INTEGRATION_GATEWAY_TIMEOUT","INTEGRATION_TIMED_OUT","INTEGRATION_CACHE_ERROR","INTEGRATION_UNHANDLED_HTTP_ERROR","INTEGRATION_UNHANDLED_EXCEPTION","INTEGRATION_UNEXPECTED_ERROR","ILLEGAL_ARGUMENT_ERROR","BAD_REQUEST","FORBIDDEN","NOT_FOUND","REQUEST_TIMEOUT","CONFLICT","UNHANDLED_EXCEPTION","UNCATEGORIZED","SERVICE_CREATOR","UNKNOWN_HOST","TOO_MANY_REQUESTS"]}}},"TooManyRequestsProblemDetail":{"required":["type","title","status"],"type":"object","properties":{"detail":{"type":"string"},"instance":{"type":"string","format":"uri-reference"},"retryAfter":{"minimum":0,"type":"integer","description":"The number of seconds until the rate limiting resets.","format":"int32"},"status":{"maximum":599,"minimum":100,"type":"integer","format":"int32","enum":[429]},"title":{"type":"string"},"type":{"type":"string","format":"uri-reference"}}}},"responses":{"TooManyRequests":{"content":{"application/problem+json":{"schema":{"$ref":"#/components/schemas/TooManyRequestsProblemDetail"}}},"description":"The client has exceeded the rate limit by performing too many requests in a short period. Retry the request after a delay.","headers":{"Retry-After":{"description":"The number of seconds until the rate limiting resets.","schema":{"minimum":0,"type":"integer","format":"int32"}}}}}},"paths":{"/api/v1/auth/key/{cid}":{"delete":{"description":"Delete API key\n\nThe API key used to make the request must have the `Edit API keys` permission","operationId":"deleteApiKey","parameters":[{"description":"The unique, auto-generated identifier for the API key","in":"path","name":"cid","required":true,"schema":{"type":"string","description":"The unique, auto-generated identifier for the API key"}}],"responses":{"200":{"description":"Successfully deleted API key"},"400":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}},"application/yaml":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Bad request"},"403":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}},"application/yaml":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"Access denied"},"404":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}},"application/yaml":{"schema":{"$ref":"#/components/schemas/ErrorResponse"}}},"description":"API key not found"},"429":{"$ref":"#/components/responses/TooManyRequests"}},"summary":"Delete API key","tags":["API Keys"]}}}}
```


---

# Agent Instructions: Querying This Documentation

If you need additional information that is not directly available in this page, you can query the documentation dynamically by asking a question.

Perform an HTTP GET request on the current page URL with the `ask` query parameter:

```
GET https://docs.cortex.io/api/readme/api-keys.md?ask=<question>
```

The question should be specific, self-contained, and written in natural language.
The response will contain a direct answer to the question and relevant excerpts and sources from the documentation.

Use this mechanism when the answer is not explicitly present in the current page, you need clarification or additional context, or you want to retrieve related documentation sections.
