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

# API keys

> Create, scope, and revoke API keys for calling the Cotool REST API.

Open [Settings > API keys](https://app.cotool.ai/settings/api-keys) ([eu.cotool.ai/settings/api-keys](https://eu.cotool.ai/settings/api-keys) for EU organizations) to create and revoke keys for scripts, CI pipelines, and external services calling the [Cotool REST API](https://docs.cotool.ai/api-reference/introduction.md#authentication).

> [!NOTE]
>
> Managing keys requires the `setting.apiKey.manage` permission. Connecting an
> AI app to Cotool's [MCP server](https://docs.cotool.ai/mcp/overview.md) uses OAuth instead of an API
> key.

## Generate an API key

**1. Sign in through the browser**

Creating an API key requires a signed-in browser session — existing API
keys cannot create new API keys.

**2. Generate and describe the key**

Select **Generate key** and enter an optional **Description** (up to 255
characters, such as `Nightly export job`) so you can recognize what uses
the key later.

**3. Copy and store the secret**

Copy the generated key (prefixed with `cotool_`) into your secrets
manager. Cotool displays the secret only once and cannot retrieve it
again.

## Scope and service accounts

* **User-scoped permissions:** Every API key inherits the exact organization, role, and permissions of the user who created it. It cannot use platform-admin capabilities or switch organizations.
* **Per-user key list:** **Settings > API keys** shows keys created by your own account, along with each key's **Description**, **Created** timestamp, **Last used** timestamp, and **Status** (`Active`, `Expired`, or `Revoked`).
* **Least-privilege automation:** For long-lived services or CI jobs, create the key from a dedicated service user assigned a custom [role](https://docs.cotool.ai/settings/managing-roles.md) with only the permissions that integration needs. Deactivating that user immediately invalidates all of their keys.

## Revoke a key

In **Settings > API keys**, select **Revoke key…** next to the key and confirm **Revoke key**. Revocation takes effect immediately and cannot be undone.

## Audit trail

Creating and revoking keys are recorded in [Settings > Audit logs](https://docs.cotool.ai/settings/audit-logs.md) as `user.createdApiKey` and `user.revokedApiKey`.

## Related

> [card] [API Overview](https://docs.cotool.ai/api-reference/introduction.md)
>
> Authenticate requests with bearer tokens and explore published
> endpoints.

> [card] [Manage accounts and roles](https://docs.cotool.ai/settings/managing-roles.md)
>
> Create least-privilege roles for service accounts.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.