Skip to content

Quickstart

By the end of this page you will have listed vehicles from a showroom with their state drive-away price and hero image.

  1. Get credentials. You need a client_id and client_secret. Dealers create them in the Vyro Dashboard under Settings > Team > (a team member) > API Clients. Partners get them from Vyro: email support@vyro.co. Start on staging.

    A dealer’s client reads that dealer’s showrooms. A partner reading many dealers uses an app client. See Authentication.

  2. Exchange them for an access token. Tokens last 60 minutes. Cache one and reuse it until shortly before it expires.

    Terminal window
    curl -s https://authentication-api.vyrolabs-staging.net/api-client/authenticate \
    -H 'Content-Type: application/json' \
    -d '{"client_id":"YOUR_CLIENT_ID","client_secret":"YOUR_CLIENT_SECRET"}'
    { "access_token": "eyJhbGciOi...", "token_type": "Bearer", "expires_in": 3600 }
  3. Find your showroom. Every query about stock is scoped to a showroom. Look its id up once by code and keep it.

    query Showroom {
    showrooms(where: { code: { _eq: "your-showroom-code" } }) {
    id
    name
    domain
    default_pricing_code
    }
    }
  4. List vehicles. Send the query to the GraphQL endpoint with the token in the Authorization header.

    Terminal window
    curl -s https://graphql.vyrolabs-staging.net/v1/graphql \
    -H "Authorization: Bearer $ACCESS_TOKEN" \
    -H 'Content-Type: application/json' \
    -d @- <<'JSON'
    {
    "query": "query Stock($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 }, listing_type: { _eq: retail }, pricing_codes: { _contains: [$state] } }, order_by: [{ updated_at: desc }, { id: asc }], limit: 20) { id code production_year make model badge condition odometer price: pricing_config(path: $state) assets(where: { placement: { _eq: \"featured\" } }, limit: 1) { src } } }",
    "variables": { "showroomId": "YOUR_SHOWROOM_ID", "state": "AU_NSW" }
    }
    JSON
  5. Read the result. Prices are in cents, so 4599000 is $45,990.

    {
    "data": {
    "stocked_vehicles": [
    {
    "id": "0b6c0c1e-…",
    "code": "2024-byd-atto-3-extended-fs003",
    "production_year": 2024,
    "make": "BYD",
    "model": "Atto 3",
    "badge": "Extended Range",
    "condition": "new",
    "odometer": 0,
    "price": { "version": "v2", "driveAwayPrice": 4599000, "lineItems": { "…": "…" } },
    "assets": [{ "src": "https://ik.imagekit.io/vyro/…/hero.jpg" }]
    }
    ]
    }
    }