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

# Authentication

## Create a key

In the app, open **More → API** in the rail and click **Create** ([step by step](https://docs.capital.ai/app/api-keys.md)). Choose its scopes:

| Scope | Grants |
| - | - |
| `read` | Every `GET` endpoint. The default for a new key. |
| `trade` | Endpoints that move money into your account, trade on the exchange, or deploy: deposits, orders and deployments. |

The key is shown **once**, when you create it. Store it like a password.

## Use a key

Send it on every request:

```bash theme={null}
curl https://capital.ai/api/v1/whoami \
  -H "Authorization: Bearer $CAPITALAI_API_KEY"
```

```json theme={null}
{ "accountId": "acc_123" }
```

## Revoke a key

Revoke a key on the same **API** page. It stops working on the next request.

A key can't create or revoke keys; that is done in the app.

## What a key can't reach

Sending money out, linking banks, buying from an Offtake listing, and the live exchange reads (order book, positions, open orders) are **session only** today: the app does them, a key gets `401`. The reads are coming to the API.

## Errors

| Status | Meaning |
| - | - |
| `401` | No key, an unknown key, a revoked key, or a session-only endpoint. |
| `403` | The key is valid but lacks the scope this endpoint needs. |


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