# Authentication and API keys

Every request carries an organisation API key as a bearer token. A key belongs to one organisation and only ever sees that organisation's data.

## Create a key

In the admin, open **Organisation › API Keys** and create a key, or call `POST /v1/api-keys` with a key that has `org_manage`. The secret (`sk_live_…`) is shown once, in the create response. Store it in your secret manager straight away: Audiobly keeps only a hash and cannot show it again.

```bash tab=cURL group=create
curl -X POST https://api.audiobly.com/v1/api-keys \
  -H "Authorization: Bearer $AUDIOBLY_ADMIN_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "CMS sync (read-only)", "scopes": ["read", "asset_view"], "expires_in_days": 90}'
```

```json tab=Response group=create
{
  "id": "6c1f…",
  "name": "CMS sync (read-only)",
  "key_prefix": "sk_live_",
  "key": "sk_live_…",
  "scopes": ["read", "asset_view"],
  "expires_at": "2027-02-19T10:00:00Z"
}
```

## Send it on every request

```text
Authorization: Bearer sk_live_…
```

A missing, unknown, revoked or expired key gets `401`. Keys work only over HTTPS.

## Scopes

A key with no scopes has full management access to its organisation. Give each integration a scoped key with only what it needs, so you can revoke it without touching anything else. A scoped key calling something outside its scopes gets `403 FORBIDDEN`.

| Scope | Lets the key |
|---|---|
| `read` | read events, programmes, speakers, sponsors and transcripts |
| `event_create` | create events |
| `event_edit` | change events, programmes, speakers and sponsors |
| `prep_manage` | manage keyterms, glossaries and event preparation |
| `capture_upload` | upload recordings and run live capture |
| `asset_view` | read and download reports and content assets |
| `asset_manage` | generate, approve and change reports and content assets |
| `analytics_view` | read insights, audience and analytics |
| `sponsor_view` | read sponsor analytics |
| `content_edit` | edit transcripts and content |
| `org_manage` | manage API keys and organisation settings |

An unknown scope is rejected with `422`. The full list is in the [API keys reference](/developers/api/reference/api-keys).

## Expiry, rotation and revoking

- Set `expires_in_days` or `expires_at` when you create a key. After that moment it stops working.
- `POST /v1/api-keys/{key_id}/rotate` issues a new secret for the same key, with the same scopes and expiry. The old secret stops working at once.
- `DELETE /v1/api-keys/{key_id}` revokes a key.
- `GET /v1/api-keys` lists active keys with their prefix, scopes, expiry and `last_used_at`. Secrets are never returned again.

> Keep keys out of browsers, mobile apps and shared repositories. Call the API from your server, or read the key from an environment variable.
