Authorization API

To access our services you need to authorize by providing an API key in your requests. This page will show you how to retrieve and refresh your API key.

Obtaining the API key

Prerequisites

Before obtaining your API key please make sure that you have your client_id and client_secret.

Retrieving

You can get the apiKey simply by sending a POST request to our authentication service endpoint /oauth2/token.
Example:

POST https://auth.sygic.com/oauth2/token
{
  "client_id": "my.client.id",
  "client_secret": "0388d520a01b723c5a459e3fa00d4a4a",
  "grant_type": "client_credentials"
}

The response will be:

{
  "access_token": "20a01b723c0388d55a459e3fa00d4a4a40ad6e5726034ff2f2ffdbd3155cd7df",
  "token_type": "bearer",
  "expires_in": 604800,
  "refresh_token": "07b87e8c4e3b2357ac9341fde04edc1dde4e0fe7159f55226c6e9cbbc2c779cd"
}

Refreshing the token

In the response below you can see fields expires_in and refresh_token. Those variables are used to refresh your API key. expires_in represents the count of seconds that your API key is valid for. If you do not want to use your API key any longer, you should refresh it by sending a POST request to same endpoint but in this case you need to set the grant_type property to refresh_token

POST https://auth.sygic.com/oauth2/token
{
  "client_id": "my.client.id",
  "client_secret": "0388d520a01b723c5a459e3fa00d4a4a",
  "refresh_token": "fd8e3b00d75edb3e53e36faa00ab18b71426dc8f4fb8c0223b4ddea7e398f618",
  "grant_type": "refresh_token"
}

The response will be:

{
  "access_token": "20a01b723c0388d55a459e3fa00d4a4a40ad6e5726034ff2f2ffdbd3155cd7df",
  "token_type": "bearer",
  "expires_in": 604800,
  "refresh_token": "07b87e8c4e3b2357ac9341fde04edc1dde4e0fe7159f55226c6e9cbbc2c779cd"
}