# Authentication

> **TL;DR** — Send `Authorization: Bearer <API key>` on every request, from your servers only. Each key belongs to your organisation and carries scopes; the table below is the one place that says which scope opens which endpoint. Admins and Developers create, rotate and revoke keys themselves on partner.wandura.ai → **Developers**.

## Send the key
```
Authorization: Bearer wnd_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx
```

The word `Bearer`, one space, then the key. Keys start with `wnd_live_`, which lets secret scanners find a key committed by mistake. The examples read the key from the environment variable `WANDURA_API_KEY`; each system you run sets it to its own key.

| You get | When |
|---|---|
| `401`, no `error_code` | The header is missing or malformed, or the key is unknown or revoked. |
| `403`, no `error_code` | The key is valid but lacks the endpoint's scope. |
| `503` `service_unavailable` | Wandura could not check the key in time. The key is fine: retry after `Retry-After`, never rotate it for this. |
| `400` `unsupported_version` | Checked before the key: your `Wandura-Version` header is not a supported version. |

A key acts for its whole organisation: the API has no per-viewer identity and uses no cookies. All rules in one place: [Canonical API behaviour](https://docs.wandura.ai/developers/reference/behaviour#authentication).

## Scopes
This is the only scope table in these docs; other pages link here.

| Scope | Label on the portal | Opens | How you get a key with it |
|---|---|---|---|
| `metadata:read` | Read film metadata | `GET /catalog` | **Developers** → **Sync catalog to your CMS** |
| `playback` | Play films | `POST /playback` (frozen path) | No longer created on **Developers**: new integrations play films from [your own video space](https://docs.wandura.ai/developers/concepts/own-space). Existing keys keep working; Wandura issues a replacement on request ([If a key leaks](https://docs.wandura.ai/developers/concepts/security#leaked-key)). |
| `creatives:export` | Receive exported creatives | `GET /creatives`, `GET /creatives/{id}` | **Developers** → **Receive creatives / webhooks** |
| `creatives:read` | — | `GET /creatives`, `GET /creatives/{id}`, `GET /creatives/{id}/file`, with share links of its own that stop working when the key is revoked ([why](https://docs.wandura.ai/developers/concepts/creatives#creatives-read-keys)) | Issued by Wandura when another organisation shares its creatives with you; not created on **Developers** |
| `videos:read` | Read open video (needs an app) | `GET /videos`, `GET /videos/{id}` | No longer created on **Developers** (open video is frozen). Existing keys keep working; each is bound to one app. |
| any scope | — | `GET /config` | Any valid key |
| `webhooks:manage` | Manage webhooks | Nothing: **reserved**. Change notifications for series need no scope: Wandura sets them up on request ([Change notifications](https://docs.wandura.ai/developers/concepts/own-space#change-notifications)). | Added automatically by **Receive creatives / webhooks**; it grants nothing |

> **Warning:** A key with `playback` can stream your licensed films. If it leaks, anyone can. Keep it on your server and revoke it the moment you suspect a leak: see [Security](https://docs.wandura.ai/developers/concepts/security#leaked-key).

Give each key only the scopes its system needs: a catalog sync job needs `metadata:read`, a marketing job `creatives:export`, never `playback`.

## Create a key
Members with the **Admin** or **Developer** role manage keys on the **Developers** page of [partner.wandura.ai](https://partner.wandura.ai).

1. Open **Developers** → **Create a key**.
2. Enter a **Label** (up to 80 characters) that says where the key runs, for example `catalog-sync-prod`.
3. Pick what the key is for (the purposes above), or choose scopes yourself under **Advanced: choose scopes**.
4. Select **Create key** and copy the key straight away. It is shown **once**: Wandura stores only a fingerprint.

The key list shows each key's prefix, label, scopes and **Last used**. Step-by-step screens: [Developer keys](https://docs.wandura.ai/partners/developer-keys).

## Rotate and revoke
Rotate replaces a key's secret and keeps its label, scopes and dated-version pin; revoke ends it for good. Both take effect within seconds, have no grace period, and never stop tickets already issued. The timings, the zero-downtime recipe and the leaked-key runbook are on [Security](https://docs.wandura.ai/developers/concepts/security#key-lifecycle).

### Revoke
Any Admin or Developer can revoke any key of the organisation, playback keys included. A revoked key cannot be restored or rotated: create a new one.

## Keep keys on your server
- Call the API only from your backend. Browser calls fail (no CORS), and a key inside an app can be extracted.
- One key per system and per environment, so you can revoke one without touching the others.
- Never log a full key. Quote the prefix when you talk to support.

## Related
- [Security](https://docs.wandura.ai/developers/concepts/security)
- [Quickstart](https://docs.wandura.ai/developers/quickstart)
- [Errors](https://docs.wandura.ai/developers/concepts/errors)
