API personal access token

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

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. (opens full-size image in a new tab)

  2. In the dialog, select the number of days for token expiration and select Create.

    Screenshot of the Create API Authentication Token form. (opens full-size image in a new tab)

  3. 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. (opens full-size image in a new tab)

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
  2. Add: CB_API_AUTH_TOKEN_EXPIRE_DAYS_CHOICES = [ (2, "2 days"), (7, "7 days") ]
  3. 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:

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)