# API Authentication: Keys, Headers and Troubleshooting

> Authenticate CurrencyCore API requests with a Bearer token or x-api-key header, rotate and revoke keys, troubleshoot 401 errors, and understand IP rules.

Canonical: https://currency-core.com/docs/authentication/
Updated: 2026-11-10
Published: 2026-06-03

---
Every request to the CurrencyCore API must be authenticated, except the public
`/v1/countries` and `/v1/currencies` endpoints.

## Send the key in a header

Use either a **bearer token** in `Authorization` (recommended) or the
**`x-api-key`** header. Both are equivalent.

```
Authorization: Bearer cc_live_your_key_here
```

```
x-api-key: cc_live_your_key_here
```

There is **no query-string authentication**. Keys in URLs end up in logs, so
send them only in a header over HTTPS. The `Authorization` header must include
`Bearer`; a raw key is not parsed. If neither header has a valid key, the API
returns `401 unauthorized`.

## Live and test keys

Choose **Live** or **Test** when creating a key in the dashboard.

| Type | Prefix | Behavior |
|---|---|---|
| Live | `cc_live_` | Production requests. Uses the organization's plan quota and rate limit. Data endpoints require a paid plan; `/ai` has its own AI credit gate. |
| Test | `cc_test_` | Development and testing. Uses the same data and counts against the organization's monthly quota. Always capped at the Free per-minute limit (60 requests per minute), regardless of plan. |

Keys belong to an **organization**. Owners and admins can create keys, reveal
them, rotate them, and revoke them. An organization can hold up to **10**
developer keys (live and test combined); demo keys are separate and do not count
toward that limit. The monthly request quota is shared by the organization; the
per-minute rate limit is enforced per key.

## Troubleshoot a 401

| Symptom | Likely cause | Fix |
|---|---|---|
| `401 unauthorized`, "Missing API key" | No `Authorization` or `x-api-key` header reached the API. | Add `Authorization: Bearer <key>`. Check that a proxy or gateway is not stripping the header. |
| `401 unauthorized`, "Invalid, revoked, or unscoped API key" | The key is mistyped, was revoked, belongs to a deleted organization, or has no server-side scope. | Copy the key again from the dashboard, or rotate it. |
| `401 unauthorized`, "This account has been suspended" | The key owner's account is suspended. | Contact support; rotating the key will not help. |
| `401` from the Playground only | Demo keys only work from the CurrencyCore app origin and the owner's signed-in session. | Open the Playground in the dashboard instead of calling with a copied demo key. |
| `401` on an MCP connection | The OAuth token expired or the connection was revoked. | Reconnect the MCP client and sign in again. |
| `403 forbidden`, "Live API keys require a paid plan" | A live key is calling a data endpoint on the Free plan. | Upgrade, or use a test key for development. |

A `403` means the key was recognized, but the plan, role, organization toggle,
or billing state blocks the request. Check the message before rotating anything.

## Key rotation and expiry

Live and test keys do not expire automatically. They remain valid until you
revoke or rotate them. Demo keys are the exception: they expire after **24
hours**, are capped at **30 requests per minute**, and are rotated by the
Playground. A demo key is a convenience credential, not a separate sandbox
dataset.

To rotate a key, use the dashboard rotate action. CurrencyCore creates the
replacement first, then retires the old key, so a failed create leaves the
integration working. Copy the new key at creation; owners and admins can reveal
it later.

Revocation is fast but not instant. Key records are cached for up to **5
minutes**, so a revoked key may continue to authenticate until that cache entry
expires. If a key leaks, revoke it and remove the old secret from your
environment immediately, then watch for requests during the cache window.

## Key security

- Store keys in a secrets manager or encrypted environment variables, never in
  source control or a client bundle.
- Give each service a separate key so one leak has a narrow blast radius.
- Prefer test keys in development, and revoke unused keys regularly.

## IP and network rules

CurrencyCore authenticates the **key**, not the source IP. There is no per-key
IP allowlist, so a leaked key works from anywhere until revoked. For source-IP
restriction, put the API behind your own proxy or egress firewall.

Demo keys are the one origin-bound credential. Outside local development they
work only from an allowed CurrencyCore app origin and the owner's signed-in
session. Live and test keys have no such restriction.

All production traffic must use HTTPS. Sending a key over plain HTTP exposes it
in transit.

## Rate limits

Per-minute limits are enforced **per API key**. Test keys use the Free limit of
60 requests per minute. Exceeding it returns `429 rate_limited` with a
`Retry-After` header in seconds. Monthly quotas, AI credits, overage, and history
lookback are on [Rate Limits and Plan Quotas](/docs/rate-limits/).

## Organization roles

| Role | Create keys | Manage billing | Invite members |
|---|---|---|---|
| Owner | Yes | Yes | Yes |
| Admin | Yes | Yes | Yes |
| Member | No | No | No |

## Related products

- [Pricing](/pricing/)
- [Currency API](/currency-api/)
- [MCP server](/mcp-server/)
- [Currency converter](/tools/currency-converter/)
- [Getting started](/docs/getting-started/)
