Authenticate to the Atlas API
Atlas authenticates API requests using the OAuth 2.0 Client Credentials flow. It is intended for server-to-server integrations that do not require an individual user to sign in. No other authentication flow is supported.
This guide walks through the Client Credentials flow using cURL. The workflow ends by using an access token to make a GET request to retrieve Atlas account settings.
Before you begin
You need:
- Access to the Atlas portal and the account you want to access through the API.
- Permission to create an API client at the account level.
- cURL to send the API requests.
- A unique Client ID for the API client you create.
The Atlas API base URL used in this guide is:
https://api.atlasapi.net/v3
The examples use placeholders for values specific to your API client and application.
| Placeholder | Replace with |
|---|---|
<CLIENT_ID> | The Client ID you assign when creating the API client. |
<CLIENT_SECRET> | The secret generated for the API client. |
<ACCESS_TOKEN> | The access token returned by Atlas. |
Replace the angle brackets and the text inside them. Do not send the placeholders as literal values.
A few API basics
An API request is a message your application sends to Atlas. The URL identifies the resource you want to access. The method describes the action; this guide uses GET to retrieve data and POST when requesting tokens. A header carries information with a request, such as an access token. The response is the status and any data Atlas sends back.
How authentication works
Atlas uses OAuth 2.0. Your application first exchanges its Client ID and Client Secret for an access token using the Client Credentials flow. Authenticated API requests then send that token using the Bearer authentication scheme:
Authorization: Bearer <ACCESS_TOKEN>
Client Credentials clients are created under API Server Access in the Atlas portal.
Treat client secrets and access tokens as sensitive credentials. Store them securely and do not include them in public code, documentation, or screenshots.
Method 1: Client Credentials
Client Credentials is intended for server-to-server integrations that do not require an individual user to sign in.
1. Create an API Server Access client
- Sign in to the Atlas portal and navigate to the account level.
- From the right-hand menu, select API Server Access.
- Click ADD CLIENT.
- Enter a unique Client ID.
- Select the VOIP checkbox.
- Click SAVE.
- In the list of API clients, click the View Secret icon for the client.
Securely record the Client ID and Client Secret. You will use both values to request an access token.
2. Request an access token
Send a POST request to the /token endpoint.
Run:
curl -X POST \
"https://api.atlasapi.net/v3/token" \
-H "content-type: application/x-www-form-urlencoded" \
-d "grant_type=client_credentials&client_id=<CLIENT_ID>&client_secret=<CLIENT_SECRET>&scope=voip"
A successful request returns an HTTP 200 response containing the generated token. The access_token value inside data is the token you will use to authenticate API requests.
For example:
{
"status_code": 200,
"data": {
"access_token": "<ACCESS_TOKEN>",
"expires_in": 7200,
"scope": "voip",
"token_type": "Bearer"
},
"request_id": "<REQUEST_ID>"
}
| Field | Description |
|---|---|
status_code | The HTTP status code of the response. 200 indicates success. |
data.access_token | The access token to send in the Authorization header. |
data.expires_in | The number of seconds until the access token expires. |
data.scope | The scope granted to the token. For this flow, the value is voip. |
data.token_type | The token type. The value is Bearer, matching the Authorization header scheme. |
request_id | A unique identifier for the request. |
Securely record the value returned in data.access_token.
Client Credentials access tokens are valid for 7,200 seconds (2 hours). After the token expires, repeat this step to obtain a new token.
3. Make a successful GET request
Use the /account/setting endpoint to retrieve the settings for the account.
Run:
curl \
-H "Accept: application/json" \
-H "Authorization: Bearer <ACCESS_TOKEN>" \
"https://api.atlasapi.net/v3/account/setting"
Replace <ACCESS_TOKEN> with the data.access_token value returned by the token request.
A successful response containing the account settings confirms that your application has authenticated to the Atlas API.
If the request does not succeed, verify the Client ID and Client Secret, confirm that the token has not expired, and make sure the Bearer token was copied correctly. Once the /accountsettings GET request succeeds, you have completed the Client Credentials workflow.