GraphQL Source
The graphql source fetches vehicle inventory, dealer, and version catalog data from
the Nissan USA public GraphQL API (graphql.nissanusa.com). It is used by both the
Nissan and Infiniti projects — the same endpoint serves both brands, distinguished by
the market variable and Origin header.
Authentication
No credentials required. The API is a public CORS endpoint; requests must include an
Origin header matching the brand site (https://www.nissanusa.com or
https://www.infinitiusa.com).
The endpoint uses Akamai bot protection with TLS fingerprinting. The source module uses
curl_cffi with browser TLS impersonation and rotates sessions per-request to avoid
accumulating bot-manager risk scores.
Environment Variables
| Variable | Default | Description |
|---|---|---|
NISSAN_INVENTORY_DEALER_LIMIT | (none — all dealers) | Cap the number of dealers swept during inventory fetch. When set, only the first N dealers from fetchAllDealers are processed. Omit or leave unset to sweep all dealers. |
Operations
Inventory (fetch_inventory / fetch_infiniti_inventory)
Per-dealer sweep strategy:
- Dealer discovery —
getDealersByLatLng(fetchAllDealers=true)returns all dealer IDs. - Preflight — For each dealer, a single
getInventorycall readstotalMatchesand the facet payload. If the preflight captures all VINs, the sweep skips to the next dealer. - Year fan-out — The sweep partitions by
modelYearfacets and paginates each slice up to the API's 132-result ascending-sort cap. - Recursive subdivision — Slices exceeding the cap are subdivided along additional
facet axes (
gradeName,exteriorColourCode, etc.).
Dealers are swept concurrently (10 threads by default). Each thread uses its own
curl_cffi session to avoid cross-thread session sharing.
Dealers (fetch_dealers / fetch_infiniti_dealers)
Calls fetchAllDealers=true then fetches each dealer individually via
getDealerByDealerId to get the full record (hours of operation, service hours).
Versions (fetch_versions / fetch_infiniti_versions)
Calls getDetailedModels to discover model codes, then getDetailedVersionsByModel
once per model code for the full trim/color/spec/accessories catalog.