On this page
Authentication
How does API authentication work? API keys authenticate /v1 requests. Portal login uses Auth.js (JWT session cookies) and is not reusable as an API key.
Key format
Keys use prefix cc_. Secrets are stored as peppered SHA-256 hashes only (API_KEY_PEPPER). Create, rotate, or revoke from /portal/keys. The full secret is shown once — copy it immediately.
Sending the key
Use either header:
Authorization: Bearer cc_…x-api-key: cc_…
Store keys in server environment configuration. Never ship production API keys in client-side JavaScript that runs in end users’ browsers.
cURL
curl -s https://api.crunchclash.com/v1/seasons/current \
-H "x-api-key: YOUR_API_KEY"
Portal sessions
Sign in at /auth/signin (credentials or Google). Edge middleware and requirePortalSession accept Auth.js JWTs only.
Public routes (no key)
GET /v1/healthGET /v1/readyGET /v1/openapi
Errors
| Code | HTTP | Meaning |
|---|---|---|
UNAUTHORIZED | 401 | Missing, invalid, revoked, or expired key / session |
RATE_LIMITED | 429 | Over per-account quota |
Related: API Reference · Playground