Access_token refresh

Access_token refresh

In case access_token expires, you can update it using refresh_token. Make POST request to URL https://api.admitad.com/token/ using data format application/x-www-form-urlencoded and transfer the following parameters:

Name

Required

Description

client_id

ID of your application.*

client_secret

Secret key of your application

grant_type
Type of request
  • refresh_token
refresh_token

The value obtained after authorization.

  • * ID and the secret key of the application are available for the logged in publisher at the homepage for developers (when the “Get keys” button is clicked).

Below is an example of a request using a curl utility for client_id=cb281d918a37e346b45e9aea1c6eb7, client_secret=a0f8a8b24de8b8182a0ddd2e89f5b1 and refresh_token=7521b7640c:

curl -X POST https://api.admitad.com/token/ -d 'grant_type=refresh_token&client_id=cb281d918a37e346b45e9aea1c6eb7&refresh_token=7521b7640c&client_secret=a0f8a8b24de8b8182a0ddd2e89f5b1'

Example of request:

POST /token/ HTTP/1.1
Host: api.admitad.com
Content-Type: application/x-www-form-urlencoded;charset=UTF-8

grant_type=refresh_token&client_id=cb281d918a37e346b45e9aea1c6eb7&refresh_token=7521b7640c&client_secret=a0f8a8b24de8b8182a0ddd2e89f5b1

As a result of this request you will get a new access_token. The time to live of the token in seconds expires_in, refresh_token and additional information for users are returned as well:

{
    "username": "webmaster1",
    "first_name": "name",
    "last_name"': "surname",
    "language": "ru",
    "access_token": "4b8b33955a",
    "token_type": "bearer",
    "expires_in": 604800,
    "refresh_token": "ea957cce42",
    "scope": "advcampaigns banners websites"
}