Overview
integration_stock
Section titled “integration_stock”Your vehicles on your website. These endpoints give you the vehicles you are selling: the active adverts of your company’s seller profiles on the marketplaces we read. Nothing else is reachable with them, and no filter can reach anyone else’s adverts.
Set up
- Make one API key for the website on the API keys page, with only the
Website stock integration (
integration.stock). Limit it to your web server’s IP address (allowed_ips), so the key works from nowhere else. - Call from your server, never from the browser. Send the key as
Authorization: Bearer <key>. Put it in your server’s configuration; a key in a page’s JavaScript can be read by anyone who opens the page.
Build the pages
- List:
GET /vehicles, newest first, 50 a page (limitup to 200,offset;sortbyfirst_seen_at,price,yearormileage_km). Every vehicle class unless you passcategory. - Filters: build them from
GET /filter-values: it lists only the makes, models, fuels and so on that your stock has, with counts, and the year, price and mileage ranges. Pass the visitor’s current filters to it too: each field’s counts follow the other filters, so a dropdown keeps its choices.GET /countgives the number of results for a set of filters. - Labels: the class, fuel, gearbox, body, colour, drive, powertrain,
emission class and condition are codes (
diesel,black), the same on every marketplace.GET /filter-valuesgives each value’s label in Slovenian, English or Croatian (lang=sl,en,hr); show a vehicle’s values with those labels too. - Detail:
GET /vehicles/{vehicle_id}. Link to a vehicle by itsvehicle_id: it stays the same when you take an advert down and post the car again, so your links keep working.idis the advert’s own id and changes with a repost; the detail takes it too. A sold or withdrawn vehicle answers 404: show “no longer available”. - Description:
description_htmlis ready to put on your page: only paragraphs, line breaks, lists and bold or italic text, with no links, images, styles or scripts. - Equipment (
equipment, on the detail): the advert’s list, by group (Varnost,Udobje, …), in the marketplace’s own words and language; a group with nonameis a list the marketplace does not group. The detail also hasinterior,inspection_valid_until(YYYY-MM),co2_g_kmandconsumption_l_100km. - Photos and videos (
images): everything the advert shows, in its order. A video is a YouTube link (youtube.comoryoutu.be): embed it as a video, not as an image. The photos are the marketplace’s own image addresses for now; they will move to our servers later, and the field stays the same. - Prices:
priceis the advertised price,discount_pricea reduced price anyone can pay, if there is one, andconditional_priceone only on a condition (price_condition, most often financing). Anullprice means the advert has none:price_notesays why (call_for_price,negotiate).has_price=trueleaves those out. - Every field is described under the responses below (open
WebsiteVehicleDetail).
Cache on your server
Your stock changes a few times a day, and every answer carries ETag and
Cache-Control: private, max-age=300.
- Keep each answer for five minutes and serve your visitors from that copy.
- After that, ask again with
If-None-Match: <the ETag>: if nothing changed, the answer is an empty304 Not Modifiedand you keep your copy. - Don’t call us once per visitor: the key’s rate limit (120 calls a minute) is sized
for one server, and a busy page would hit it (
429, withRetry-After).
Errors
Every error is {"error": {"code", "message", "detail"}}; code is for
your code, message is readable.
401: no key, or not a valid one.403: the key lacks the integration, or the call came from an address the key does not allow.404on a vehicle: sold, withdrawn or not yours. Show “no longer available”.422: a filter value that does not exist (an unknown make names the nearest ones indetail).429: too many calls; waitRetry-Afterseconds.
When something is missing
A car you advertise but don’t see here is usually under a seller profile that is not linked to your company yet: tell us which advert, and we link it.