SafarAPI uses two layers of authentication:Documentation Index
Fetch the complete documentation index at: https://developers.safarapi.com/llms.txt
Use this file to discover all available pages before exploring further.
- Bearer API key (on every request) — proves your identity
- HMAC signature (on writes only: POST/PUT/DELETE/PATCH) — proves the request body has not been tampered with and is not a replay
API key format
Authorization: Bearer sk_live_<prefix>_<secret>.
Test keys (
sk_test_*) and live keys (sk_live_*) are issued separately. Test keys only access sandbox data; live keys only access production data.Signing writes
Every write request must include three headers:| Header | Value |
|---|---|
Idempotency-Key | UUID v4, unique per logical operation |
X-Timestamp | Unix epoch in seconds, must be within ±5 minutes of server time |
X-Signature | hex(HMAC_SHA256(secret, canonical)) |
Code samples
Common errors
| Code | Reason |
|---|---|
auth.api_key.missing | Authorization header absent |
auth.api_key.malformed | Header doesn’t follow Bearer sk_(live|test)_<prefix>_<secret> |
auth.api_key.invalid | Prefix unknown or secret mismatch |
auth.timestamp.missing | X-Timestamp absent on write |
auth.timestamp.skew | Timestamp more than 5 min off server time |
auth.signature.missing | X-Signature absent on write |
auth.signature.invalid | HMAC computation mismatch (body altered, wrong secret, etc.) |
idempotency.key.required | Idempotency-Key missing on write |
idempotency.key.conflict | Same key reused with a different body |
code, message, request_id.