curl --request GET \
--url https://api.pyai.com/v1/amd/calls/{call_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.pyai.com/v1/amd/calls/{call_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.pyai.com/v1/amd/calls/{call_id}', 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/amd/calls/{call_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.pyai.com/v1/amd/calls/{call_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.pyai.com/v1/amd/calls/{call_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pyai.com/v1/amd/calls/{call_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"object": "amd.call",
"call_id": "<string>",
"session_label": "<string>",
"status": "completed",
"answered_by": "human",
"answered_by_twilio": "<string>",
"confidence": 0.5,
"decision_ms": 123,
"created_at": 123,
"reason": "<string>",
"aggressiveness": 123,
"started_at": 123,
"meta": {},
"error": "<string>"
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "invalid_request_error",
"param": "<string>"
}
}{
"title": "<string>",
"status": 123,
"type": "<string>",
"detail": "<string>",
"request_id": "<string>"
}Get an AMD decision
The full decision for one call: answered_by, answered_by_twilio, confidence, decision_ms, and the word-level reason. Requires amd:read.
curl --request GET \
--url https://api.pyai.com/v1/amd/calls/{call_id} \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.pyai.com/v1/amd/calls/{call_id}"
headers = {"Authorization": "Bearer <token>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.pyai.com/v1/amd/calls/{call_id}', 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/amd/calls/{call_id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.pyai.com/v1/amd/calls/{call_id}"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Bearer <token>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://api.pyai.com/v1/amd/calls/{call_id}")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.pyai.com/v1/amd/calls/{call_id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"object": "amd.call",
"call_id": "<string>",
"session_label": "<string>",
"status": "completed",
"answered_by": "human",
"answered_by_twilio": "<string>",
"confidence": 0.5,
"decision_ms": 123,
"created_at": 123,
"reason": "<string>",
"aggressiveness": 123,
"started_at": 123,
"meta": {},
"error": "<string>"
}{
"error": {
"message": "<string>",
"type": "<string>",
"code": "invalid_request_error",
"param": "<string>"
}
}{
"title": "<string>",
"status": 123,
"type": "<string>",
"detail": "<string>",
"request_id": "<string>"
}Authorizations
Use Authorization: Bearer pyai_live_... (or pyai_test_...).
Path Parameters
Response
AMD decision detail
"amd.call"
The opaque tag passed on the connect URL / TwiML, if any.
completed, failed PyAI's richer answered-by vocabulary. screening = an iPhone/Google call-screening assistant; sit_invalid = a dead/disconnected number.
human, voicemail, live_voicemail, screening, ivr, human_gatekeeper, sit_invalid, fax, silence, unknown Twilio's exact AnsweredBy enum (human | machine_start | machine_end_beep | machine_end_silence | machine_end_other | fax | unknown), so a Twilio drop-in keeps its routing logic unchanged.
0 <= x <= 1Latency from answer to decision, in ms.
Unix ms when the decision was written.
Human-readable evidence, e.g. "machine phrase: 'please leave a message' at 1.2s".
Operating point used for this call.
Unix ms when the call was answered.
Present when status is failed.