POST
/voice/hangup
End an active voice call
Description
Disconnect a live call by `call_id`. Returns once the hangup is dispatched to the phone; the presence WS will emit an `ended` event when the carrier confirms teardown. Equivalent to the MCP `hangup_call` tool.
Authentication
Bearer required. Send Authorization: Bearer <token>.
Code samples
Pick your runtime. Every sample is in the page source — switching tabs is for your eyes.
curl https://agentnumber.really.com/voice/hangup \
--request POST \
--header 'Authorization: Bearer <your-token>' \
--header 'content-type: application/json' \
--data '{
"call_id": "call_example_0000000000000000000000"
}'interface VoiceHangupResponse {
call_id: string;
device_id: string;
status: "hangup_sent";
}
const response = await fetch('https://agentnumber.really.com/voice/hangup', {
method: 'POST',
headers: {
Authorization: 'Bearer <your-token>',
'content-type': 'application/json'
},
body: JSON.stringify({
call_id: 'call_example_0000000000000000000000'
})
});
if (!response.ok) {
throw new Error(`end an active voice call failed: ${response.status}`);
}
const data = (await response.json()) as VoiceHangupResponse;
requests.post(
"https://agentnumber.really.com/voice/hangup",
headers={
"Authorization": "Bearer <your-token>",
"content-type": "application/json"
},
json={
"call_id": "call_example_0000000000000000000000"
}
)package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
requestUrl := "https://agentnumber.really.com/voice/hangup"
payload := strings.NewReader(`{
"call_id": "call_example_0000000000000000000000"
}`)
req, _ := http.NewRequest("POST", requestUrl, payload)
req.Header.Add("Authorization", "Bearer <your-token>")
req.Header.Add("content-type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(res)
fmt.Println(string(body))
}fetch('https://agentnumber.really.com/voice/hangup', {
method: 'POST',
headers: {
Authorization: 'Bearer <your-token>',
'content-type': 'application/json'
},
body: JSON.stringify({
call_id: 'call_example_0000000000000000000000'
})
})import { request } from 'undici'
const { statusCode, body } = await request('https://agentnumber.really.com/voice/hangup', {
method: 'POST',
headers: {
Authorization: 'Bearer <your-token>',
'content-type': 'application/json'
},
body: JSON.stringify({
call_id: 'call_example_0000000000000000000000'
})
})require 'uri'
require 'net/http'
url = URI("https://agentnumber.really.com/voice/hangup")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <your-token>'
request["content-type"] = 'application/json'
request.body = <<~JSON
{
"call_id": "call_example_0000000000000000000000"
}
JSON
response = http.request(request)
puts response.read_bodyimport Foundation
var request = URLRequest(url: URL(string: "https://agentnumber.really.com/voice/hangup")!)
request.httpMethod = "POST"
request.setValue("Bearer <your-token>", forHTTPHeaderField: "Authorization")
request.setValue("application/json", forHTTPHeaderField: "content-type")
let jsonBody = #"""
{
"call_id": "call_example_0000000000000000000000"
}
"""#
request.httpBody = jsonBody.data(using: .utf8)
let (data, response) = try await URLSession.shared.data(for: request)
guard let httpResponse = response as? HTTPURLResponse,
200..<300 ~= httpResponse.statusCode else {
throw URLError(.badServerResponse)
}
print(String(data: data, encoding: .utf8) ?? "")val client = OkHttpClient()
val mediaType = MediaType.parse("application/json")
val body = RequestBody.create(mediaType, "{\n \"call_id\": \"call_example_0000000000000000000000\"\n}")
val request = Request.Builder()
.url("https://agentnumber.really.com/voice/hangup")
.post(body)
.addHeader("Authorization", "Bearer <your-token>")
.addHeader("content-type", "application/json")
.build()
val response = client.newCall(request).execute()POST /voice/hangup HTTP/1.1
Host: agentnumber.really.com
Authorization: Bearer <your-token>
content-type: application/json
Content-Type: application/json
{
"call_id": "call_example_0000000000000000000000"
}HttpRequest request = HttpRequest.newBuilder()
.uri(URI.create("https://agentnumber.really.com/voice/hangup"))
.header("Authorization", "Bearer <your-token>")
.header("content-type", "application/json")
.method("POST", HttpRequest.BodyPublishers.ofString("{\n \"call_id\": \"call_example_0000000000000000000000\"\n}"))
.build();
HttpResponse<String> response = HttpClient.newHttpClient().send(request, HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());#import <Foundation/Foundation.h>
NSDictionary *headers = @{ @"Authorization": @"Bearer <your-token>",
@"content-type": @"application/json" };
NSDictionary *parameters = @{ @"call_id": @"call_example_0000000000000000000000" };
NSData *postData = [NSJSONSerialization dataWithJSONObject:parameters options:0 error:nil];
NSMutableURLRequest *request = [NSMutableURLRequest requestWithURL:[NSURL URLWithString:@"https://agentnumber.really.com/voice/hangup"]
cachePolicy:NSURLRequestUseProtocolCachePolicy
timeoutInterval:10.0];
[request setHTTPMethod:@"POST"];
[request setAllHTTPHeaderFields:headers];
[request setHTTPBody:postData];
NSURLSession *session = [NSURLSession sharedSession];
NSURLSessionDataTask *dataTask = [session dataTaskWithRequest:request
completionHandler:^(NSData *data, NSURLResponse *response, NSError *error) {
if (error) {
NSLog(@"%@", error);
} else {
NSHTTPURLResponse *httpResponse = (NSHTTPURLResponse *) response;
NSLog(@"%@", httpResponse);
}
}];
[dataTask resume];using var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post, "https://agentnumber.really.com/voice/hangup");
request.Headers.Authorization = new AuthenticationHeaderValue("Bearer", "<your-token>");
request.Content = new StringContent(
"""
{
"call_id": "call_example_0000000000000000000000"
}
""",
System.Text.Encoding.UTF8, "application/json");
using var response = await client.SendAsync(request);#include <curl/curl.h>
int main(void) {
curl_global_init(CURL_GLOBAL_DEFAULT);
CURL *curl = curl_easy_init();
if (!curl) {
curl_global_cleanup();
return 1;
}
curl_easy_setopt(curl, CURLOPT_CUSTOMREQUEST, "POST");
curl_easy_setopt(curl, CURLOPT_URL, "https://agentnumber.really.com/voice/hangup");
struct curl_slist *headers = NULL;
headers = curl_slist_append(headers, "Authorization: Bearer <your-token>");
headers = curl_slist_append(headers, "content-type: application/json");
curl_easy_setopt(curl, CURLOPT_HTTPHEADER, headers);
curl_easy_setopt(curl, CURLOPT_POSTFIELDS, "{\n \"call_id\": \"call_example_0000000000000000000000\"\n}");
CURLcode res = curl_easy_perform(curl);
curl_easy_cleanup(curl);
curl_slist_free_all(headers);
curl_global_cleanup();
return (int)res;
}import 'package:http/http.dart' as http;
void main() async {
final headers = <String,String>{
'Authorization': 'Bearer <your-token>',
'content-type': 'application/json',
};
final body = r'{
"call_id": "call_example_0000000000000000000000"
}';
final response = await http.post(Uri.parse('https://agentnumber.really.com/voice/hangup'), headers: headers, body: body);
print(response.body);
}let client = reqwest::Client::new();
let request = client
.post("https://agentnumber.really.com/voice/hangup")
.header("Authorization", "Bearer <your-token>")
.header("content-type", "application/json")
.json(&serde_json::json!({
"call_id": "call_example_0000000000000000000000"
}));
let response = request.send().await?;$ch = curl_init("https://agentnumber.really.com/voice/hangup");
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, ['Authorization: Bearer <your-token>', 'content-type: application/json']);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode([
'call_id' => 'call_example_0000000000000000000000'
]));
curl_exec($ch);
curl_close($ch);Request body
| Field | Type | Description |
|---|---|---|
call_id required |
string |
Server-assigned call id from `/voice/dial` or a presence ringing event. Example: call_example_0000000000000000000000 |
Example body
{
"call_id": "call_example_0000000000000000000000"
}
Responses
200 Hangup dispatched.
{
"call_id": "call_example_0000000000000000000000",
"device_id": "device_example_a",
"status": "hangup_sent"
}
400 Body parse error (`invalid_json`) or missing/invalid `call_id` field (`invalid_request`).
{
"error": "invalid_request",
"message": "call_id must be a non-empty string"
}
401 Missing, invalid, revoked, or expired bearer token.
{
"error": "unauthorized"
}
404 `call_id` doesn't exist or has already ended.
{
"error": "call_not_found",
"call_id": "call_example_0000000000000000000000"
}
502 Hangup dispatched to the Mac phone-node but the phone didn't acknowledge.
{
"error": "phone_node_error",
"call_id": "call_example_0000000000000000000000",
"message": "phone_node returned non-2xx"
}