Get API Tokens
This API allows you to retrieve a list of API tokens for your sub-client accounts with pagination support.
Headers
| Parameter | Description |
|---|---|
| Authorization | Please add provided Bearer token - linked to your Cellcast account. Check here |
Query Parameters
| Name | Type | Example | Description |
|---|---|---|---|
| subAccountId | String | 6877a383d68781beb3b14110 | Optional. Filter tokens by specific sub-account ID. |
| status | String | active | Optional. Filter by token status: active or inactive. |
| search | String | Production | Optional. Search tokens by name. |
| page | Number | 1 | Optional. Page number for pagination (default: 1). |
| limit | Number | 10 | Optional. Number of items per page (default: 10). |
Code Sample
GET https://api.cellcast.com/api/v1/apiClient/token
bash
curl --location 'https://api.cellcast.com/api/v1/apiClient/token?page=1&limit=10' \
--header 'authorization: Bearer {{API_KEY}}'bash
curl --location 'https://api.cellcast.com/api/v1/apiClient/token?subAccountId=6877a383d68781beb3b14110&page=1&limit=10' \
--header 'authorization: Bearer {{API_KEY}}'javascript
const params = new URLSearchParams({
page: 1,
limit: 10,
subAccountId: "6877a383d68781beb3b14110" // Optional
});
const response = await fetch(
`https://api.cellcast.com/api/v1/apiClient/token?${params}`,
{
method: "GET",
headers: {
Authorization: "Bearer {{API_KEY}}"
}
}
);
const data = await response.json();
console.log(data);php
<?php
$curl = curl_init();
$params = http_build_query([
'page' => 1,
'limit' => 10,
'subAccountId' => '6877a383d68781beb3b14110' // Optional
]);
curl_setopt_array($curl, [
CURLOPT_URL => 'https://api.cellcast.com/api/v1/apiClient/token?' . $params,
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'Authorization: Bearer {{API_KEY}}'
]
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
?>python
import requests
url = "https://api.cellcast.com/api/v1/apiClient/token"
headers = {
"Authorization": "Bearer {{API_KEY}}"
}
params = {
"page": 1,
"limit": 10,
"subAccountId": "6877a383d68781beb3b14110" # Optional
}
response = requests.get(url, headers=headers, params=params)
print(response.json())Replace with the actual API key that you own.
Responses
200 Success
json
{
"app_type": "web",
"app_version": "1.0",
"maintainence": 0,
"new_version": 0,
"force_update": 0,
"invalid_token": 0,
"refresh_token": "",
"show_message": 0,
"is_enc": false,
"status": true,
"message": "Found 2 API token(s)",
"message_type": "toast",
"data": {
"items": [
{
"_id": "6877b1234567890abcdef123",
"name": "Production API",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"status": "active",
"createdAt": "2024-01-15T10:30:00.000Z",
"subAccount": {
"_id": "6877a383d68781beb3b14110",
"name": "Sub Client Name",
"email": "[email protected]",
"companyName": "Sub Client Company"
}
},
{
"_id": "6877b1234567890abcdef456",
"name": "Development API",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9...",
"status": "active",
"createdAt": "2024-01-14T08:00:00.000Z",
"subAccount": {
"_id": "6877a383d68781beb3b14110",
"name": "Sub Client Name",
"email": "[email protected]",
"companyName": "Sub Client Company"
}
}
],
"total": 2,
"page": 1,
"limit": 10,
"totalPages": 1,
"hasNextPage": false,
"hasPrevPage": false
},
"error": {}
}403 Forbidden - Invalid Sub Account
json
{
"status": false,
"message": "Forbidden",
"message_type": "toast",
"data": {},
"error": {
"message": "Sub account does not belong to you or does not exist"
}
}401 Unauthorized
json
{
"code": 401,
"message": "Token expired",
"stack": "APIError: Token expired..."
}Get Single Token by ID
You can also retrieve a specific token by its ID.
GET https://api.cellcast.com/api/v1/apiClient/token/:id
bash
curl --location 'https://api.cellcast.com/api/v1/apiClient/token/6877b1234567890abcdef123' \
--header 'authorization: Bearer {{API_KEY}}'Get Tokens by Sub-Account ID
You can also retrieve all tokens for a specific sub-account.
GET https://api.cellcast.com/api/v1/apiClient/token/sub-account/:subAccountId
bash
curl --location 'https://api.cellcast.com/api/v1/apiClient/token/sub-account/6877a383d68781beb3b14110?page=1&limit=10' \
--header 'authorization: Bearer {{API_KEY}}'See Also
- Create API Token - Create a new API token
- Update API Token - Update an existing API token
- Delete API Token - Delete an API token
