> ## Documentation Index
> Fetch the complete documentation index at: https://docs.fandom.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Authentication

> API keys, scopes and safe retries.

Send your API key with every request:

```http theme={null}
Authorization: Bearer fnd_...
```

Workspace admins create keys on [the API key page](https://fandom-api-preview.vercel.app/api-keys) (**Settings → API access** in Fandom).

A key belongs to one workspace and acts as the admin who created it. It stops working when it's revoked there, or when that person leaves the workspace.

## Scopes

You choose what a key can do when you create it. A request without the scope it needs gets `403`.

| Scope | Allows |
| - | - |
| `campaigns:read` | Read campaigns and their targeting |
| `campaigns:write` | Create, update and delete campaigns; generate and edit targeting |
| `audiences:read`, `audiences:write` | Read, or create and change, audiences |
| `datasets:read`, `datasets:write` | Read, or create and change, data stores |
| `brands:read`, `brands:write` | Read, or create and change, brands |
| `exploration:read` | Audience Exploration (invite-only) |
| `google-ads:read` | Google Ads accounts and performance |
| `google-ads:write` | Create campaigns in Google Ads, always paused |

## Limiting a key

When you create a key you can also limit it to certain Google Ads accounts or campaigns. A key limited to campaigns can't create new ones.

## Safe retries

Add an `Idempotency-Key` header to any write. Retrying with the same key returns the first result instead of making the change twice.

```bash theme={null}
curl https://www.fandom.ai/api/v1/campaigns \
  -H "Authorization: Bearer $FANDOM_API_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: spring-launch-1" \
  -d '{ "name": "Spring launch", "campaignType": "SEARCH" }'
```

Keys are remembered for 24 hours. Reusing one with a different body returns `409`.


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.