Request access token
5 min
Code Section Title
# Use the Optimizely CMS API OAuth endpoint.
curl --request POST \
--url https://api.cms.optimizely.com/oauth/token \
--header 'accept: application/json' \
--header 'content-type: application/json' \
--data '
{
"client_id": "CLIENT_NAME",
"client_secret": "CLIENT_SECRET",
"grant_type": "client_credentials"
}'You can obtain an access token by sending a POST request to the OAuth endpoint.
You use this token in the header of your subsequent API calls. The token is valid for 300 seconds (five minutes).
API endpoint
The OAuth token endpoint is available at https://api.cms.optimizely.com/oauth/token.
This corresponds to the following section in the code:
--url https://api.cms.optimizely.com/oauth/token \Replace CLIENT_NAME
Replace CLIENT_ID with your API client Name. See Create API client.
This corresponds to the following section in the code:
"client_id": "CLIENT_NAME",Replace CLIENT_SECRET
Replace CLIENT_SECRET with your client secret. See Create API client.
This corresponds to the following section in the code:
"client_secret": "CLIENT_SECRET",Set grant type
Set the grant type to client_credentials to get your token.
This corresponds to the following section in the code:
"grant_type": "client_credentials"