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

# Authentication & rate limits

> Authenticate requests with an organization API key (`x-api-key`), understand permissions, and handle rate limits.

## API keys (`x-api-key`)

Authenticate every request by passing your API key in the **`x-api-key`** header:

```bash theme={null}
curl https://api.cloneable.ai/auth/whoami \
  -H "x-api-key: sk-cai-v1-..."
```

> [!WARNING]
>
> Do **not** send API keys in `Authorization: Bearer`. Bearer authentication is reserved for user session JWTs and OAuth tokens and will reject `sk-cai-v1-...` keys with `401 Unauthorized`.

### Creating and revoking keys

* **Who can create keys:** Organization admins, from a signed-in Cloneable Office session under **Settings → API Keys**. Keys cannot be minted by another API key.
* **Expiration:** Defaults to 90 days (or set to never expire). Revoking a key in Settings takes effect immediately.
* **Permissions:** An API key is bound to one organization and inherits its creator's **live** organization roles. If the creator's role becomes read-only (`data_manager_readonly`) or they leave the organization, the key's permissions update or stop immediately.
* **Read-only keys:** Keys created by a read-only member can call `GET` endpoints and read-safe queries, while mutating (`POST`, `PUT`, `PATCH`, `DELETE`) calls return `403 Forbidden`.

## Rate limits

| Bucket | Limit | Scope |
| - | - | - |
| Authenticated requests | **500 requests / 60 seconds** | Per endpoint path, per authenticated user |
| Unauthenticated requests | **50 requests / 60 seconds** | Per endpoint path |

When a limit is exceeded, the API responds with `429 Too Many Requests`. Back off and retry after a short delay.

## Error format

Errors return JSON with a `message` string and an optional machine-readable `code`:

```json theme={null}
{
  "message": "Invalid API Key"
}
```

| Status | Meaning |
| - | - |
| `400` | Invalid path, query, or request body parameters |
| `401` | Missing, expired, or invalid `x-api-key` |
| `403` | Key lacks permission for this action or is read-only |
| `404` | Resource does not exist in your organization |
| `409` | Conflict (for example, deleting a custom type still referenced by a template) |
| `429` | Rate limit exceeded |


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