contract 2026-10-05
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 endpoint except the two liveness probes (/api/v1/health/live and /api/v1/health/ready), the OpenAPI documents (/api/v1/openapi.json) and the signed image and report URLs requires an API key. Present the key in one of these ways:

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. It is one switch for the whole service, not a per-key setting. 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/v1/sites"

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

Sandbox key

The key lc_test_sandbox works on every endpoint and is answered with sample data: the documented response shape and status codes, with no quota, no bill and nothing stored. Search, single cars, batches and the brand, model, fuel, gearbox and source lists come from a 320-car sample inventory with your filters, sorting and paging applied, so an unknown id is a 404; other endpoints return a fixed sample, and a route with none answers 501 (code: not_available_in_sandbox). Responses carry "sandbox": true and an X-Sandbox: true header, and GET /api/v1/me reports key.sandbox. Build and test against it, then swap in your live key — nothing else in your code changes.

bash
curl -H "X-API-Key: lc_test_sandbox" "https://api.thecarapi.com/api/v1/vehicles?brand=bmw"
No signup needed. Sample data only — never real inventory or prices.

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 setA request to a route your key does not cover returns 403 with "code": "scope_not_granted". Read the key’s grants up front with GET /api/v1/me instead of finding them one 403 at a time.

Five failed authentication attempts from one IP trigger a temporary brute-force lockout: for 15 minutes every request from that address that carries no valid key answers 429 (code: too_many_failed_attempts) instead of 401. Requests carrying a valid key are never blocked by it, so a working integration that shares an address with a misconfigured one keeps running, and a successful authentication clears the counter. Do not retry a 401 in a loop.

Published scope groups

ScopePublished access
searchInventory search, filter facets (individually or combined via /api/v1/facets), sources, and the full model catalog
catalogManufacturer and model-group catalog
seoPopular searches and brand/model slug resolution
auctionsAuction detail, batch detail, images, price history, and VIN history
detailsFull vehicle details, including upstream fetches
top-offersAuctions priced below their market reference
classifiedsEuropean classifieds feed, facets, models and origin-URL resolution (theparking remains a legacy alias). Bulk export is not included
classifieds-exportBulk classifieds export. Granted only to approved accounts
archiveHistorical inventory search, stored detail, coverage, facets and closing-price statistics
marketMarket valuation, plus the Cars.bg and auction market price snapshots
shipsVessel search, position and track, and the key’s own shipments
watchesSaved vehicle searches with new-match polling and webhooks
carvalueThe CarValue tool: valuation by VIN or make/model, and VIN scan from a photo. The key’s account must also be granted CarValue
vehiclescanThe Vehicle Scan tool: saved vehicle requests and their matching offers. The key’s account must also be granted Vehicle Scan
calculatorImport cost calculator and supported countries
opsService health, the contract, and the API index

* grants every route. A scope may also be a literal URL rule rather than a group. public is a legacy compatibility bundle — search facets, catalog, SEO, auctions, calculator and health — preserved for older integrations; new keys are issued against the groups above.

Field grants

GroupFieldsDefault
listingIdentity, specifications, images, timing and VAT schemeAlways retained
source_pricesprices.current, prices.buy_now, prices.start, prices.finalIncluded
landed_pricesprices.landed_current, prices.landed_buy_now, prices.publicIncluded
house_valuationprices.estimated_valueIncluded where available
vehicle_identitychassis_number, car_id, vin_ocrIncluded where available; VIN-history route access is separate
crawl_metacreated_at, updated_at, first_seen_at, last_seen_at, last_available_at, last_changed_atIncluded where available
landed_breakdownprices.current_tax, prices.buy_now_tax, prices.current_tax_delivery, prices.buy_now_tax_deliverySeparate grant
market_referenceis_top_offer, top_offer_savings, top_offer_savings_pct, market_referenceIncluded
korea_mergesource_comparison, canonical_offerSeparate grant

These are provisioning defaults, not a promise about an existing key. Endpoint access does not automatically grant every response field: for example, top-offers can be callable while its market_reference block is omitted. Examples show illustrative fields; use the OpenAPI schema and handle omitted optional fields. Private bidder data and account credentials remain excluded regardless of field grants.

What a new key gets by default

Scopes are granted per endpoint, and a new customer key is issued with the common surface enabled and the rest switched off. If a route answers 403 on your key, it is not broken — it was not granted, and the operator can enable it. The table is for keys we issue by hand. Keys from the developer portal — the free trial and the paid packages — are issued by scope group instead (search, catalog, auctions, archive, details, market, top-offers, calculator and seo, plus classifieds when the package includes it), so they also carry the market snapshots, /api/v1/search/auction-ids and /api/v1/list-vehicles. GET /api/v1/me lists exactly what yours has.

Endpoints
Enabled by default/api/v1/vehicles, /api/v1/brands, /api/v1/models, /api/v1/types, /api/v1/years, /api/v1/production-years, /api/v1/fuels, /api/v1/countries, /api/v1/gearboxes, /api/v1/sites, /api/v1/load-models, /api/v1/facets, /api/v1/catalog/*, /api/v1/seo/*, /api/v1/vehicles/* (including /api/v1/vehicles/batch), /api/v1/vehicles/{site}/{id}/images, /api/v1/vin/*, /api/v1/archive/*, /api/v1/calculator/*, /api/v1/top-offers, /api/v1/classifieds/* (except export), /api/v1/car-details
Every key, whatever its scopes/api/v1/me, /api/v1/contract, /api/v1/health, /api/v1/
Granted per contract/api/v1/market/valuation, /api/v1/vessels/*, /api/v1/shipments, /api/v1/watches, /api/v1/carvalue/*, /api/v1/vehiclescan/*
Granted on request/api/v1/cars-bg-market, /api/v1/auction-market, /api/v1/search/auction-ids, /api/v1/vehicles/changes
Locked — approved accounts only/api/v1/classifieds/export (bulk export). Not available on a standard key; contact us to apply.

/api/v1/health/live and /api/v1/health/ready need no key and are unaffected by scopes.