Find a section & browse all pages
Authentication
// secret keys, sent as a bearer token
Authenticate every request with your secret API key in the Authorization header. Keys are created and rotated in API keys. Live keys are prefixed sk_live_ and use credits or their attached prepaid pass. Test keys sk_test_ run against a sandbox that returns a deterministic, never-billed token stamped "mode":"sandbox" — ideal for wiring up and CI, but they never clear a real gate, so don't ship them to production.
Authorization: Bearer sk_live_8Kd2aF9pQ…X1c
// keep secret keys server-side — never ship them to a browserTreat keys like passwords. A leaked sk_live key can spend your balance — rotate it from the dashboard the moment it's exposed, and the old key dies instantly.
Four different refusals, and only one of them is the key being wrong. They are easy to confuse because all four arrive on a request that looks identical:
| Status | error.code | What it actually means |
|---|---|---|
| 401 | invalid_key | Missing, malformed, or revoked. A rotated key returns this immediately — there is no grace period by design. |
| 403 | email_unverified | The key is real and the account has not verified its email. Live keys only; sandbox keys work regardless. |
| 402 | key_budget_exceeded | The key is fine and its own monthly budget is spent. The workspace may still have balance. |
| 429 | rate_limited | The key is fine and it is going too fast. Never billed. Back off for the window in Retry-After. |
Scope each key to its integration. Set per-key rates, credit budgets and access rules in API keys. Workspace spending limits and pass throughput are available in Usage & limits.
Sandbox keys are not a lesser live key. An sk_test_ key returns a deterministic response stamped "mode":"sandbox" instantly, at no cost and against no real gate. That makes it right for wiring up the call and for CI, and useless for anything that has to clear an actual challenge — the token it returns will not be accepted by Cloudflare. Check mode in the response before trusting a token in production; it is there so a test key in a production config fails loudly instead of quietly.
Ready to pour through the gate?
// free sandbox keys · no card required to start