OAuth 2.0
Create an OAuth 2.0 Client
From the ClearPort Dashboard, navigate to Automation > API Keys
Click OAuth 2.0 (Preview)
Click + New Credentials to create a new OAuth 2.0 client application
Enter a name for the application and click Submit. The name is only for your reference
Make a note of the Client Id and Client Secret (NB the Client Secret will not be displayed again) and store in a secure manner
How to access the API using OAuth 2.0
Step 1 - Generate an Access Token
Submit an HTTP POST request with the following properties:
URL: https://auth.clear-port.com/oauth/token
Headers: content-type: application/json
Payload:
{
"grant_type": "client_credentials",
"client_id": "D8ZxR1bvHL6e4Qgz28tcq4xVCBrrvFKc",
"client_secret": "************DTE2",
"audience": "https://api.clearport.com"
}You will receive a JSON response like:
{
"access_token": "eyJ...",
"expires_in": 14400,
"token_type": "Bearer"
}Copy the value of access_token
Step 2 - Call the API using the Access Token
For every API request, add this header:
Authorization: Bearer <ACCESS_TOKEN>Step 3 - When to request a new token
Tokens expire after 4 hours. Generate a new token (Step 1) and try again.