Skip to main content

Token Generation

Generate authentication tokens for Contact Center API access. This API creates a session token using basic authentication credentials.

HTTP Request​

POST /v2/accounts/<account_sid>/configuration/basicauth

Base URL​

Data CenterBase URL
Singaporehttps://ccm-api.exotel.com
Mumbaihttps://ccm-api.in.exotel.com

Request Headers​

HeaderValue
Content-Typeapplication/json
AuthorizationBasic <base64(api_key:api_token)>

Example Request​

curl -X POST \
'https://ccm-api.exotel.com/v2/accounts/<account_sid>/configuration/basicauth' \
-H 'Content-Type: application/json' \
-H 'Authorization: Basic <base64_encoded_credentials>'

Response​

{
"request_id": "abc123-def456",
"method": "POST",
"http_code": 200,
"response": {
"code": 200,
"status": "success",
"data": {
"access_token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"token_type": "Bearer",
"expires_in": 86400
}
}
}

Response Fields​

FieldDescription
access_tokenJWT token to use in subsequent API calls
token_typeToken type — always Bearer
expires_inToken validity in seconds (default: 86400 = 24 hours)

Using the Token​

After generating a token, include it in subsequent API requests:

curl -X GET \
'https://ccm-api.exotel.com/v2/accounts/<account_sid>/calls' \
-H 'Authorization: Bearer <access_token>'

HTTP Status Codes​

CodeDescription
200Success — Token generated
401Unauthorized — Invalid API key or token
403Forbidden — Account not authorized for CCM
429Rate Limited
500Internal Server Error

Try It​