End a live call
curl --request POST \
--url https://api.dairo.app/v1/phone/calls/{id}/hangup \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.dairo.app/v1/phone/calls/{id}/hangup"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.dairo.app/v1/phone/calls/{id}/hangup', 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.dairo.app/v1/phone/calls/{id}/hangup",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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.dairo.app/v1/phone/calls/{id}/hangup"
req, _ := http.NewRequest("POST", 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.post("https://api.dairo.app/v1/phone/calls/{id}/hangup")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dairo.app/v1/phone/calls/{id}/hangup")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"object": "phone_call",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"direction": "outbound",
"status": "queued",
"fromNumber": "<string>",
"toNumber": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"instructions": "<string>",
"greeting": "<string>",
"voice": "<string>",
"model": "<string>",
"language": "<string>",
"backgroundAudio": "silence",
"maxDurationSeconds": 123,
"queuedAt": "2023-11-07T05:31:56Z",
"startedAt": "2023-11-07T05:31:56Z",
"answeredAt": "2023-11-07T05:31:56Z",
"endedAt": "2023-11-07T05:31:56Z",
"durationSeconds": 123,
"hangupCause": "<string>",
"answeredBy": "<string>",
"summary": "<string>",
"costUsd": 123,
"error": "<string>",
"webhookUrl": "<string>",
"metadata": {},
"idempotencyKey": "<string>"
}{
"error": {
"message": "<string>",
"code": "<string>",
"type": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"type": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"type": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"type": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"type": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"type": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"type": "<string>",
"param": "<string>"
}
}Phone
End a live call
End a live call
POST
/
v1
/
phone
/
calls
/
{id}
/
hangup
End a live call
curl --request POST \
--url https://api.dairo.app/v1/phone/calls/{id}/hangup \
--header 'Authorization: Bearer <token>'import requests
url = "https://api.dairo.app/v1/phone/calls/{id}/hangup"
headers = {"Authorization": "Bearer <token>"}
response = requests.post(url, headers=headers)
print(response.text)const options = {method: 'POST', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.dairo.app/v1/phone/calls/{id}/hangup', 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.dairo.app/v1/phone/calls/{id}/hangup",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
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.dairo.app/v1/phone/calls/{id}/hangup"
req, _ := http.NewRequest("POST", 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.post("https://api.dairo.app/v1/phone/calls/{id}/hangup")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.dairo.app/v1/phone/calls/{id}/hangup")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"object": "phone_call",
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"direction": "outbound",
"status": "queued",
"fromNumber": "<string>",
"toNumber": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"instructions": "<string>",
"greeting": "<string>",
"voice": "<string>",
"model": "<string>",
"language": "<string>",
"backgroundAudio": "silence",
"maxDurationSeconds": 123,
"queuedAt": "2023-11-07T05:31:56Z",
"startedAt": "2023-11-07T05:31:56Z",
"answeredAt": "2023-11-07T05:31:56Z",
"endedAt": "2023-11-07T05:31:56Z",
"durationSeconds": 123,
"hangupCause": "<string>",
"answeredBy": "<string>",
"summary": "<string>",
"costUsd": 123,
"error": "<string>",
"webhookUrl": "<string>",
"metadata": {},
"idempotencyKey": "<string>"
}{
"error": {
"message": "<string>",
"code": "<string>",
"type": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"type": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"type": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"type": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"type": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"type": "<string>",
"param": "<string>"
}
}{
"error": {
"message": "<string>",
"code": "<string>",
"type": "<string>",
"param": "<string>"
}
}Authorizations
Dairo API key, e.g. dairo_test_... or dairo_live_...
Path Parameters
Response
Success
Allowed value:
"phone_call"Available options:
outbound, inbound Terminal: completed, failed, no_answer, busy, canceled.
Available options:
queued, initiating, ringing, in_progress, completed, failed, no_answer, busy, canceled Available options:
silence, office, none, null human or machine, from answering-machine detection.
Billed per started minute.