curl -X POST https://api.magpipe.ai/functions/v1/terminate-call \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"call_id": "7f3d8e00-a1b2-4c3d-9e4f-567890abcdef"}'
const response = await fetch(
'https://api.magpipe.ai/functions/v1/terminate-call',
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
call_id: '7f3d8e00-a1b2-4c3d-9e4f-567890abcdef'
}),
}
);
const result = await response.json();
console.log('Call ended:', result.success);
import requests
response = requests.post(
'https://api.magpipe.ai/functions/v1/terminate-call',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
json={'call_id': '7f3d8e00-a1b2-4c3d-9e4f-567890abcdef'}
)
result = response.json()
print(f"Call ended: {result['success']}")
{
"success": true
}
{
"error": {
"code": "call_not_found",
"message": "Call not found or already ended"
}
}
Calls
End Call
Terminate an active call
POST
/
terminate-call
curl -X POST https://api.magpipe.ai/functions/v1/terminate-call \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"call_id": "7f3d8e00-a1b2-4c3d-9e4f-567890abcdef"}'
const response = await fetch(
'https://api.magpipe.ai/functions/v1/terminate-call',
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
call_id: '7f3d8e00-a1b2-4c3d-9e4f-567890abcdef'
}),
}
);
const result = await response.json();
console.log('Call ended:', result.success);
import requests
response = requests.post(
'https://api.magpipe.ai/functions/v1/terminate-call',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
json={'call_id': '7f3d8e00-a1b2-4c3d-9e4f-567890abcdef'}
)
result = response.json()
print(f"Call ended: {result['success']}")
{
"success": true
}
{
"error": {
"code": "call_not_found",
"message": "Call not found or already ended"
}
}
End an in-progress call immediately. Use this when you need to programmatically hang up a call.
Request Body
string
required
The unique identifier of the call to terminate.
Response
boolean
Whether the call was terminated successfully.
curl -X POST https://api.magpipe.ai/functions/v1/terminate-call \
-H "Authorization: Bearer YOUR_API_KEY" \
-H "Content-Type: application/json" \
-d '{"call_id": "7f3d8e00-a1b2-4c3d-9e4f-567890abcdef"}'
const response = await fetch(
'https://api.magpipe.ai/functions/v1/terminate-call',
{
method: 'POST',
headers: {
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
body: JSON.stringify({
call_id: '7f3d8e00-a1b2-4c3d-9e4f-567890abcdef'
}),
}
);
const result = await response.json();
console.log('Call ended:', result.success);
import requests
response = requests.post(
'https://api.magpipe.ai/functions/v1/terminate-call',
headers={
'Authorization': 'Bearer YOUR_API_KEY',
'Content-Type': 'application/json',
},
json={'call_id': '7f3d8e00-a1b2-4c3d-9e4f-567890abcdef'}
)
result = response.json()
print(f"Call ended: {result['success']}")
{
"success": true
}
{
"error": {
"code": "call_not_found",
"message": "Call not found or already ended"
}
}
⌘I