# API personal access token

> Generate a personal access token to authenticate with the Cloud Management Platform (CMP) API

---

Site [llms.txt](/llms.txt)

---

This is useful when you implement SSO and your users cannot authenticate with a username and password.

## Create a personal API access token

1. On your user profile page, select **Create API Token**.

   ![Screenshot of a user profile page.](/img/cmp/configure/access-and-security/security/api-personal-access-token/user-profile.png)
1. In the dialog, select the number of days for token expiration and select **Create**.

   ![Screenshot of the Create API Authentication Token form.](/img/cmp/configure/access-and-security/security/api-personal-access-token/create-api-auth-token.png)
1. The API access token is created. Use the icons to the right of the masked token to copy, regenerate, or delete it.

   ![Screenshot of a user profile after creating an API authentication token.](/img/cmp/configure/access-and-security/security/api-personal-access-token/api-auth-token.png)

<div class="alert alert-info" role="alert">


To customize the expiration options for token authentication, override the default by defining `CB_API_AUTH_TOKEN_EXPIRE_DAYS_CHOICES` in `customer_settings.py`.
</div>


For example, to offer two options of 2 days and 7 days:

1. Open the settings file for editing: `vi /var/opt/cloudbolt/proserv/customer_settings.py`
1. Add: `CB_API_AUTH_TOKEN_EXPIRE_DAYS_CHOICES = [ (2, "2 days"), (7, "7 days") ]`
1. Save the file, then restart the Apache server to apply the change: `systemctl restart httpd`

The available token expiration options are now limited to 2 and 7 days.

## Use a personal API token for API authentication

To use a personal API access token, include the Authorization header and the Token key with your request.

Python example:

```python
import requests

url = "http://{yourcbhost}/api/v3/cmp/orders/"

payload = {}
headers = {
    "Authorization": "Token <your-api-token>"
}

response = requests.request("GET", url, headers=headers)

print(response.status_code)
```
