curl --request POST \
--url https://api.pyai.com/v1/telephony/calls \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"from_number_id": "<string>",
"to": "+14155550123",
"agent_id": "<string>",
"routing_profile": "balanced"
}
'import requests
url = "https://api.pyai.com/v1/telephony/calls"
payload = {
"from_number_id": "<string>",
"to": "+14155550123",
"agent_id": "<string>",
"routing_profile": "balanced"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
from_number_id: '<string>',
to: '+14155550123',
agent_id: '<string>',
routing_profile: 'balanced'
})
};
fetch('https://api.pyai.com/v1/telephony/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://api.pyai.com/v1/telephony/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([
'from_number_id' => '<string>',
'to' => '+14155550123',
'agent_id' => '<string>',
'routing_profile' => 'balanced'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-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://api.pyai.com/v1/telephony/calls"
payload := strings.NewReader("{\n \"from_number_id\": \"<string>\",\n \"to\": \"+14155550123\",\n \"agent_id\": \"<string>\",\n \"routing_profile\": \"balanced\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
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://api.pyai.com/v1/telephony/calls")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from_number_id\": \"<string>\",\n \"to\": \"+14155550123\",\n \"agent_id\": \"<string>\",\n \"routing_profile\": \"balanced\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pyai.com/v1/telephony/calls")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"from_number_id\": \"<string>\",\n \"to\": \"+14155550123\",\n \"agent_id\": \"<string>\",\n \"routing_profile\": \"balanced\"\n}"
response = http.request(request)
puts response.read_body{
"object": "telephony.call",
"id": "tcall_...",
"from_number_id": "<string>",
"to": "+14155550123",
"agent_id": "<string>",
"use_case": "transactional",
"routing_profile": "quality_first",
"status": "queued",
"attempt_count": 1,
"max_attempts": 2,
"failure_reason": "network_unavailable",
"created_at": 123,
"updated_at": 123,
"answered_at": 123,
"ended_at": 123,
"artifacts": {
"status": "pending",
"omni_call_id": "<string>",
"recording": {
"status": "<string>",
"reason": "<string>",
"resource": "<string>"
},
"transcript": {
"status": "<string>",
"resource": "<string>"
},
"usage": {
"status": "pending",
"meter": "telephony.minutes",
"units": 123,
"billable": true
}
}
}{
"title": "<string>",
"status": 123,
"type": "<string>",
"detail": "<string>",
"request_id": "<string>"
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "invalid_request_error",
"param": "<string>"
}
}Start an outbound agent call
Start an outbound call from one of your active managed numbers into an Omni agent. A valid Idempotency-Key is mandatory. PyAI never retries an ambiguous dispatch and never changes routes after answer; only a confirmed retryable pre-answer result may advance an approved route plan. Limited availability: returns 404 until outbound telephony is enabled for the deployment. Requires telephony:manage.
curl --request POST \
--url https://api.pyai.com/v1/telephony/calls \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"from_number_id": "<string>",
"to": "+14155550123",
"agent_id": "<string>",
"routing_profile": "balanced"
}
'import requests
url = "https://api.pyai.com/v1/telephony/calls"
payload = {
"from_number_id": "<string>",
"to": "+14155550123",
"agent_id": "<string>",
"routing_profile": "balanced"
}
headers = {
"Idempotency-Key": "<idempotency-key>",
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'Idempotency-Key': '<idempotency-key>',
Authorization: 'Bearer <token>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
from_number_id: '<string>',
to: '+14155550123',
agent_id: '<string>',
routing_profile: 'balanced'
})
};
fetch('https://api.pyai.com/v1/telephony/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://api.pyai.com/v1/telephony/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([
'from_number_id' => '<string>',
'to' => '+14155550123',
'agent_id' => '<string>',
'routing_profile' => 'balanced'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json",
"Idempotency-Key: <idempotency-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://api.pyai.com/v1/telephony/calls"
payload := strings.NewReader("{\n \"from_number_id\": \"<string>\",\n \"to\": \"+14155550123\",\n \"agent_id\": \"<string>\",\n \"routing_profile\": \"balanced\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Idempotency-Key", "<idempotency-key>")
req.Header.Add("Authorization", "Bearer <token>")
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://api.pyai.com/v1/telephony/calls")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from_number_id\": \"<string>\",\n \"to\": \"+14155550123\",\n \"agent_id\": \"<string>\",\n \"routing_profile\": \"balanced\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pyai.com/v1/telephony/calls")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Idempotency-Key"] = '<idempotency-key>'
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"from_number_id\": \"<string>\",\n \"to\": \"+14155550123\",\n \"agent_id\": \"<string>\",\n \"routing_profile\": \"balanced\"\n}"
response = http.request(request)
puts response.read_body{
"object": "telephony.call",
"id": "tcall_...",
"from_number_id": "<string>",
"to": "+14155550123",
"agent_id": "<string>",
"use_case": "transactional",
"routing_profile": "quality_first",
"status": "queued",
"attempt_count": 1,
"max_attempts": 2,
"failure_reason": "network_unavailable",
"created_at": 123,
"updated_at": 123,
"answered_at": 123,
"ended_at": 123,
"artifacts": {
"status": "pending",
"omni_call_id": "<string>",
"recording": {
"status": "<string>",
"reason": "<string>",
"resource": "<string>"
},
"transcript": {
"status": "<string>",
"resource": "<string>"
},
"usage": {
"status": "pending",
"meter": "telephony.minutes",
"units": 123,
"billable": true
}
}
}{
"title": "<string>",
"status": 123,
"type": "<string>",
"detail": "<string>",
"request_id": "<string>"
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "invalid_request_error",
"param": "<string>"
}
}Authorizations
Use Authorization: Bearer pyai_live_... (or pyai_test_...).
Headers
Required safe-retry key. Identical retries return the original call; a different body returns 409.
255Body
Active managed-number ID to present as caller ID.
Supported E.164 destination.
"+14155550123"
Omni agent that handles the connected call.
Declared calling purpose. Determines consent, identity, CNAM, and policy gates.
transactional, support, sales, collections, survey quality_first, balanced, cost_optimized Response
Call accepted
"telephony.call"
"tcall_..."
"+14155550123"
transactional, support, sales, collections, survey quality_first, balanced, cost_optimized queued, dispatching, ringing, in_progress, completed, failed, canceled, dispatch_unknown 0 <= x <= 31 <= x <= 3network_unavailable, congestion, timeout, no_answer, busy, rejected, invalid_number, identity_blocked, compliance_blocked, unknown, null Unix ms.
Unix ms.
Unix ms.
Unix ms.
Post-call artifact and billing readiness. Included on the single-call detail response; pending until the media edge finalizes the call.
Show child attributes
Show child attributes