> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.invoice-api.xhub.io/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.invoice-api.xhub.io/_mcp/server.

# Authentication

> Bearer tokens, test and live mode, quotas.

Every call carries the API key as a bearer token in the `Authorization` header:

```bash
curl https://service.invoice-api.xhub.io/api/v1/invoice/formats \
  -H "Authorization: Bearer sk_live_xxxxx"
```

## Test and live mode

| Prefix      | Mode | Used for                          |
| ----------- | ---- | --------------------------------- |
| `sk_test_*` | Test | Development and integration tests |
| `sk_live_*` | Live | Production                        |

The mode is part of the key itself — there is no separate switch and no second
base URL.

## Entitlements

What a key may do hangs on its entitlements:

* `pdf:{country}:generate` — create a PDF
* `e-invoice:{country}:{format}:create` — create an e-invoice
* `e-invoice:{country}:{format}:parse` — read an e-invoice

If one is missing you get `403`, not `401`. A `401` means the key is absent,
unknown or expired.

## Quotas

Usage is counted per entitlement. Once a quota is spent, the API answers `429`
and puts the details in the body.

> **Warning**
>
> API keys belong on your server, never in browser or mobile code. A key in the
> frontend is a published key.