# 3. Generate an access token

Use the client credentials generated in [step 2](/integration/api/api-client-creds) to generate an access token. This token must be used in all API requests made to the Spotnana platform.

Generate an access token using the endpoint below:

`POST /v2/auth/oauth2-token`

**Request:**

```bash
curl --location 'https://api-ext-sboxmeta.partners.spotnana.com/v2/auth/oauth2-token' \
  --header 'Content-Type: application/x-www-form-urlencoded' \
  --data-urlencode 'client_id=<your-client-id>' \
  --data-urlencode 'client_secret=<your-client-secret>' \
  --data-urlencode 'grant_type=client_credentials'
```

**Response:**

```json
{
  "access_token": "<access_token>",
  "expires_in": 3600,
  "token_type": "Bearer"
}
```

The bearer token generated using this API must be used in the authorization header for all API calls made to the Spotnana platform.

## Best practices

- Build a mechanism to securely cache the access token in your system and reuse it until it expires.
- Do not request new tokens for each API call as the token generation API is rate limited. Generate a new token only when the current token has expired or is about to be expired.
- Use [exponential backoff](https://en.wikipedia.org/wiki/Exponential_backoff) to retry when a [429 error](/spotnana/error_handling#429---rate-limit-exceeded) is encountered (i.e., rate limit exceeded).


#### Upon completion of this step, you'll have:

- The access token needed to make API calls to the Spotnana platform.