REST API
Base URL: https://api.bharatcalls.com/api/v1
Authentication
Create an API key under Developers. Send it on every request as Authorization: Bearer <key> or X-API-Key: <key>. Keys belong to your account; revoke one any time. The limit is 120 requests a minute per key.
List agents
GET /agents
{ "items": [{ "id": 3, "name": "Order assistant", "agentName": "Priya", "languageCode": "hi-IN" }] }
Start a call
POST /calls
| Field | Type | |
|---|---|---|
phone |
string | Required. The customer's number, e.g. +919876543210. |
agentId |
number | Required. From GET /agents. |
name, email, company |
string | Optional. Saved on the contact. |
variables |
object | Optional. Up to 30 values (string, number or boolean) the agent knows and the opening line can use, e.g. {{order_id}}. |
externalRef |
string | Optional. Your id for the call. A retry with the same externalRef returns the first call instead of calling twice. |
scheduledAt |
string | Optional. ISO date-time; calls start within calling hours. |
fromNumberId |
number | Optional. Which of your numbers to call from; your first active number by default. |
curl -X POST https://api.bharatcalls.com/api/v1/calls \
-H "Authorization: Bearer $API_KEY" \
-H "Content-Type: application/json" \
-d '{"phone":"+919876543210","agentId":3,"name":"Asha","externalRef":"ORDER-5521","variables":{"order_id":"5521"}}'
Answers 201 with the call. Errors: 400 (bad input, or no active number), 401 (missing or invalid key), 409 with "code": "DO_NOT_CALL".
Read calls
GET /calls?externalRef=&status=&intent=&limit=lists recent calls (up to 100).GET /calls/:idreturns one call; add?transcript=truefor the transcript.
{
"id": 1001, "externalRef": "ORDER-5521", "agentId": 3, "direction": "OUTBOUND", "status": "COMPLETED",
"phone": "+919876543210", "startedAt": "...", "answeredAt": "...", "endedAt": "...", "durationSec": 84,
"analysisStatus": "DONE", "intent": "INTERESTED", "customIntents": [], "sentiment": "POSITIVE", "leadScore": 90,
"summary": "...", "nextAction": "...", "callbackTime": null, "endReason": "agent_ended"
}
Rather than polling for results, use webhooks.