Creating API credentials
With the API credentials that you create, you can authenticate to the API endpoint and use the CloudConnexa API.
From the CloudConnexa Administration portal, navigate to API & Logs > API .
Click Create Credentials.
Specify a name for your credentials.
Accept the default six-month lifetime value or specify a different one. API credentials expire in two weeks, one month, six months, or one year.
Optionally, configure the list of Allowed IP subnet ranges from which API calls will originate.
In the Permissions section, select the resources that can be read or modified by the API key.
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.
Return to the API main menu, click the toggle button labeled: Enable API to activate authentication credentials.
Caution
Remember to enable API access. A valid API key will not work unless the API access is enabled.
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.1Replace:
{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_tokenis valid for the number of seconds specified inexpires_in.Make sure the Enable API for this Cloud ID toggle is turned ON on the API page in the CloudConnexa Admin Portal.