Request an access token
POST https://auth.sitecorecloud.io/oauth/token
Make a POST request to request an access token. Replace the placeholder values with your API key and API secret.
In the response, the access_token
key contains the access token.
RequestResponse
curl -X POST 'https://auth.sitecorecloud.io/oauth/token' \
--header 'Content-Type: application/x-www-form-urlencoded' \
--data-urlencode 'client_id=<APIKey>' \
--data-urlencode 'client_secret=<APISecret>' \
--data-urlencode 'grant_type=client_credentials' \
--data-urlencode 'audience=https://api.sitecorecloud.io'
RequestResponse
{
"access_token": "<accessToken>",
"scope": "cdp.audience_exports:r",
"expires_in": 86400,
"token_type": "Bearer"
}
Important
Access tokens expire in 24 hours. If your requests unexpectedly return a response with status 401 Unauthorized
, request a new access token by repeating this POST request.
We recommend that you cache the access token for 24 hours to avoid repeating this POST request while the access token is still valid.
You can now start making REST API requests. You must include the access token in the request header of every REST API request. For example:
RequestResponse
curl -X GET '<baseURL>/v2/...' \
-H 'Authorization: Bearer <accessToken>' \
-H 'Accept: application/json'