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

# API keys

> Create and manage your Adapter API keys

API keys authenticate every request to Adapter. Keys are prefixed `pk_live_…` and are accepted on every public endpoint — connections, knowledge, runtime, and custom-connector ingest.

## Creating an API key

<Steps>
  <Step title="Open the console">
    Log in at [mind.adapter.com](https://mind.adapter.com) and go to **Settings → API keys**.
  </Step>

  <Step title="Create a new key">
    Click **Create API key**. Give it a descriptive name (e.g. the service or environment that will use it).
  </Step>

  <Step title="Copy and store it">
    The full secret is shown once. Store it as an environment variable; never commit it to source control.

    ```bash theme={null}
    export ADAPTER_API_KEY="pk_live_..."
    ```
  </Step>
</Steps>

## Using a key

Pass the key in the `Authorization` header as a bearer token:

<CodeGroup>
  ```bash curl theme={null}
  curl https://api.adapter.com/v1/knowledge/search \
    -H "Authorization: Bearer $ADAPTER_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{"q": "Q1 launch plan"}'
  ```

  ```python python theme={null}
  import os, requests

  requests.post(
      "https://api.adapter.com/v1/knowledge/search",
      headers={"Authorization": f"Bearer {os.environ['ADAPTER_API_KEY']}"},
      json={"q": "Q1 launch plan"},
  )
  ```

  ```javascript node theme={null}
  await fetch("https://api.adapter.com/v1/knowledge/search", {
    method: "POST",
    headers: {
      Authorization: `Bearer ${process.env.ADAPTER_API_KEY}`,
      "Content-Type": "application/json",
    },
    body: JSON.stringify({ q: "Q1 launch plan" }),
  });
  ```
</CodeGroup>

## Scopes

Keys carry scopes that restrict what they can do. A request without the required scope returns `403 insufficient_scopes` with `details.missing_scopes` listing the gaps. See [Errors](/api-reference/errors) for the full response shape.

If you need finer-grained scopes than the console exposes, contact support.

## Rotation

To rotate a key without downtime:

1. Create a new key in the console.
2. Deploy the new key to your services.
3. Verify traffic on the old key has stopped.
4. Revoke the old key.

## Revoking a key

In **Settings → API keys**, find the key and click **Revoke**. Revocation is immediate — in-flight requests authenticated with the key complete, but new requests fail with `401 authentication_error`.

If you suspect a key has leaked, revoke it first and create a new one second.
