Calls API reference
Base URL:https://pilotstatus.com.br/v1 Headers: Content-Type: application/json, x-api-key: <your_api_key> (or x-api-key-id).
Meta Cloud API numbers only — see the overview. All endpoints require a number-scoped key.
Endpoints
| Method | Endpoint | Description |
|---|---|---|
POST | /v1/calls | Start a business-initiated call (BIC). |
GET | /v1/calls | List the number’s calls (newest first; limit 1–100, before ISO 8601 cursor). |
GET | /v1/calls/{callId} | One call; add ?includeSdp=1 to receive sdpOffer/sdpAnswer. |
POST | /v1/calls/{callId}/pre-accept | OPTIONAL early SDP answer (reduces audio clipping; call connects only on accept). |
POST | /v1/calls/{callId}/accept | Answer an inbound (UIC) call with the business-side SDP answer. |
POST | /v1/calls/{callId}/reject | Decline an incoming call (no body). |
POST | /v1/calls/{callId}/terminate | Hang up an active call (no body). |
GET | /v1/calls/settings | Read the number’s calling settings object. |
PUT | /v1/calls/settings | Partial update of the calling settings. |
GET | /v1/calls/permissions?to=<phone> | Probe whether the business may call to. |
POST | /v1/calls/permissions/request | Send the interactive call-permission request (inside the 24h window). |
{callId} accepts either the Pilot Status call id (call_...) or the Meta call id (wacid...).
1. Enable calling on the number
Pilot Status tries to enable calling automatically when a Meta number connects. Read/adjust anytime:PUTis partial: send onlystatus,call_icon_visibility,callback_permission_status,call_hours,voicemail(thesipobject is rejected).- A posted
call_hoursreplaces the stored object entirely (Meta semantics). - Numbers with a messaging limit below 2,000/day cannot enable calling yet (Meta error 138015).
- SIP credentials are never requested nor returned.
2. Call permission (required before a BIC)
call.permission_updated webhook event (status: NO_PERMISSION | TEMPORARY | PERMANENT). Meta rate-limits permission requests (error 138009) and BIC volume (100 calls/24h per number — error 138012).
3. Start a call (BIC)
sdpis the RFC 8866 offer produced by YOUR WebRTC client. The business-side SDP must usea=setup:active.bizOpaqueCallbackData(optional) is echoed back on the terminate webhook.- Without permission, Meta returns 138006 → the endpoint surfaces
code: "META_CALL_PERMISSION_REQUIRED".
4. Answer an inbound call (UIC)
When a user calls your number you receive thecall.ringing webhook (and the native calls envelope carrying the user’s SDP offer). Then:
accept/pre-accept/reject/terminate respond { "success": true, "id": "call_...", "status": "..." }. pre-accept is optional (early SDP answer to reduce clipping); the call connects only on accept.
5. Call object (DTO)
status:INITIATED|RINGING|ACCEPTED|REJECTED|COMPLETED|FAILED|MISSED.direction:INBOUND(UIC) |OUTBOUND(BIC).- SDPs (
sdpOffer/sdpAnswer) appear only with?includeSdp=1onGET /v1/calls/{callId}— never on the list. durationSecondsis set only when the call was answered.
Common errors
400 FEATURE_NOT_SUPPORTED— the key’s number is not a Meta Cloud API number.400 NUMBER_NOT_FOUND— the key is not bound to a number.400— body validation,INVALID_LIMIT,INVALID_BEFORE,MISSING_TO.401— missing/invalidx-api-key/x-api-key-id.403— tenant-scoped key (calls endpoints are number-scoped).404 CALL_NOT_FOUND— the callId/wacid does not belong to the key’s number.- Meta calling errors are forwarded with a mapped
code— e.g.META_CALL_PERMISSION_REQUIRED(138006), permission-request limit (138009), BIC limit 100 calls/24h (138012), calling not enabled (138000), messaging tier too low to enable (138015).