Chamadas
Sessão de mídia em tempo real (web)
Abre uma sessão de mídia full-duplex de curta duração numa chamada ativa. Body: { mode: "talk" | "listen" } — talk envia SEU áudio e recebe o do interlocutor; listen só recebe. Retorna { wsUrl, token, expiresInSeconds }: conecte um WebSocket em wsUrl e troque frames binários BRUTOS de áudio PCM16 little-endian (transporte WebSocket puro, NÃO é WebRTC; token de uso único, ~2 min). SOMENTE números web — Meta → 400 FEATURE_NOT_SUPPORTED.
**Requer uma chave com escopo de número.**
POST
/
v1
/
calls
/
{callId}
/
realtime-session
Sessão de mídia em tempo real (web)
curl --request POST \
--url https://pilotstatus.com.br/v1/calls/{callId}/realtime-session \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '{
"mode": "talk"
}'import requests
url = "https://pilotstatus.com.br/v1/calls/{callId}/realtime-session"
payload = { "mode": "talk" }
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({mode: 'talk'})
};
fetch('https://pilotstatus.com.br/v1/calls/{callId}/realtime-session', 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/{callId}/realtime-session",
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([
'mode' => 'talk'
]),
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/{callId}/realtime-session"
payload := strings.NewReader("{\n \"mode\": \"talk\"\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/{callId}/realtime-session")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"mode\": \"talk\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/calls/{callId}/realtime-session")
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 \"mode\": \"talk\"\n}"
response = http.request(request)
puts response.read_body{
"wsUrl": "wss://evolution-go.pilotstatus.com.br/call/media/realtime/ws/inst1/1A2B3C4D?token=...",
"token": "d3f4...",
"expiresInSeconds": 120
}{
"error": "Validation error"
}{
"error": "Unauthorized"
}{
"error": "Tenant-scoped keys cannot call number endpoints",
"code": "TENANT_SCOPE_NOT_ALLOWED"
}{
"error": "Too many requests"
}Autorizações
apiKeyapiKeyId
Sua chave de API ps_
Parâmetros de caminho
Id do Pilot Status (call_...) ou id do provedor (CallID).
Corpo
application/json
talk = envia e recebe áudio; listen = só recebe.
Exemplo:
"talk"
Resposta
Abrir sessão em tempo real
Esta página foi útil?
⌘I
Sessão de mídia em tempo real (web)
curl --request POST \
--url https://pilotstatus.com.br/v1/calls/{callId}/realtime-session \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '{
"mode": "talk"
}'import requests
url = "https://pilotstatus.com.br/v1/calls/{callId}/realtime-session"
payload = { "mode": "talk" }
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({mode: 'talk'})
};
fetch('https://pilotstatus.com.br/v1/calls/{callId}/realtime-session', 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/{callId}/realtime-session",
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([
'mode' => 'talk'
]),
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/{callId}/realtime-session"
payload := strings.NewReader("{\n \"mode\": \"talk\"\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/{callId}/realtime-session")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"mode\": \"talk\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://pilotstatus.com.br/v1/calls/{callId}/realtime-session")
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 \"mode\": \"talk\"\n}"
response = http.request(request)
puts response.read_body{
"wsUrl": "wss://evolution-go.pilotstatus.com.br/call/media/realtime/ws/inst1/1A2B3C4D?token=...",
"token": "d3f4...",
"expiresInSeconds": 120
}{
"error": "Validation error"
}{
"error": "Unauthorized"
}{
"error": "Tenant-scoped keys cannot call number endpoints",
"code": "TENANT_SCOPE_NOT_ALLOWED"
}{
"error": "Too many requests"
}