> This page is for version v2.
> For other versions, use one of these documentation indexes:
> - v1 (default): https://developers.outpave.com/v1/llms.txt
> - v2: https://developers.outpave.com/v2/llms.txt

> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://developers.outpave.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://developers.outpave.com/_mcp/server.

# Authentication

## Create a v2 API key

In the app, open **Settings**, then **API Access**, and create a key or edit an existing one.

1. Turn on **Allow this key to use API v2**.
2. Choose the key's permissions, for example `cards:read` or `cards:write`. Each operation in the reference needs specific permissions; a call outside them returns `PERMISSION_DENIED`.
3. Choose the role. `ReadOnly` keys can hold read permissions only.
4. Optionally restrict the key to specific IPs or CIDR ranges.

The secret is shown once, so store it immediately. Keep it on a trusted server and never ship it in a browser or mobile app.

A key created with v2 access works only with v2. An existing v1 key that you enable for v2 keeps its v1 access, which its v2 permissions do not limit. Changing a key's permissions, role or IP allowlist ends its current access tokens.

## Get an access token

Send the API key as a bearer credential to `POST /access-token`. This is the only operation that accepts the API key.

```bash
curl -X POST "https://$API_HOST/api/v2/access-token" \
  -H "Authorization: Bearer $API_KEY"
```

```json
{
  "token": "eyJhbGciOiJIUzI1NiIsInR5cCI6ImF0K2p3dCIsImtpZCI6InYyLTIwMjYxMDEyIn0...",
  "tokenType": "Bearer",
  "expiresIn": 1800,
  "expiresAt": 1791820800000
}
```

`expiresIn` is in seconds and `expiresAt` is in Unix epoch milliseconds. The request takes no body; send none or `{}`.

## Use the token

Send the token on every other operation:

```
Authorization: Bearer <token>
```

To refresh, exchange the API key again before `expiresAt`. An access token never creates another access token. Never log a token or put it in a URL.

A platform key also names the account holder it acts on:

```
Account-Holder: <accountHolderId>
```

## Authentication errors

| Status | Code                            | Meaning                                                                      |
| ------ | ------------------------------- | ---------------------------------------------------------------------------- |
| `401`  | `INVALID_API_KEY`               | The API key is missing or invalid, or not allowed from this address.         |
| `401`  | `INVALID_ACCESS_TOKEN`          | The access token is missing, invalid or expired. Exchange the API key again. |
| `403`  | `API_KEY_NOT_ENROLLED`          | The key is not enabled for v2.                                               |
| `403`  | `PERMISSION_DENIED`             | The key lacks a permission this operation needs.                             |
| `403`  | `ACCOUNT_HOLDER_NOT_ACCESSIBLE` | The key cannot act on the account holder you named.                          |
| `400`  | `ACCOUNT_HOLDER_REQUIRED`       | A platform key called an account holder operation without `Account-Holder`.  |

A `401` response carries `WWW-Authenticate: Bearer`, with `error="invalid_token"` when a credential was sent and refused.