Get an access token (integration with scope)

POST https://auth.commercelayer.io/oauth/token

Authentication with scope

To use the Metrics API you need to authenticate to Commerce Layer Core API in the first place. The Metrics API results will be automatically filtered according to the scope included in the token you get.

Use this call if you want to get an integration token restricted to specific markets and/or stock locations of your organization.

Remember to properly set (manually or as your environment variables):

VariableDescription
{{client_id}}The client ID from your integration API credentials.
{{client_secret}}The client secret from your integration API credentials.
{{scope}}The scope you want your call to be restricted to (e.g. market:id:xYZkjABcde).

You can find, copy, and paste them from your Commerce Layer admin dashboard.

Request Body

{"grant_type"=>"client_credentials", "client_id"=>"{{client_id}}", "client_secret"=>"{{client_secret}}", "scope"=>"{{scope}}"}

HEADERS

KeyDatatypeRequiredDescription
Content-Typestring