Getting started
The AvtoPodatki API is at https://api.avtopodatki.si. Every call needs your
company’s API key, and returns JSON.
| Prefix | What it is |
|---|---|
/v1/market |
Used cars: listings, sellers and price statistics |
/v1/catalog |
New vehicles: list prices and specifications |
/v1/integrations |
Integrations prepared for your company, such as your stock on your website |
/v1/auth |
Your key’s permissions and limits (/me) |
Make your first call
Section titled “Make your first call”-
Create an API key on the API keys page of the AvtoPodatki app. Your company’s owners and developers can create keys. Give the key only the permissions it needs, and limit it to your server’s IP addresses if you can. The key is shown once: store it safely.
-
Send it on every request as a bearer token:
Authorization: Bearer ap_… -
Ask who you are.
GET /v1/auth/melists the key’s permissions, your company’s monthly limits and this month’s use.Terminal window curl https://api.avtopodatki.si/v1/auth/me \-H "Authorization: Bearer $AVTOPODATKI_KEY"$ch = curl_init('https://api.avtopodatki.si/v1/auth/me');curl_setopt_array($ch, [CURLOPT_RETURNTRANSFER => true,CURLOPT_HTTPHEADER => ['Authorization: Bearer ' . getenv('AVTOPODATKI_KEY')],]);$me = json_decode(curl_exec($ch), true);const res = await fetch('https://api.avtopodatki.si/v1/auth/me', {headers: { Authorization: `Bearer ${process.env.AVTOPODATKI_KEY}` },});const me = await res.json();
If the API keys page says API access is not included, your company’s plan does not include it yet: write to info@avtopodatki.si.
Permissions
Section titled “Permissions”Your company is granted permissions, such as market.read or
catalog.export, and each key holds some of them. Every endpoint in the
API reference says which permission it needs. Calling one the key
doesn’t have answers 403 with the missing permission in
detail.required_permission.
The reference on this site shows the public APIs. To see every endpoint your key can call, sign in with your key.
Limits
Section titled “Limits”- Rate limit: each key may make a limited number of calls a minute
(120 today). Over it, calls answer
429rate_limitedwith aRetry-Afterheader: wait that many seconds. - Credits: calls to endpoints that need a permission spend credits from
your company’s monthly allowance. Exports also count towards a monthly
number of exports, and cost nothing if they fail. A response that spent
credits carries
X-Credits-Limit,X-Credits-RemainingandX-Credits-Reset. When a monthly limit is used up, calls answer429quota_exceeded, withdetail.meternaming the limit (credits,exports), until the 1st of next month (UTC).
A refused call costs nothing.
Errors
Section titled “Errors”Every error has the same shape:
{ "error": { "code": "forbidden", "message": "Readable text you can show.", "detail": { "required_permission": "market.read" } }}code is stable and meant for your code; message is for people.
| Status | code |
What happened |
|---|---|---|
401 |
unauthorized |
No key, or not a valid one (revoked, expired) |
403 |
forbidden |
The key lacks the permission in detail.required_permission |
403 |
ip_not_allowed |
The call came from an address the key does not allow |
403 |
api_not_included |
Your company’s plan does not include API access |
403 |
access_expired |
Your company’s access has ended |
404 |
not_found |
Nothing at that id, or not yours to see |
409 |
conflict |
The request conflicts with the current state |
422 |
validation_error |
A parameter is missing or not valid; detail says which |
429 |
rate_limited |
Too many calls; wait Retry-After seconds |
429 |
quota_exceeded |
A monthly limit is used up |
503 |
upstream_unavailable |
A service behind the API is unavailable; try again later |