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

# Authentication

> Get an API key and authenticate your requests

Every BackQuant API request requires an API key passed in the `X-API-Key`
header. Keys are tied to your subscription tier and control your
[rate limits](https://docs.backquant.com/concepts/rate-limits.md).

## Get an API key

> [card] [Get your API key](https://backquant.com/api-access)
>
> Sign up or sign in at **backquant.com/api-access** to create and manage
> your keys.

## Pass your API key

Include your key in the `X-API-Key` header on every request.

```bash curl theme={"theme":{"light":"min-light","dark":"min-dark"}}
curl https://api.backquant.com/v2/gex/levels?symbol=BTCUSDT \
  -H "X-API-Key: bq_live_your_api_key_here"
```

```python Python theme={"theme":{"light":"min-light","dark":"min-dark"}}
import requests

resp = requests.get(
    "https://api.backquant.com/v2/gex/levels",
    params={"symbol": "BTCUSDT"},
    headers={"X-API-Key": "bq_live_your_api_key_here"},
)
data = resp.json()
```

```typescript TypeScript theme={"theme":{"light":"min-light","dark":"min-dark"}}
const resp = await fetch(
  "https://api.backquant.com/v2/gex/levels?symbol=BTCUSDT",
  { headers: { "X-API-Key": "bq_live_your_api_key_here" } },
);
const data = await resp.json();
```

API keys follow this format:

```text theme={"theme":{"light":"min-light","dark":"min-dark"}}
bq_live_<32-character-token>
```

> [!WARNING]
>
> Keep your API key secret. Do not commit it to source control or expose
> it in client-side code. If your key is compromised, rotate it
> immediately at [backquant.com/api-access](https://backquant.com/api-access).

## Endpoints that don't require auth

A small set of endpoints are intentionally public so you can introspect
the API before signing up:

| Endpoint | Purpose |
| - | - |
| `/v2/openapi.json` | Full machine-readable OpenAPI 3 spec |
| `/v2/docs` | Swagger UI - interactive playground |
| `/v2/redoc` | ReDoc - alternative reference renderer |
| `/v2/health` | Liveness/readiness probe for monitors |

Every other route requires `X-API-Key`.

## Authentication errors

A missing or invalid API key returns a `401` response with the
`UNAUTHORIZED` error code:

```json theme={"theme":{"light":"min-light","dark":"min-dark"}}
{
  "success": false,
  "error": {
    "code": "UNAUTHORIZED",
    "message": "Missing X-API-Key header"
  },
  "meta": {
    "version": "2.7",
    "timestamp": "2026-04-30T12:00:00Z",
    "request_id": "req_..."
  }
}
```

Common causes:

* The `X-API-Key` header is missing from the request.
* The key value has a leading/trailing space (common when copy-pasting).
* The key was revoked at [backquant.com/api-access](https://backquant.com/api-access).
* Your subscription lapsed (`FORBIDDEN` rather than `UNAUTHORIZED` in this case).

The `request_id` field in the `meta` block is the value of the
`X-Request-ID` header - include it when reporting auth issues so we can
trace the specific call in our logs.

## Next steps

> [card] [Quick start](https://docs.backquant.com/quickstart.md)
>
> Make your first API call.

> [card] [Code examples](https://docs.backquant.com/examples/python.md)
>
> Python, TypeScript, and curl recipes.

> [card] [Rate limits](https://docs.backquant.com/concepts/rate-limits.md)
>
> Per-tier limits and backoff strategy.

> [card] [Errors](https://docs.backquant.com/concepts/errors.md)
>
> Every error code with handling examples.


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