> ## Documentation Index
> Fetch the complete documentation index at: https://docs.cortex.io/llms.txt
> Use this file to discover all available pages before exploring further.

# API Keys

Use these operations to interact with [API keys](https://docs.cortex.io/configure/settings/api-keys) 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 theme={null}
{
  "type": "DEFAULT",
  "role": "READ_ONLY"
}
```

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

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

**Example payload with multiple roles:**

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

> [!NOTE]
>
> Note: Users with custom roles can only create API keys assigned to roles with equal or fewer permissions than their own.

## Operations

> [card] [List API keys](https://docs.cortex.io/api/rest/api-keys/list-api-keys.md)
>
> `GET /api/v1/auth/key`

> [card] [Get API key](https://docs.cortex.io/api/rest/api-keys/get-api-key.md)
>
> `GET /api/v1/auth/key/{cid}`

> [card] [Create API key](https://docs.cortex.io/api/rest/api-keys/create-api-key.md)
>
> `POST /api/v1/auth/key`

> [card] [Update API key](https://docs.cortex.io/api/rest/api-keys/update-api-key.md)
>
> `PUT /api/v1/auth/key/{cid}`

> [card] [Delete API key](https://docs.cortex.io/api/rest/api-keys/delete-api-key.md)
>
> `DELETE /api/v1/auth/key/{cid}`


## Related topics

- [List API keys](https://docs.cortex.io/api/rest/api-keys/list-api-keys.md)
- [Delete API key](https://docs.cortex.io/api/rest/api-keys/delete-api-key.md)
- [Update API key](https://docs.cortex.io/api/rest/api-keys/update-api-key.md)
