Authorization

How to authenticate to the Provisioning API

All API requests must be authenticated. To get authorized, you must include a valid access token in the Authorization header:

Authorization: Bearer {{your_access_token}}

Getting the API credentials

First, you need to get your Provisioning API credentials. To do that, head over to the Dashboard, click on your user avatar in the upper right of the page to access your profile menu, and select Provisioning API from the dropdown:

On the next page you can find and copy to clipboard your Provisioning API credentials (client ID and client secret):

Getting an access token

To get a valid access token you need to send a POST request to the following endpoint, providing the arguments listed in the table below:

https://auth.commercelayer.io/oauth/token
Body parameterTypeRequiredDescription

grant_type

String

Required

client_credentials

client_id

String

Required

Your client_id.

client_secret

String

Required

Your client_secret.

Example

The following request tries to get an access token for the Provisioning API:

curl -g -X POST \
  'https://auth.commercelayer.io/oauth/token' \
  -H 'Content-Type: application/vnd.api+json' \
  -d '{
    "grant_type": "client_credentials",
    "client_id": "{{your_client_id}}",
    "client_secret": "{{your_client_secret}}"
}'

Where {{your_client_id}} and {{your_client_secret}} are the credentials you just got from the Dashboard. You can now use the access_token you get in the response to perform authenticated requests to the Provisioning API (until it expires).

Once you got your credentials, you can also leverage our JS Auth library to get an access token for the Provisioning API.

Last updated