/get

GET /cars — the request, in four languages

Copy-paste requests for curl, JavaScript, Python and PHP, plus how paging and sorting behave when you ask for more than one page.

01

curl

Everything is a GET. No request body, no content type to negotiate — if you can make an HTTP request you can call this.

curl -H "x-api-key: YOUR_KEY" \
  "https://api.encar-api.com/api/cars?manufacturer=BMW&model=X5&fuel=diesel&priceTo=40000&sort=priceAsc&count=24"
02

JavaScript

Call it from a server or an edge function, not from the browser: anything in front-end JavaScript ships your key to every visitor who opens devtools.

const params = new URLSearchParams({
  manufacturer: "Hyundai",
  yearFrom: "2020",
  priceTo: "30000",
  count: "24",
});

const res = await fetch(`https://api.encar-api.com/api/cars?${params}`, {
  headers: { "x-api-key": process.env.ENCAR_API_KEY },
});
if (!res.ok) throw new Error(`encar: ${res.status}`);
const { total, results } = await res.json();
03

Python

The same call with requests. Note the rate-limit header — reading it is cheaper than handling a 429 after the fact.

import os, requests

r = requests.get(
    "https://api.encar-api.com/api/cars",
    headers={"x-api-key": os.environ["ENCAR_API_KEY"]},
    params={"manufacturer": "Kia", "fuel": "hybrid", "count": 50},
    timeout=20,
)
r.raise_for_status()
print(r.headers.get("X-RateLimit-Remaining"), r.json()["total"])
04

PHP

For a WordPress or Laravel back end, where most dealer sites already live.

$url = "https://api.encar-api.com/api/cars?" . http_build_query([
    "manufacturer" => "Genesis",
    "yearFrom"     => 2021,
    "count"        => 24,
]);

$ch = curl_init($url);
curl_setopt_array($ch, [
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_HTTPHEADER     => ["x-api-key: " . getenv("ENCAR_API_KEY")],
    CURLOPT_TIMEOUT        => 20,
]);
$data = json_decode(curl_exec($ch), true);
05

Paging and sorting

page is zero-based and count caps at 500. Read total from the response to know how many pages exist — count is only how many listings came back in this one. Asking for a page past the end returns an empty results array rather than an error, so a loop that trusts the data terminates on its own.

sort takes priceAsc or priceDesc. Left out, listings come back newest first, which is what you want for a stock page and not what you want for a price comparison.

parameterwhat it accepts
manufacturerBrand, as Encar writes it: BMW, Hyundai, Kia, Genesis, Mercedes-Benz, Audi.
modelModel name, e.g. X5 (G05). Partial names match, and a generation name narrows further: model=The New Carnival returns that generation alone, not the whole nameplate.
qFree-text search across brand, model and badge. Aliases: keyword, search.
fueldiesel · gasoline · hybrid · electric · lpg.
transmissionautomatic · manual.
colorExterior colour.
seatsSeat count: 5, 7, 9. Several at once as seats=7,9. The two ends are ranges, not counts — 2 means two seats or fewer and 10 means ten or more, which is how the source files them. A car's own figure comes back as details.seats from /car.
yearFrom / yearToModel year bounds, as plain years: 2018, 2024.
mileageFrom / mileageToOdometer bounds in kilometres.
priceFrom / priceToPrice bounds in EUR — converted for you, not won.
sortpriceAsc or priceDesc. Left out, results come back newest first.
pagePage index, zero-based. Default 0.
countListings per page. Default 24, maximum 500.
FAQ

Questions people ask about this

Where do I put the API key?

In the x-api-key request header. Not in the query string: URLs end up in logs, browser history and shared links, and a key in a URL is a key somebody else can spend.

How many listings can one request return?

Up to 500, set with count. The default is 24, and page is zero-based. In the response, total is the number of listings matching your filters and count is how many came back in that page — paginate off total.

Every question, answered →
06 / Get access

Get your API key

FREEFree forever

Free tier, 100 requests a day. Enter your email and the key arrives immediately, with everything you need to make the first call.

  • 100 requests a day
  • No credit card
  • Your key never expires

One key per address — asking twice sends you the same one, not a second key.

Questions, or Pro and Enterprise volume? Reply straight to the key email — it reaches a person, not a form. Or message us on WhatsApp if that is quicker: +383 49 644 168

Run one of these for real

A free key is issued instantly. Paste it into any snippet above and you have live data.

Get a free key →