Skip to main content

Creating API credentials

With the API credentials that you create, you can authenticate to the API endpoint and use the CloudConnexa API.

  1. From the CloudConnexa Administration portal, navigate to API & Logs > API .

  2. Click Create Credentials.

  3. Specify a name for your credentials.

  4. Accept the default one-month lifetime value or specify a different one. API credentials expire in two weeks, one month, six months, or one year.

  5. Optionally, whitelist the IP subnet range from which API calls will originate.

  6. Click Create.

    Important

    Copy the credential key and paste it into a secure file. Also, copy the credential secret and paste it into a secure file.

  7. Click the API link to return to the API main menu.

  8. To enable the CloudConnexa API, click the toggle button.

Obtaining an Access Token

After generating API credentials from the CloudConnexa Admin Portal, you can request an OAuth 2.0 access token using the client_credentials grant type. This token is required to authenticate requests to the CloudConnexa Public API.

Note

Access Token can also be obtained using API endpoint. See Request OAuth token

Request Format

Use the following curl command to obtain an access token:

curl -X POST --location "https://{cloud_id}.api.openvpn.com/api/v1/oauth/token?client_id={client_id}&client_secret={client_secret}&grant_type=client_credentials" --http1.1

Replace:

  • {cloud_id} with your actual Cloud ID

  • {client_id} with the full Public API Client ID, including the prefix

  • {client_secret} with the Public API Client Secret

Example Response

If the request is successful, the API will respond with a JSON object containing your access_token:

{
  "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOi...",
  "token_type": "bearer",
  "expires_in": 43199,
  "scope": "read write"
}

You can now use this token in subsequent API requests by including it in the Authorization header:

Authorization: Bearer <access_token>

Notes

  • The access_token is valid for the number of seconds specified in expires_in.

  • Make sure the Enable API for this Cloud ID toggle is turned ON on the API page in the CloudConnexa Admin Portal.