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

# API Keys

> Create and manage API keys for SDK and API access

The API Keys page lets you create and manage keys used to authenticate with the [Cloud SDK](/cognee-cloud/connections/cloud-sdk), the [REST API](/api-reference/introduction), and [agent connections](/cognee-cloud/ui/integrations).

## Create a key

<Steps>
  <Step title="Open the create modal">
    Click **Create new key**. A modal opens with a name input (placeholder **e.g. Production, CI/CD, Local Dev...**).
  </Step>

  <Step title="Name and create the key">
    Enter a name and confirm. This calls **`POST /api-keys`** with `{name}`.
  </Step>

  <Step title="Copy the key">
    The new key is shown in full exactly once. Copy it immediately — afterwards only a masked label is displayed.
  </Step>
</Steps>

<Note>
  In cloud mode, the base URL shows your tenant URL once provisioned, or a **warming up…** badge while provisioning.
</Note>

<Note>
  In local (open-source) mode, you set the **LLM** API key that Cognee uses to build your knowledge graph directly from the [Overview](/cognee-cloud/ui/dashboard#llm-api-key-local-mode) page: a banner and modal let you paste the key and apply it to the running backend without editing `.env`.
</Note>

## Connection Details

The **Connection Details** card surfaces the values your clients need, each copyable:

| Field        | Description                                               |
| ------------ | --------------------------------------------------------- |
| API Base URL | Your tenant URL, e.g. `https://your-tenant.aws.cognee.ai` |
| Tenant ID    | Your tenant identifier                                    |
| User ID      | Your user identifier, from **`GET /api-keys/my-user-id`** |

It also shows an auth-header hint: `X-Api-Key: <your-api-key> • X-Tenant-Id: <tenant>`. Both the **X-Api-Key** and **X-Tenant-Id** headers are used by API clients and MCP.

## Manage keys

The page lists all active keys with their creation date (**`GET /api-keys`**). To revoke a key, click the delete icon next to it (**`DELETE /api-keys/{id}`**). Revoked keys stop working immediately.

## API reference

Two reference links are available on the page:

* **API Reference** — the shared Swagger docs at `api.aws.cognee.ai/docs`.
* **API Tenant Reference** — your tenant instance docs at `https://your-tenant.aws.cognee.ai/docs`.

<Warning>
  Store API keys in environment variables or a secrets manager. Do not hardcode them in source files.
</Warning>

## Usage

Pass the API key in requests:

**Python SDK:**

```python theme={null}
import cognee

await cognee.serve(
    url="https://your-tenant.aws.cognee.ai",
    api_key="your-key"
)
```

**REST API:**

```bash theme={null}
curl -H "X-Api-Key: your-key" https://your-tenant.aws.cognee.ai/api/v1/datasets/
```

See [Cloud SDK](/cognee-cloud/connections/cloud-sdk) for the full setup guide.
