How to get your token

The credentials (client_id and client_secret) are a set of access keys provided on the platform and need to be used to get a token.
(Those credentials are strictly confidential and must remain secret).

To get your credentials, first, connect on SupplierXM, go to your profile, and create new access keys.

❗️

Don't forget to copy your client secret before closing the modal, you won't be able to get it later

Then perform an http query to get an access token specifying

  • your credentials
  • grant type ("client_credentials")
import json
import requests

# Data for authentication, update it with your own credential
authentication_payload = {
    "client_id": "{your client id}",  # replace with your client id
    "client_secret": "{your client secret}",  # replace with your client secret
    "grant_type": "client_credentials",
}

# Call the authentication API
response = requests.post(
    "https://apis.supplierxm.salsify.com/auth/v2/token",
    data=json.dumps(authentication_payload)
).json()

# Response contains:
# {"access_token": "{your access token}", "type": "JWT"}

access_token = response['access_token']

# We will use this access_token to access SupplierXM APIS
headers = {
    'Authorization': 'Bearer %s' % access_token
}
curl 'https://apis.alkemics.com/auth/v1/token' -XPOST \
-d'{"client_id": "{your client id}", "client_secret": "{your client secret}", "grant_type": "client_credentials"}'

>>> {"access_token": "{your access token}", "type": "JWT"}