# Authentication

> Coming soon

Send your API key in the header of every request:

```http
Authorization: Bearer pp_live_...
```

## Key format

- `pp_live_…` (string, required) — `pp_live_` followed by 32 letters and digits.
- `prefix` (string) — The first 12 characters, shown in your account to tell keys apart. It can’t be used to make calls.

## Creating and revoking keys

- Create, view and revoke keys under API keys in your account, and name each one.
- To create or revoke a key, you must have signed in within the last 15 minutes or confirmed it’s you with a passkey or code in this session. With two-step verification on, enter your code first.
- There’s a limit on how many active keys an account can have. Revoke unused ones to make room.
- Keys are checked on every request, so the next request after you revoke a key returns `401 revoked_api_key`.

> **Caution:** The full key is shown only once, at creation. We store only a hash and can’t recover it. If it leaks, revoke it right away and create a new one.

## Keeping keys safe

- Call from your own server, scripts or local clients. Never put the key in web front-end code, mobile app bundles or public repositories.
- The API never reads cookies. CORS responses use `Access-Control-Allow-Origin: *` without credentials, so browsers never send your login session.
- Use one key per machine or project so a leak only means revoking that one.

## Authentication errors

| Status | code | Cause | What to do |
| --- | --- | --- | --- |
| `401` | `missing_api_key` | The `Authorization` header is missing or isn’t `Bearer <key>`. | Add `Authorization: Bearer <API key>`. |
| `401` | `invalid_api_key` | The key is malformed or doesn’t exist. | Make sure you copied the whole key with no extra spaces. |
| `401` | `revoked_api_key` | The key has been revoked | Create a new key in your account. |
| `403` | `account_disabled` | The account is disabled. | Contact us with the `request_id`. |

| code | WWW-Authenticate |
| --- | --- |
| `missing_api_key` | `Bearer realm="paperpurr"` |
| `invalid_api_key` `revoked_api_key` | `Bearer realm="paperpurr", error="invalid_token"` |
| `account_disabled` | None |

When a client sees `error="invalid_token"`, it should prompt for a new key.

- [Errors](https://paperpurr.com/en/docs/errors)：The error format, the cause and fix for every error code, which ones to retry, and the correct way to handle common mistakes.
- [Rate limits and metering](https://paperpurr.com/en/docs/limits)：The three rate-limit layers and their headers, how each endpoint is metered and how the trial allowance works.

Next: [Status and changelog](https://paperpurr.com/en/docs/changelog.md)
