curl --request POST \
--url https://api.pyai.com/v1/telephony/browser-sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"from_number_id": "<string>",
"to": "<string>",
"user_id": "<string>",
"client_reference": "<string>",
"recording": true,
"use_case": "support",
"max_duration_seconds": 3600
}
'import requests
url = "https://api.pyai.com/v1/telephony/browser-sessions"
payload = {
"from_number_id": "<string>",
"to": "<string>",
"user_id": "<string>",
"client_reference": "<string>",
"recording": True,
"use_case": "support",
"max_duration_seconds": 3600
}
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: '<string>',
user_id: '<string>',
client_reference: '<string>',
recording: true,
use_case: 'support',
max_duration_seconds: 3600
})
};
fetch('https://api.pyai.com/v1/telephony/browser-sessions', 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/browser-sessions",
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' => '<string>',
'user_id' => '<string>',
'client_reference' => '<string>',
'recording' => true,
'use_case' => 'support',
'max_duration_seconds' => 3600
]),
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/browser-sessions"
payload := strings.NewReader("{\n \"from_number_id\": \"<string>\",\n \"to\": \"<string>\",\n \"user_id\": \"<string>\",\n \"client_reference\": \"<string>\",\n \"recording\": true,\n \"use_case\": \"support\",\n \"max_duration_seconds\": 3600\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/browser-sessions")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from_number_id\": \"<string>\",\n \"to\": \"<string>\",\n \"user_id\": \"<string>\",\n \"client_reference\": \"<string>\",\n \"recording\": true,\n \"use_case\": \"support\",\n \"max_duration_seconds\": 3600\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pyai.com/v1/telephony/browser-sessions")
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\": \"<string>\",\n \"user_id\": \"<string>\",\n \"client_reference\": \"<string>\",\n \"recording\": true,\n \"use_case\": \"support\",\n \"max_duration_seconds\": 3600\n}"
response = http.request(request)
puts response.read_body{
"object": "telephony.browser_session",
"id": "<string>",
"call_id": "<string>",
"transport": "voice-sdk",
"access_token": "<string>",
"expires_at": 123,
"connect_params": {
"session_id": "<string>"
},
"call": {
"version": 123,
"project_id": "<string>",
"direction": "inbound",
"from": "<string>",
"destination_number_id": "<string>",
"admission_mode": "client",
"admission_status": "pending",
"admission_expires_at": 123,
"max_duration_seconds": 123,
"client_reference": "<string>",
"agent_release_id": "<string>",
"stop_requested": true,
"object": "telephony.call",
"id": "tcall_...",
"from_number_id": "<string>",
"to": "+14155550123",
"agent_id": "<string>",
"call_type": "human",
"user_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>",
"text": "<string>",
"resource": "<string>"
},
"ai_usage": {
"status": "pending",
"meter": "agents.minutes",
"units": 123,
"billable_units": 123
},
"usage": {
"status": "pending",
"meter": "telephony.minutes",
"units": 123,
"billable": true
}
}
}
}{
"title": "<string>",
"status": 123,
"type": "<string>",
"detail": "<string>",
"request_id": "<string>"
}{
"title": "<string>",
"status": 123,
"type": "<string>",
"detail": "<string>",
"request_id": "<string>"
}Create a managed human calling session
Create a short-lived, single-use browser calling session for a US or Australian destination. Requires a live project key with telephony:manage. Your server supplies the authenticated user ID. Source number, destination, user and client reference are immutable. No phone is dialed until the browser connects. Retry the same Idempotency-Key to recover the same call; a consumed, expired or stopped session returns access_token=null. Use the supported Voice JavaScript SDK with the returned token and connect_params. Managed calling policy, consent and source ownership are checked again when connecting. Human calls produce telephony usage only. Recording, when enabled, is captured from answer and retained privately by PyAI.
curl --request POST \
--url https://api.pyai.com/v1/telephony/browser-sessions \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--header 'Idempotency-Key: <idempotency-key>' \
--data '
{
"from_number_id": "<string>",
"to": "<string>",
"user_id": "<string>",
"client_reference": "<string>",
"recording": true,
"use_case": "support",
"max_duration_seconds": 3600
}
'import requests
url = "https://api.pyai.com/v1/telephony/browser-sessions"
payload = {
"from_number_id": "<string>",
"to": "<string>",
"user_id": "<string>",
"client_reference": "<string>",
"recording": True,
"use_case": "support",
"max_duration_seconds": 3600
}
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: '<string>',
user_id: '<string>',
client_reference: '<string>',
recording: true,
use_case: 'support',
max_duration_seconds: 3600
})
};
fetch('https://api.pyai.com/v1/telephony/browser-sessions', 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/browser-sessions",
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' => '<string>',
'user_id' => '<string>',
'client_reference' => '<string>',
'recording' => true,
'use_case' => 'support',
'max_duration_seconds' => 3600
]),
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/browser-sessions"
payload := strings.NewReader("{\n \"from_number_id\": \"<string>\",\n \"to\": \"<string>\",\n \"user_id\": \"<string>\",\n \"client_reference\": \"<string>\",\n \"recording\": true,\n \"use_case\": \"support\",\n \"max_duration_seconds\": 3600\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/browser-sessions")
.header("Idempotency-Key", "<idempotency-key>")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"from_number_id\": \"<string>\",\n \"to\": \"<string>\",\n \"user_id\": \"<string>\",\n \"client_reference\": \"<string>\",\n \"recording\": true,\n \"use_case\": \"support\",\n \"max_duration_seconds\": 3600\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pyai.com/v1/telephony/browser-sessions")
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\": \"<string>\",\n \"user_id\": \"<string>\",\n \"client_reference\": \"<string>\",\n \"recording\": true,\n \"use_case\": \"support\",\n \"max_duration_seconds\": 3600\n}"
response = http.request(request)
puts response.read_body{
"object": "telephony.browser_session",
"id": "<string>",
"call_id": "<string>",
"transport": "voice-sdk",
"access_token": "<string>",
"expires_at": 123,
"connect_params": {
"session_id": "<string>"
},
"call": {
"version": 123,
"project_id": "<string>",
"direction": "inbound",
"from": "<string>",
"destination_number_id": "<string>",
"admission_mode": "client",
"admission_status": "pending",
"admission_expires_at": 123,
"max_duration_seconds": 123,
"client_reference": "<string>",
"agent_release_id": "<string>",
"stop_requested": true,
"object": "telephony.call",
"id": "tcall_...",
"from_number_id": "<string>",
"to": "+14155550123",
"agent_id": "<string>",
"call_type": "human",
"user_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>",
"text": "<string>",
"resource": "<string>"
},
"ai_usage": {
"status": "pending",
"meter": "agents.minutes",
"units": 123,
"billable_units": 123
},
"usage": {
"status": "pending",
"meter": "telephony.minutes",
"units": 123,
"billable": true
}
}
}
}{
"title": "<string>",
"status": 123,
"type": "<string>",
"detail": "<string>",
"request_id": "<string>"
}{
"title": "<string>",
"status": 123,
"type": "<string>",
"detail": "<string>",
"request_id": "<string>"
}Authorizations
Use Authorization: Bearer pyai_live_... (or pyai_test_...).
Headers
Body
200E.164 destination in the US or Australia.
1 - 2001 - 200transactional, support, sales, collections, survey 30 <= x <= 3600Response
Durable call and ephemeral browser capability. Never cache the token.
"telephony.browser_session""voice-sdk"Opaque token valid for three minutes; null after consumption, cancellation or expiry.
Unix milliseconds.
Show child attributes
Show child attributes
Show child attributes
Show child attributes