Odds API authentication and API keys
Authentication: API keys, environments and key hygiene. PreciseAPI sports odds API documentation.
Authenticate every request with an API key. Send it in the Authorization header as a bearer token — this is the recommended method.
Authorization header
curl "https://api.preciseapi.com/v1/leagues" \
-H "Authorization: Bearer $PRECISEAPI_KEY"Two alternatives are accepted for environments where setting headers is awkward:
| Method | Example | Notes |
|---|---|---|
| Bearer header | Authorization: Bearer pa_live_… | Recommended. |
| X-API-Key header | X-API-Key: pa_live_… | Equivalent to bearer. |
| Auth message | {"type":"auth","api_key":"pa_live_…"} | WebSocket only, as the first message, for clients that can't set headers (browsers). |
| Query parameter | ?api_key=pa_live_… | Refused (401 api_key_in_url) on REST and the WebSocket: URLs are written to proxy and browser logs. Use a header. |
Test and live keys
Sandbox accounts issue pa_test_ keys, which work on the API for pre-game odds within the Sandbox's credits and rate limit; paid plans issue pa_live_ keys. Both hit the same production feed — the prefix tells you which plan the key was created under. All keys on an account share its credit balance and rate limit.
Managing keys
- Create up to 10 active keys per account from the dashboard — one per service or environment is a good pattern.
- The full key is shown once at creation and the dashboard can't show it again, so roll a lost key instead. Keys are checked against a SHA-256 hash, and the copy we keep for support is encrypted.
- Rolling a key revokes it and issues a replacement with the same name in one step.
- Revoked keys return
401 key_revokedimmediately.
Keep keys server-side. Calling the API directly from a browser or mobile app exposes your key. Proxy requests through your own backend and cache shared responses.
Previous: Quickstart · Next: Key controls, teams & 2FA