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

# Authentication - API keys, rotation and revocation

> How to get an Apexium API key, send it with the x-api-key header, rotate it without downtime and revoke it.

Every request carries an API key in the `x-api-key` header. The key identifies your account: every order, bet and figure the API returns belongs to it.

The one exception is [`GET /v1/health`](https://docs.apexiumbet.com/api-reference/overview#health), which needs no key. A key sent to it is ignored.

```bash theme={null}
curl https://api.apexiumbet.com/v1/me \
  -H "x-api-key: apx_live_…"
```

## Getting a key

1. **Access.** Your agent enables API access on your account. Until then, you cannot create a key.
2. **Key.** In the dashboard, open **Preferences → API** and create a key.
3. **Storage.** The key is shown once, in full. Apexium stores only a hash of it and cannot show it again: keep it in a secret manager. The dashboard then shows only its prefix and its last four characters.

Keys look like `apx_live_…`. A test environment, with its own base URL and keys, is available on request while you integrate. A key only works in the environment that issued it.

## Live keys

You can have **two live keys** at a time. That is enough to rotate without downtime. To create a third, revoke one first.

## Rotating a key

Rotate a key from the same place. Rotation issues a new key and sets an end date on the old one. You choose when the old key stops working:

| Option | The old key stops |
| - | - |
| Now | immediately |
| In 1 hour | one hour later |
| In 24 hours | one day later |
| In 7 days | one week later |

Deploy the new key while both work, then let the old one expire. Rotation needs a free slot: with two live keys, revoke one before rotating the other.

## Revoking a key

Revoking stops a key immediately. Revoke a key as soon as you suspect it leaked. If your agent withdraws API access from the account, every key of the account stops at once.

## Failed authentication

A request without a key, or with a key that is unknown, revoked or expired, gets `401 INVALID_API_KEY`. A valid key gets `403 API_ACCESS_DENIED` when the account no longer has API access or is suspended.

Repeated failures from the same address are throttled: after 20 failed requests in one minute, every request from that address gets `429 RATE_LIMITED` until the minute ends, whatever key it carries. See [Limits](https://docs.apexiumbet.com/api-reference/limits.md).

## Request identifiers

Every response carries an `x-request-id` header. Quote it when you contact support about a request.


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