Website

How to obtain Access Token

Last update: 29.01.2024

In order to receive token, client should send POST request to /api/open/oauth/token. Required fields:

		{
   "grant_type" : "",
   "client_id" : "",
   "client_secret" : "",
   "scope" : "v2 read write"
}			
		
Copied to clipboard

client_id and client_secret are data you have received from OLX business person. scope is requested token scope, but limited by partner settings - basically “v2”, “read” and “write”.

Depends on grant type, request should contain other necessary fields.

As response client will receive:

		{
   "access_token" : "454c3cd39a980500e9b787e03d53ec5c320f644b",
   "expires_in" : "86400",
   "token_type" : "bearer",
   "scope" : "v2 read write",
   "refresh_token" : "12a13560163da7901d7f74c89fc5df3ea7625942"
}			
		
Copied to clipboard

Access token should be passed with each request to API as header Authorization.

Authorization: Bearer 454c3cd39a980500e9b787e03d53ec5c320f644b

Field expires_in defines how many more seconds since now (now = last request to oauth/token endpoint) access token will be valid.

Refresh token is valid for one month (2592000 seconds). Also, it can be changed when new access token is generated.

Please store access token and refresh token in a safe place.