Stocked vehicles
stocked_vehicles are the cars a dealer has for sale: new, demo and used.
Get one
Section titled “Get one”By id:
query Vehicle($id: uuid!, $state: String!) { stocked_vehicles_by_pk(id: $id) { id code stock_id vin condition production_year make model badge series body_type fuel_type transmission drive_type colour interior odometer hide_odometer description is_sold available_from updated_at price: pricing_config(path: $state) location { name phone address } assets(where: { is_public: { _eq: true } }, order_by: [{ order: asc }, { id: asc }]) { src alt placement order } }}By the code in its URL, or by your own stock_id:
query VehicleByCode($showroomId: uuid!, $code: String!) { stocked_vehicles( where: { code: { _eq: $code } showroom_stocked_vehicles: { showroom_id: { _eq: $showroomId } } } limit: 1 ) { id make model }}query Vehicles($showroomId: uuid!, $state: String!) { stocked_vehicles( where: { showroom_stocked_vehicles: { showroom_id: { _eq: $showroomId } } is_published: { _eq: true } is_listed: { _eq: true } is_sold: { _eq: false } pricing_codes: { _contains: [$state] } } order_by: [{ updated_at: desc }, { id: asc }] limit: 50 offset: 0 ) { id code condition production_year make model badge odometer price: pricing_config(path: $state) assets(where: { placement: { _eq: "featured" } }, limit: 1) { src } }}Useful filters
Section titled “Useful filters”| To find | Add to where |
|---|---|
| New cars only | condition: { _eq: new } |
| Used and demo | condition: { _in: [used, demo] } |
| One make, any case | make: { _ilike: "toyota" } |
| Electric | fuel_type: { _ilike: "%electric%" } |
| Under 50,000 km | odometer: { _lt: 50000 } |
| 2022 or newer | production_year: { _gte: 2022 } |
| Under $40,000 (any state) | min_price: { _lt: 4000000 } |
| Discounted | has_discount: { _eq: true } |
| At one location | location_id: { _eq: "…" } |
| Arriving later | available_from: { _gt: "now()" } |
| Changed since | updated_at: { _gt: "2026-10-28T00:00:00Z" } |
Makes and models in stock
Section titled “Makes and models in stock”query Makes($showroomId: uuid!) { stocked_vehicles( where: { showroom_stocked_vehicles: { showroom_id: { _eq: $showroomId } } is_published: { _eq: true } is_listed: { _eq: true } } distinct_on: [make] order_by: [{ make: asc }] ) { make }}distinct_on needs the same field first in order_by. It scans the whole showroom, so cache the answer rather than running it per page view.
Fields worth knowing
Section titled “Fields worth knowing”| Field | Type | Notes |
|---|---|---|
id |
uuid | Permanent. Use it as your key. |
code |
string | The vehicle’s URL key. See Vehicle URLs. |
stock_id |
string | The dealer’s stock number. Unique within a dealer, not across dealers. |
vin |
string | Often empty for new stock. Don’t rely on it to match vehicles across sources. |
source_id, source_name |
string | The id and system the vehicle was imported from. |
condition |
enum | new, used or demo. |
production_year |
number | Model year. |
odometer |
number | Kilometres. Hide it when hide_odometer is true. |
range |
number | Electric range in kilometres, when known. |
useable_battery |
number | Battery capacity in kWh, when known. |
pricing_config |
JSON | Prices per state, in cents. See Prices. |
pricing_codes |
string[] | States the vehicle is priced in. |
min_price, max_price |
number | Lowest and highest drive-away price across all states, in cents. For filtering and sorting only: show the state’s own price. |
is_published |
boolean | Public. |
is_listed |
boolean | Shown in lists and search. |
is_sold |
boolean | Sold. Its page stays up. |
available_from |
date | null means available now. |
estimated_delivery_delay |
number | Days until it can be delivered. |
body_type, fuel_type, transmission, colour |
string | Free text from the dealer. Normalise before you build filters. |
vehicle_specification |
relationship | Manufacturer specs when matched. Select its fields, e.g. vehicle_specification { ancap_rating seat_capacity combined_power_kw }. |
updated_at |
timestamp | Changes whenever the vehicle, its price or images change. |