
OLX
ShoppingThe OLX developer platform offers a powerful API for integrating OLX marketplace features into your own applications. With the OLX API, you can access a wide range of features and data, including user account information, ad posting and management, and much more. To get started, simply register for an API key and follow the integration documentation provided. Whether you're building a new application or enhancing an existing one, the OLX API is a valuable resource that can help you add powerful features and functionality to your platform. So why not explore the possibilities today and see how the OLX API can benefit your business?
π Documentation & Examples
Everything you need to integrate with OLX
π Quick Start Examples
// OLX API Example
const response = await fetch('https://developer.olx.pl/articles/getting-access-to-api', {
method: 'GET',
headers: {
'Content-Type': 'application/json'
}
});
const data = await response.json();
console.log(data);Accessing the OLX Public API Using JavaScript
The OLX public API allows developers to access a variety of data from OLX, including listings, users, and categories. In this blog post, we will learn how to access the OLX public API using JavaScript.
How to Get OLX API Access
OLX (the Polish marketplace at developer.olx.pl) uses OAuth 2.0 β you get a Client ID and Client Secret, not a plain API key, and your app must be approved before it works.
- Sign in to the Developer Portal at https://developer.olx.pl with your OLX account.
- Click Connect App and complete the application form.
- Wait for review β the app shows "Waiting for acceptance" until OLX approves it.
- On approval you receive an email with your Client ID and Client Secret.
- Exchange those credentials at OLX's OAuth token endpoint for an access token.
Send the access token as a Bearer credential on API requests (endpoint paths are listed in the portal documentation):
fetch('https://www.olx.pl/api/partner/categories', {
headers: { 'Authorization': `Bearer ${accessToken}` }
})
.then(res => res.json())
.then(categories => console.log(categories));
Access tokens are moving to JWT format (up to ~1024 characters), so store them as variable-length strings. This program is specific to OLX Poland; other OLX Group country sites run separate developer programs.
Connecting to the API
To connect to the OLX public API using JavaScript, we need to make an HTTP request to the API endpoint. We can use the fetch() function to make the request.
Here is an example code that shows how to connect to the categories API endpoint:
const API_KEY = "YOUR_API_KEY";
const API_BASE_URL = "https://api.olx.pl/v1";
fetch(API_BASE_URL + "/categories", {
headers: {
Authorization: `Bearer ${API_KEY}`
}
})
.then(response => response.json())
.then(categories => console.log(categories));
In this example code, we set the API_KEY variable to our OLX API key, and API_BASE_URL variable to the base URL of the OLX API.
We then use the fetch() function to send an HTTP GET request to the /categories endpoint of the OLX API. We also pass our API key as an Authorization header in the request.
When we receive a response from the API, we convert it to JSON format using the json() method, and then log the categories to the console.
Accessing Listings
Once we have connected to the OLX API, we can start accessing its data. Let's take a look at an example code that shows how to access listings from the API:
const API_KEY = "YOUR_API_KEY";
const API_BASE_URL = "https://api.olx.pl/v1";
fetch(API_BASE_URL + "/offers", {
headers: {
Authorization: `Bearer ${API_KEY}`
}
})
.then(response => response.json())
.then(listings => console.log(listings));
In this example code, we send an HTTP GET request to the /offers endpoint of the OLX API, and then log the listings to the console.
Conclusion
In this blog post, we have learned how to access the OLX public API using JavaScript. We learned how to connect to the API, and how to access listings data. You can use these examples as a starting point to build your own OLX API-powered application.









