contract 2026-08-19
Security

Authentication & scopes

Three interchangeable ways to present a key, the restrictions a key can carry, and the scope groups that gate each endpoint.

Every documented endpoint requires an API key. Use exactly one authentication method per request — sending two is not an error, but which one wins is not something to depend on.

MethodHeader or parameterNotes
HeaderX-API-Key: <key>Recommended for server-to-server calls.
BearerAuthorization: Bearer <key>Equivalent to X-API-Key.
Query string?api_key=<key>Disabled by default; use only when explicitly enabled for your key. Keys in URLs end up in logs and referrers.
bash
# Header — the normal case
curl -H "X-API-Key: $API_KEY" "https://api.thecarapi.com/api/sites"

# Bearer — identical behaviour, useful when your HTTP layer already speaks OAuth
curl -H "Authorization: Bearer $API_KEY" "https://api.thecarapi.com/api/sites"

Key restrictions

RestrictionEffect when violated
IP or CIDR allowlistRequests from outside the list return 403.
Origin allowlistBrowser requests from other origins return 403.
Expiry dateRequests after the date return 401.
Status (revoked, suspended)All requests return 403.
Scope setEndpoints outside the set return 403 scope_denied.

Repeated authentication failures trigger a temporary 429 lockout on the offending source. A deploy that ships a bad key will lock itself out before you notice the 401s, so fail fast on 401 rather than retrying.

Published scope groups

Scopes are groups, not per-endpoint flags. Each endpoint in this reference names the scope it needs in its header row.

ScopePublished access
searchInventory search, filter facets (individually or combined via /api/facets), sources, and the full model catalog
catalogManufacturer and model-group catalog
seoPopular searches and brand/model slug resolution
auctionsAuction detail, images, price history, and VIN history
detailsFull vehicle details, including upstream fetches
top-offersAuctions priced below their market reference
theparkingEuropean classifieds feed, facets, and models
marketCars.bg and auction market price snapshots
calculatorImport cost calculator and supported countries
opsService health and the API index