# Authentication

Every API call carries an API key in the `Authorization` header:

```sh
curl "$API_BASE/v1/account" -H "Authorization: Bearer $DNSSUPER_API_KEY"
```

The MCP server takes the same key in the same header.

## Making and managing keys

Create keys under [API keys](/app/keys) in the dashboard. Each key belongs to the account you made it in,
so its calls draw on that account's credits and follow that account's plan. A key is shown once, when you
create it; after that the dashboard shows only its first characters, so you can tell keys apart.

- **Rotate** a key to get a new secret for the same key. The old secret stops working at once.
- **Revoke** a key you no longer need, or one that may have leaked. Calls with it fail straight away.

Make one key per app or server, so you can revoke one without touching the others.

## What a key looks like

Production keys start with `live_` and keys from any other environment start with `test_`, followed by 43
letters and digits. We store only a keyed hash of each key, never the key itself, so we can't show it to you
again or recover it.

## Keeping keys safe

- Keep keys in environment variables or a secret store, never in source code or a public repository.
- Never put a key in a web page or a mobile app: anyone could read it there.
- If a key leaks, revoke it in the dashboard and make a new one.

## Errors

| Status | Code | When |
| --- | --- | --- |
| 401 | `unauthorized` | The key is missing, unknown or revoked, or the person who made it has left the account. |
| 403 | `account_suspended` | The account is suspended. |
| 403 | `sign_in_required` | The call needs an account and was made without one. |

A failed call costs nothing. See [errors](/docs/errors) for the full list.
