Control a FaceTime Call
curl --request POST \
--url https://app.tuco.ai/api/facetime/event \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"callDocId": "<string>",
"action": "<string>"
}
'import requests
url = "https://app.tuco.ai/api/facetime/event"
payload = {
"callDocId": "<string>",
"action": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({callDocId: '<string>', action: '<string>'})
};
fetch('https://app.tuco.ai/api/facetime/event', 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://app.tuco.ai/api/facetime/event",
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([
'callDocId' => '<string>',
'action' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://app.tuco.ai/api/facetime/event"
payload := strings.NewReader("{\n \"callDocId\": \"<string>\",\n \"action\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://app.tuco.ai/api/facetime/event")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"callDocId\": \"<string>\",\n \"action\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.tuco.ai/api/facetime/event")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"callDocId\": \"<string>\",\n \"action\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"ok": true,
"forwarded": true
}Voice / Calling
Control a FaceTime Call
Hang up, mute, or unmute a live FaceTime call by its call ID. Hangup ends the call and finalizes the record; Tuco measures duration and answered status from the live call.
POST
/
api
/
facetime
/
event
Control a FaceTime Call
curl --request POST \
--url https://app.tuco.ai/api/facetime/event \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"callDocId": "<string>",
"action": "<string>"
}
'import requests
url = "https://app.tuco.ai/api/facetime/event"
payload = {
"callDocId": "<string>",
"action": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({callDocId: '<string>', action: '<string>'})
};
fetch('https://app.tuco.ai/api/facetime/event', 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://app.tuco.ai/api/facetime/event",
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([
'callDocId' => '<string>',
'action' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://app.tuco.ai/api/facetime/event"
payload := strings.NewReader("{\n \"callDocId\": \"<string>\",\n \"action\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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://app.tuco.ai/api/facetime/event")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"callDocId\": \"<string>\",\n \"action\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://app.tuco.ai/api/facetime/event")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"callDocId\": \"<string>\",\n \"action\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"ok": true,
"forwarded": true
}Live. The REST side-channel for a call you placed with Place a FaceTime Call. The call’s audio runs over its
streamUrl WebSocket; this endpoint is how you do things to the live call — end it, or mute/unmute it.No sandbox. A request from the Try it panel runs against production with the key you paste in, and acts on a real, live call.
Overview
One endpoint, three actions, keyed by thecallDocId you got from Place a FaceTime Call:
action | What it does |
|---|---|
hangup | Authoritative. Ends the live call, releases the line’s one-call-per-line lock, and finalizes the record — duration, answered status, the in-chat call entry, CRM log, and the call.ended webhook. |
mute | Stops your caller’s microphone reaching the other side. Advisory — see the note below. |
unmute | Resumes your caller’s microphone. |
Duration and answered status are measured by Tuco, from the live call — your client never reports them. So a
hangup carries no durationSec or answered: ending the call is all you send, and the record is finalized from what actually happened. This is what keeps the daily-limit count honest.Making a request
- Method:
POST - URL:
https://app.tuco.ai/api/facetime/event - Headers:
Authorization: Bearer tuco_...andContent-Type: application/json - Body: JSON with
callDocIdandaction
Request body
{
"callDocId": "6a4ed2d5dec1b2d01a6f7656",
"action": "hangup"
}
The call record ID returned by Place a FaceTime Call. Must be a call in your workspace.
Example
curl -X POST https://app.tuco.ai/api/facetime/event \
-H "Authorization: Bearer tuco_your_key" \
-H "Content-Type: application/json" \
-d '{
"callDocId": "6a4ed2d5dec1b2d01a6f7656",
"action": "hangup"
}'
Response
200 OK
For hangup:
{ "ok": true }
mute / unmute:
{ "ok": true, "forwarded": true }
On
mute / unmute only: whether the command reached the live audio stream. false means the call’s streamUrl isn’t currently connected — the command is a no-op, not an error. (The authoritative mute is simply your frontend not sending microphone audio.)hangup is idempotent: sending it for a call that already ended still returns 200, so it’s always safe to send — for example on a disconnect you didn’t initiate. The recording, transcript, and summary of an answered call arrive a few seconds later as a call.recording.ready webhook.Errors
Errors return a JSON body with anerror field.
| HTTP | error | Meaning |
|---|---|---|
| 401 | Unauthorized | Missing or invalid API key, or the key has no workspace. |
| 400 | Invalid JSON body | Body wasn’t valid JSON. |
| 400 | valid callDocId required | callDocId missing or not a valid ID. |
| 400 | action must be one of hangup, mute, unmute | action missing or not one of the three. |
| 404 | Call not found | No call with that callDocId in your workspace. |