Calls API (/v1/calls)
The Calls API in Mahadata provides programmatic access (server-to-server) using an API Key (Authorization: Bearer <API_KEY>) to retrieve the list of calls, individual call details, signed recording download URLs (presigned URL), as well as permission status and outbound call rate limits (guardrails). All data is automatically scoped to the tenant account that owns the API Key.
Authentication
Section titled “Authentication”Use the standard Bearer API Key header on every request:
Authorization: Bearer mhd_live_xxxxxxxxxxxxxxxxx1. Call Log (GET /v1/calls)
Section titled “1. Call Log (GET /v1/calls)”Retrieve a list of calls sorted from the most recent (created_at DESC, id DESC) using cursor-based pagination (after).
Query Parameters
Section titled “Query Parameters”| Parameter | Type | Description |
|---|---|---|
from | string (RFC3339) | Lower bound filter created_at (inclusive) |
to | string (RFC3339) | Upper bound filter created_at (inclusive) |
direction | string | "inbound" or "outbound" |
outcome | string | "answered", "missed", "declined", "failed", or "in_progress" |
business_phone_id | UUID | Filter by WhatsApp business number ID |
customer_phone | string | Filter by customer phone number (automatically normalized to digits) |
after | string | Cursor for the next page ("rfc3339|uuid") from paging.next |
limit | integer | Number of rows per page (1..=100, default 20) |
Example Request
Section titled “Example Request”curl -sS "https://messaging.mahadata.io/v1/calls?direction=inbound&outcome=missed&limit=20" \ -H "Authorization: Bearer $API_KEY"Example Response
Section titled “Example Response”{ "data": [ { "id": "0192be10-4400-7000-8000-000000000002", "wa_call_id": "wacid.HBgNNjI4MTIzNDU2Nzg5MBUCABIYFDNC", "direction": "inbound", "business_phone": "622150991000", "business_phone_id": "11111111-2222-4333-8444-555555555555", "customer_phone": "6281234567890", "status": "missed", "outcome": "missed", "end_reason": "queue_timeout", "duration_seconds": 0, "started_at": null, "answered_at": null, "ended_at": "2026-10-24T10:20:00Z", "created_at": "2026-10-24T10:15:00Z", "queue_id": "aaaaaaaa-bbbb-4ccc-8ddd-eeeeeeeeeeee", "agent": null, "conversation_id": "99999999-8888-4777-8666-555555555555", "contact_id": "77777777-6666-4555-8444-333333333333", "contact_name": "Budi Santoso", "disposition": null, "recording_available": false, "entry": { "kind": "call_button", "payload": "order-42" } } ], "paging": { "next": "2026-10-24T10:15:00+00:00|0192be10-4400-7000-8000-000000000002" }}
entryfield note: Theentryobject is optional and appears only on calls initiated from an interactive or template call button ("kind": "call_button", with"payload"present when the button includesparameters.payload) or a WhatsApp call link ("kind": "deeplink").
2. Call Details (GET /v1/calls/{id})
Section titled “2. Call Details (GET /v1/calls/{id})”Retrieves a single call record based on id call log. Returns 404 Not Found if the ID is not found or belongs to another tenant.
curl -sS "https://messaging.mahadata.io/v1/calls/0192be10-4400-7000-8000-000000000001" \ -H "Authorization: Bearer $API_KEY"3. Call Recordings (GET /v1/calls/{id}/recording)
Section titled “3. Call Recordings (GET /v1/calls/{id}/recording)”Returns a list of time-limited recording download URLs (valid for 15 minutes) for a call.
- If the call has no recording, the endpoint returns
{ "recordings": [] }. - If the call does not belong to your tenant, the endpoint returns
404 Not Found. - If object storage is currently unable to create a presigned URL, the endpoint returns
503 Service Unavailable(internal object keys are never exposed).
curl -sS "https://messaging.mahadata.io/v1/calls/0192be10-4400-7000-8000-000000000001/recording" \ -H "Authorization: Bearer $API_KEY"Example Response
Section titled “Example Response”{ "recordings": [ { "id": "33333333-4444-4555-8666-777777777777", "url": "https://s3.example.com/recordings/0192be10.ogg?X-Amz-Expires=900&...", "expires_at": "2026-10-24T10:35:00Z", "duration_seconds": 124 } ]}4. Call Permission Status (GET /v1/calls/permission)
Section titled “4. Call Permission Status (GET /v1/calls/permission)”Checks whether your external system or dialer can call or send a call permission request to the current customer phone number, along with attempt counters and active limits (guardrails).
Query Parameters
Section titled “Query Parameters”| Parameters | Type | Required | Description |
|---|---|---|---|
business_phone_id | UUID | Yes | WhatsApp business number ID in Mahadata |
customer_phone | string | Yes | Customer phone number (6–15 digits, may start with +) |
Example Request
Section titled “Example Request”curl -sS "https://messaging.mahadata.io/v1/calls/permission?business_phone_id=11111111-2222-4333-8444-555555555555&customer_phone=6281234567890" \ -H "Authorization: Bearer $API_KEY"Example Response
Section titled “Example Response”{ "business_phone_id": "11111111-2222-4333-8444-555555555555", "customer_phone": "6281234567890", "status": "temporary", "expires_at": "2026-11-04T06:00:00Z", "can_call": true, "can_request_permission": false, "block_reason": null, "counters": { "requests_24h": 1, "requests_7d": 1, "call_attempts_24h": 2, "unanswered_streak": 0 }, "limits": { "requests_24h": 1, "requests_7d": 2, "call_attempts_max_24h": 100, "unanswered_streak_max": 4 }}block_reason Codes
Section titled “block_reason Codes”| Code | Meaning |
|---|---|
call_guardrail.opted_out | The customer has sent an opt-out keyword (e.g. STOP CALL) so calls and permission requests are blocked. |
call_guardrail.call_attempts_24h | The outbound call limit in the last 24 hours has been reached (call_attempts_max_24h). |
call_guardrail.unanswered_streak | The consecutive unanswered call limit has been reached (unanswered_streak_max); wait for the customer to reply or call back. |
block_reason only explains why outbound calls are blocked. Permission request limits do not appear here: see can_request_permission: false, and rejected permission requests return 400 with details.code call_guardrail.request_limit_24h (limit of 1 request / 24 hours) or call_guardrail.request_limit_7d (limit of requests_7d).
Meta Policy Limits (Hard Limits)
Section titled “Meta Policy Limits (Hard Limits)”| Meta Policy | Maximum Limit |
|---|---|
| Call permission requests per customer (24 hours) | Max. 1 request / 24 hours |
| Call permission requests per customer (7 days) | Max. 2 requests / 7 days |
| Permission validity after customer approval | 7 days from approval |
| Connected calls per number pair (24 hours) | Max. 100 calls / 24 hours |
| Consecutive unanswered calls before permission is automatically revoked | 4 unanswered calls. The default in Mahadata is also 4 and can be set between 1 and 4 in Settings › Voice › Call Permissions (unanswered_streak_max). |