Chamadas
Iniciar chamada (BIC)
Inicia uma chamada de voz do negócio para o usuário (business-initiated call). Body: { to, sdp?, sdpType?:"offer", bizOpaqueCallbackData? }. Números Meta: o sdp é OBRIGATÓRIO — a oferta RFC 8866 do SEU cliente WebRTC (lado do negócio deve usar a=setup:active) — e exige permissão prévia do usuário (senão a Meta retorna 138006 → META_CALL_PERMISSION_REQUIRED); cobrança por minuto pela Meta, direto na sua WABA, só quando atendida. Números web (não-oficiais): OMITA o sdp — a mídia é tratada no servidor — sem etapa de permissão e sem cobrança da Meta.
**Requer uma chave com escopo de número.**
POST
/
v1
/
calls
Iniciar chamada (BIC)
curl --request POST \
--url https://pilotstatus.com.br/v1/calls \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"to": "+5511999999999",
"sdp": "v=0\r\n...",
"bizOpaqueCallbackData": "order-42"
}
'import requests
url = "https://pilotstatus.com.br/v1/calls"
payload = {
"to": "+5511999999999",
"sdp": "v=0
...",
"bizOpaqueCallbackData": "order-42"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({to: '+5511999999999', sdp: 'v=0\r\n...', bizOpaqueCallbackData: 'order-42'})
};
fetch('https://pilotstatus.com.br/v1/calls', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://pilotstatus.com.br/v1/calls",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'to' => '+5511999999999',
'sdp' => 'v=0
...',
'bizOpaqueCallbackData' => 'order-42'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://pilotstatus.com.br/v1/calls"
payload := strings.NewReader("{\n \"to\": \"+5511999999999\",\n \"sdp\": \"v=0\\r\\n...\",\n \"bizOpaqueCallbackData\": \"order-42\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://pilotstatus.com.br/v1/calls")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"to\": \"+5511999999999\",\n \"sdp\": \"v=0\\r\\n...\",\n \"bizOpaqueCallbackData\": \"order-42\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/calls")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"to\": \"+5511999999999\",\n \"sdp\": \"v=0\\r\\n...\",\n \"bizOpaqueCallbackData\": \"order-42\"\n}"
response = http.request(request)
puts response.read_body{
"id": "call_01HZX...",
"externalCallId": "wacid.ABGG...",
"status": "INITIATED"
}{
"error": "Validation error"
}{
"error": "Unauthorized"
}{
"error": "Tenant-scoped keys cannot call number endpoints",
"code": "TENANT_SCOPE_NOT_ALLOWED"
}{
"error": "WhatsApp instance not connected",
"code": "WHATSAPP_INSTANCE_NOT_CONNECTED"
}{
"error": "Too many requests"
}Autorizações
apiKeyapiKeyId
Sua chave de API ps_
Corpo
application/json
Número do usuário a ligar.
Exemplo:
"+5511999999999"
Oferta SDP do seu cliente WebRTC (a=setup:active). Obrigatório em números Meta; omita em números web.
Sempre "offer" (padrão).
Exemplo:
"offer"
Dado opaco ecoado no evento de término.
Exemplo:
"order-42"
Resposta
Iniciar chamada
Esta página foi útil?
⌘I
Iniciar chamada (BIC)
curl --request POST \
--url https://pilotstatus.com.br/v1/calls \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"to": "+5511999999999",
"sdp": "v=0\r\n...",
"bizOpaqueCallbackData": "order-42"
}
'import requests
url = "https://pilotstatus.com.br/v1/calls"
payload = {
"to": "+5511999999999",
"sdp": "v=0
...",
"bizOpaqueCallbackData": "order-42"
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({to: '+5511999999999', sdp: 'v=0\r\n...', bizOpaqueCallbackData: 'order-42'})
};
fetch('https://pilotstatus.com.br/v1/calls', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://pilotstatus.com.br/v1/calls",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'to' => '+5511999999999',
'sdp' => 'v=0
...',
'bizOpaqueCallbackData' => 'order-42'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://pilotstatus.com.br/v1/calls"
payload := strings.NewReader("{\n \"to\": \"+5511999999999\",\n \"sdp\": \"v=0\\r\\n...\",\n \"bizOpaqueCallbackData\": \"order-42\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://pilotstatus.com.br/v1/calls")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"to\": \"+5511999999999\",\n \"sdp\": \"v=0\\r\\n...\",\n \"bizOpaqueCallbackData\": \"order-42\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/calls")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"to\": \"+5511999999999\",\n \"sdp\": \"v=0\\r\\n...\",\n \"bizOpaqueCallbackData\": \"order-42\"\n}"
response = http.request(request)
puts response.read_body{
"id": "call_01HZX...",
"externalCallId": "wacid.ABGG...",
"status": "INITIATED"
}{
"error": "Validation error"
}{
"error": "Unauthorized"
}{
"error": "Tenant-scoped keys cannot call number endpoints",
"code": "TENANT_SCOPE_NOT_ALLOWED"
}{
"error": "WhatsApp instance not connected",
"code": "WHATSAPP_INSTANCE_NOT_CONNECTED"
}{
"error": "Too many requests"
}