Create Access and Refresh Tokens V2

Authentication Using Client Credentials

Compliancely now supports Client ID and Client Secret authentication as an alternative to account username and password for generating API access and refresh tokens.

We recommend using client credentials for API integrations, as they provide authentication independent of your Compliancely account login credentials. This helps prevent integration disruptions when account passwords or email addresses change.

Authenticates a user using a valid Client ID and Client Secret, and returns a pair of tokens: an access token and a refresh token.

Refer to the Authentication Guide for the recommended process.

This API allows you to create or retrieve an access token and refresh token using your Client ID and Client Secret. The access_token provided must be included in the Authorization header as a Bearer for all subsequent API requests, as shown below

--header 'Authorization: Bearer {{access_token}}'

Request & Response Format

curl --location '{{base_url}}/api/v2/token/' \
--header 'Content-Type: application/json' \
--data-raw '{
  "client_id": "<client_id>",
  "client_secret": "<client_secret>"
}'
curl --location '{{base_url}}/api/v2/token/' \
--header 'Content-Type: application/json' \
--data-raw '{
  "username": "<username>",
  "password": "<password>"
}'
{
    "access": "<access_token>",
    "access_expiry_seconds": <expires_in_seconds>,
    "refresh": "<refresh_token>",
    "refresh_expiry_seconds": <expires_in_seconds>
}

Both authentication methods use the same API endpoint.

Generate Client Credentials

To generate your credentials:

  1. Log in to the Compliancely portal.
  2. Navigate to the Developer section.
  3. Generate your Client ID and Client Secret.

Securely store the credentials and use them to authenticate through the existing Token API.

Compatibility with Existing Integrations

To simplify the transition to client credentials, Compliancely currently provides a temporary compatibility option for integrations using the existing username and password request fields.

You can supply your Client ID and Client Secret through these fields without modifying your existing request structure:

{
  "username": "<client_id>",
  "password": "<client_secret>"
}

This allows existing integrations to adopt client credentials with minimal development effort.

Important: This is a transitional compatibility option and may be discontinued in a future release. We recommend updating your integration to use the dedicated client_id and client_secret fields for long-term compatibility.

Security Note: Keep your Client Secret secure and do not expose it in frontend applications or client-side code.

Validity

The access_token is valid for 1 hour. After it expires, you can use the Access Token by Refresh Token endpoint to obtain a new access_token.
The refresh_token remains valid for 24 hours.

Recommendation: Use the refresh token after the access_token expires to enhance overall security.

Throttling

This API enforces throttling, allowing a maximum of 10 requests per minute (RPM). If you exceed this limit, the following error will be returned, and you will need to wait 10 minutes before retrying.

{  
    "detail": "Your request has been throttled due to exceeding the allowed rate limit. Please wait for 10 minutes before trying again. If this issue persists, consider adjusting the request frequency or contact support for further assistance."  
}
Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…
Body Params
string
length between 1 and 150

Account username. Required with password unless client_id/client_secret are sent.

string
length between 1 and 255

Account password. Required with username unless client_id/client_secret are sent.

string
length between 1 and 64

API client ID (UUID). Use with client_secret instead of username/password.

string
length between 1 and 255

API client secret, shown once when the client is created or its secret is regenerated.

Responses

Language
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json