# Authentication and scopes

Source: https://developers.krans.ai/docs/authentication

## Authentication

Send a personal API key as a bearer token on every request. Keys never go in a URL or query string.

```
Authorization: Bearer krs_live_ab12cd34…
```

- **Keys belong to a person.** A key can do at most what its owner can do right now. Membership is checked on every request: if the owner leaves a workspace or is deactivated, the key loses that access on the next request.

- **Three limits stack:** the owner's current access, the ventures chosen for the key (all, or a fixed list), and the key's scopes. The narrowest wins.

- **Expiry is required:** 30, 90 or 365 days. In the last 7 days the key shows a warning on the Developer page; there is no email.

- **Shown once.** Krans stores only a hash. The visible prefix (`krs_live_ab12…`) tells keys apart on the Developer page, along with when and from which IP each was last used.

- **Rotate** issues a new secret with the same settings; the old one keeps working for up to 24 hours, never past its own expiry. **Revoke** takes effect within a minute.

- **Leaked a key?** If you commit or share one by mistake, revoke it and create a new one.

## Scopes

Each endpoint needs one scope, and sometimes a flag on top. A request without them fails with `insufficient_scope` and names what is missing.

| Scope | Allows |
| --- | --- |
| `conversations:read` | List and read calls, summaries, learnings, reflections, speakers. |
| `conversations:write` | Rename, change date or call type, set the account, upload, delete (delete also needs destructive). |
| `review:read` | Read the review queue, one item with its context and a call's account evidence; mark items seen. |
| `review:write` | Answer review items: who is speaking, which account a call is with, which thread it belongs in. Approve or dismiss held recordings, confirm speakers, approve or dismiss participants, dismiss duplicate contacts. |
| `contacts:read` | Contacts, participants, contact lists. |
| `contacts:write` | Create and edit contacts (up to 100 at once), set a contact's photo, link speakers, manage contact lists. |
| `accounts:read` | Accounts and account lists. |
| `accounts:write` | Create and edit accounts, set an account's logo, manage account lists. |
| `threads:read` | Thread board and thread detail. |
| `threads:write` | Change a thread's stage or owner. |
| `signals:read` | Signals, their learnings and timeline. |
| `context:read` | /context entries. The venture must also have /context enabled. |
| `transcripts` | Flag. Verbatim transcripts and quotes. |
| `destructive` | Flag. Delete and merge, on top of the area's :write scope. |

**Presets** when creating a key: **Read only** (every `:read`), **Read + edit** (every `:read` and `:write`), **Reviewer** (`review:read`, `review:write`, `conversations:read`, `contacts:read`), **Full** (everything, both flags) and **Custom**.

Writes are refused on a read-only workspace whatever the key allows (`workspace_read_only`). A deactivated workspace cannot be reached at all.
