Add Numbers
POST /api/cc/campaigns/:id/contacts
Add up to 1,000 numbers per request to a draft, paused or running campaign. Numbers the campaign already has are skipped, so sending a batch again is safe. A running campaign starts calling new numbers within seconds.
Requires a Bearer API token (from Authentication / dashboard API Tokens) and the call-center permission.
Rate limit: 60 requests per minute per account, shared by all Campaign API endpoints.
Request Body
Section titled “Request Body”| Field | Type | Required | Description |
|---|---|---|---|
| phone_numbers | string[] | Yes | 1–1,000 numbers. Invalid and repeated numbers are skipped and counted. |
Request Example
Section titled “Request Example”curl -X POST https://api.awajdigital.com/api/cc/campaigns/42/contacts \ -H "Authorization: Bearer your_api_token_here" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -d '{ "phone_numbers": [ "01912345678", "01512345678" ] }'// Browser JavaScript (Fetch API)const response = await fetch('https://api.awajdigital.com/api/cc/campaigns/42/contacts', { method: 'POST', headers: { 'Authorization': 'Bearer your_api_token_here', 'Accept': 'application/json', 'Content-Type': 'application/json' }, body: JSON.stringify({ "phone_numbers": [ "01912345678", "01512345678" ] })});
const data = await response.json();console.log(data);// Node.js with axiosconst axios = require('axios');
async function addNumbers() { try { const response = await axios.post( 'https://api.awajdigital.com/api/cc/campaigns/42/contacts', { "phone_numbers": [ "01912345678", "01512345678" ] }, { headers: { 'Authorization': 'Bearer your_api_token_here', 'Accept': 'application/json', 'Content-Type': 'application/json' } } );
console.log(response.data); } catch (error) { console.error('Error:', error.response?.data || error.message); }}
addNumbers();# Python with requestsimport requests
def add_numbers(): url = 'https://api.awajdigital.com/api/cc/campaigns/42/contacts' headers = { 'Authorization': 'Bearer your_api_token_here', 'Accept': 'application/json', 'Content-Type': 'application/json' } payload = { "phone_numbers": [ "01912345678", "01512345678" ] }
try: response = requests.post(url, json=payload, headers=headers) print(response.json()) except requests.exceptions.RequestException as e: print(f'Error: {e}')
add_numbers()<?php// PHP with cURL$url = 'https://api.awajdigital.com/api/cc/campaigns/42/contacts';$token = 'your_api_token_here';$payload = <<<JSON{ "phone_numbers": [ "01912345678", "01512345678" ]}JSON;
$ch = curl_init($url);curl_setopt($ch, CURLOPT_POST, true);curl_setopt($ch, CURLOPT_POSTFIELDS, $payload);curl_setopt($ch, CURLOPT_HTTPHEADER, [ 'Authorization: Bearer ' . $token, 'Accept: application/json', 'Content-Type: application/json']);curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
$response = curl_exec($ch);curl_close($ch);
$result = json_decode($response, true);print_r($result);?>Success Response Example
Section titled “Success Response Example”{ "data": { "added": 2, "duplicates": 0, "invalid": 0, "contact_count": 199 }}| Field | Type | Description |
|---|---|---|
| added | integer | Numbers new to the campaign |
| duplicates | integer | Numbers the campaign already had, or given more than once |
| invalid | integer | Entries that are not a Bangladesh mobile number |
| contact_count | integer | Numbers in the campaign now |
Error Responses
Section titled “Error Responses”| Status | Code | Description |
|---|---|---|
| 401 | — | Missing or invalid access token |
| 403 | — | Account does not have the call-center permission |
| 404 | campaign_not_found |
Unknown campaign, or not on your account |
| 409 | invalid_status |
The campaign is stopped or completed |
| 422 | no_valid_numbers |
None of the numbers is valid |
| 422 | — | Validation error (errors array) |
| 429 | — | Rate limit exceeded (60 requests/minute) |
