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

# Blink PDF API Authentication: Keys and Headers

> Authenticate Blink PDF render and template requests with an API key in the x-api-key header. Learn where to get your API key, how to send it, and what 401 and 402 errors mean.

Every render or template request to the Blink PDF **REST API** must be authenticated with an API key. The health check is public. You include your key in the `x-api-key` header of every authenticated request. Your key identifies your account, determines your plan limits, and (on Pro+ plans) lets you attribute usage across multiple keys. For agent connectors, the [MCP server](/mcp/overview) also supports OAuth 2.1 — see [Connect a Client](/mcp/setup).

## API Key Format

All Blink PDF API keys start with the prefix `bp_` followed by a unique alphanumeric string. You can recognise a production key at a glance:

```
bp_aBcDeFgHiJkLmNoPqRsTuVwX
```

<Warning>
  Keep your API key secret. Do not commit it to source control, expose it in client-side JavaScript, or share it in public forums. If a key is compromised, rotate it immediately from the dashboard.
</Warning>

## Sending the x-api-key Header

Include your API key in the `x-api-key` header on every authenticated request:

```http theme={null}
x-api-key: bp_...
```

Here is a minimal example using `curl`:

```bash theme={null}
curl https://api.blinkpdf.io/v1/render \
  --request POST \
  --header 'Accept: application/pdf' \
  --header 'Content-Type: application/json' \
  --header 'x-api-key: bp_xxxxxxxxxxxxxxxxxxxx' \
  --data '{"markdown": "# Hello\n\nWorld"}' \
  --output hello.pdf
```

## Getting Your API Key

You can create, view, and revoke API keys from the Blink PDF dashboard:

**[https://app.blinkpdf.io](https://app.blinkpdf.io)**

Navigate to **Settings → API Keys** to generate a new key. You can create multiple keys — for example, one per environment or one per service — and revoke individual keys without affecting the others.

<Note>
  API keys are shown in full only at creation time. Copy and store your key securely before closing the dialog — you will not be able to retrieve it again.
</Note>

## Per-Key Usage Attribution

On **Pro+ plans**, each API key carries its own usage attribution. This means you can track how many renders each key has performed independently, which is useful when you manage multiple environments (development, staging, production) or multiple services that each call the render endpoint.

<Info>
  Per-key usage reporting is a Pro+ feature. On lower-tier plans, all keys share a single usage counter tied to your account.
</Info>

## Authentication Errors

If your request cannot be authenticated or authorised, the API returns one of the following errors:

| Status Code            | Meaning                                                    | Common Cause                                                                                          |
| ---------------------- | ---------------------------------------------------------- | ----------------------------------------------------------------------------------------------------- |
| `401 Unauthorized`     | The API key is missing or invalid                          | The `x-api-key` header was omitted, the key was malformed, or the key has been revoked                |
| `402 Payment Required` | The key is valid but the plan's spend cap has been reached | Usage beyond the included volume is paused until the next billing period (`error: spend_cap_reached`) |

A `401` response always means the API could not verify your identity. Check that you are including the `x-api-key` header and that the key value starts with `bp_`. A `402` response means your key is valid but the plan's spend cap has been reached — raise the spend cap or upgrade your plan at [https://app.blinkpdf.io](https://app.blinkpdf.io) to continue rendering.
