---
title: Request access token
slug: cms-saas/api/request-access-token
createdAt: 2026-09-02T21:35:04.127Z
---

::::CodeDrawer{title="Code Section Title" isResponseExpanded="true" autoGeneratedAnchorSlug="code-section-title" legacyHash="RycQvveHoTdiRqzzqphpV"}
:::CodeblockTabsExamples
```shell
    # 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"
         }'
    
```
:::

:::CodeblockTabsResponses
```javascript
    {"access_token":"REDACTED","expires_in":300,"token_type":"Bearer"}
    
```
:::
::::

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:

```shell
 --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:

```shell
"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:

```shell
"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:

```shell
"grant_type": "client_credentials"
```
