About ZIP API

The ZIP API is a RESTful API, that uses a HTTPs protocol for communication. HTTP GET, POST, PUT and DELETE methods are used to access the API.
View PHP SDK code samples

How to start

To begin using ZIP API, follow these steps:
• Go to API page (My classifieds → API);
• Click the "Add API Access" button;
• The newly generated API key will be shown in the list.

API key

The API key is a secret key unique to each store that is used to access the API.

Keep the API key in secret, and never expose it in any public website's client-side code.

Authentication

ZIP uses HTTP basic authentication for the API requests.

To perform authorization, you need to add the Authorization header with a Base64 encoded API key when performing a request. So if the API key is b7221dc4-b014-4a:69-a17d-73cbea837214, then you need to add this header to the API request::

Authorization: Basic YjcyMjFkYzQtYjAxNC00YTo2OS1hMTdkLTczY2JlYTgzNzIxNA==

Request endpoint

All API requests have to be sent to this URL::

https://zip.lv/api/v1/

Connecting by HTTP is available as well, but for security reasons, use of HTTPS is highly recommended.

Request parameters

Parameters can be passed as GET variables::

GET /ads?offset=10&limit=5

For POST and PUT requests, a more complex data structure can be passed as JSON encoded data in the request body:

POST /import

{"recipient":{...},"items":[...]}

Response body

The response body is always a JSON object that contains a response status code (identical to the HTTP status code) and the result of the action. If the status code is 200, then the action was successful.
{
   "code": 200, // Response status code 
   "result":{
	  //  
	  // ...
   }
}

Error response

If the API call is not successful, then the response code is not in the 2xx range and the result attribute contains an error description.

{
   "code": 404, // Response status code 
   "result":"Ad not found" // Error text 
}