# Authentication

Create a key in the dashboard. Open **Integrations & APIs**, then **API & SDK**, then **API keys**. The full key is shown once. It starts with `apk_`. Store it as a secret. The dashboard only keeps a prefix and the last four characters after that.

Send it on every request except the key-management routes.

```
Authorization: Bearer $ATOMICPLAYER_API_KEY
```

```bash
curl "https://api.atomicplayer.ai/v1/videos?workspaceId=$WORKSPACE_ID" \
  -H "Authorization: Bearer $ATOMICPLAYER_API_KEY"
```

## Scopes

A key only calls the routes its scopes allow. Pick the smallest set that the integration needs.

| Scope | Allows |
| --- | --- |
| `read` | List and read videos, folders, tags, and player config |
| `write` | Create, update, delete, upload, and publish those same resources |
| `analytics` | Analytics routes under `/v1/analytics` |
| `webhooks` | Create and manage webhook endpoints |
| `admin` | Workspace administration. Leave this off an integration key |

`GET` routes for videos, folders, tags, and players need `read`. `POST`, `PATCH`, `PUT`, and `DELETE` on those resources need `write`. Analytics needs `analytics` even when the method is `GET`. Webhooks need `webhooks` for every method.

A missing or revoked key returns `401`. A valid key without the scope returns `403`.

## Keys are managed with a session

Creating, listing, updating, and revoking keys uses the signed-in dashboard session, not an API key. Those routes are under `/v1/workspaces/{workspaceId}/api-keys`. An API key cannot mint another key.

Revoking a key takes effect on the next request.
