Cancelling Calls
HuskyVoice AI allows you to stop pending or scheduled calls before they are answered. This is essential for preventing redundant reach-outs if a customer has already completed an action elsewhere.
- REST API
- Inbound Webhook
1. Using the REST API
Best for programmatic control within your backend.
- Endpoint:
POST https://api.huskyvoice.ai/v1/calls/{call_id}/cancel - Method:
POST
- cURL
- Python
- JavaScript
- n8n
curl -s -X POST https://api.huskyvoice.ai/v1/calls/call_abc_123/cancel \
-H "Authorization: Bearer YOUR_API_KEY"
import requests
call_id = "call_abc_123"
url = f"https://api.huskyvoice.ai/v1/calls/{call_id}/cancel"
headers = {"Authorization": "Bearer YOUR_API_KEY"}
response = requests.post(url, headers=headers)
if response.status_code == 200:
print("Call successfully cancelled")
const callId = "call_abc_123";
const response = await fetch(
`https://api.huskyvoice.ai/v1/calls/${callId}/cancel`,
{
method: "POST",
headers: { "Authorization": "Bearer YOUR_API_KEY" }
}
);
if (response.ok) {
console.log("Call successfully cancelled");
}
Create an HTTP Header Auth credential in n8n: set Name to Authorization and Value to Bearer YOUR_API_KEY. Select it in the HTTP Request node's Authentication field.
{
"name": "HuskyVoice – Cancel Call",
"nodes": [
{
"parameters": {
"method": "POST",
"url": "https://api.huskyvoice.ai/v1/calls/call_abc_123/cancel",
"authentication": "genericCredentialType",
"genericAuthType": "httpHeaderAuth"
},
"id": "1",
"name": "Cancel Call",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [250, 300]
}
],
"connections": {},
"settings": {},
"meta": { "instanceId": "huskyvoice-docs" }
}
Sample Response:
{
"success": true,
"call_id": "call_abc_123",
"status": "cancelled",
"message": "Call has been successfully cancelled."
}
2. Using Inbound Webhooks
Ideal for trigger-based cancellations from CRMs (e.g., HubSpot, Salesforce).
- Endpoint:
https://api.huskyvoice.ai/v1/hooks/{YOUR_SECRET_TOKEN} - Method:
POST
- cURL
- Python
- JavaScript
- n8n
curl -X POST https://api.huskyvoice.ai/v1/hooks/YOUR_SECRET_TOKEN \
-H "Content-Type: application/json" \
-d '{
"action": "call.cancel",
"data": {
"call_id": "call_abc_789"
}
}'
import requests
url = "https://api.huskyvoice.ai/v1/hooks/YOUR_SECRET_TOKEN"
payload = {
"action": "call.cancel",
"data": {"call_id": "call_abc_789"}
}
response = requests.post(url, json=payload)
print(response.json())
const response = await fetch(
"https://api.huskyvoice.ai/v1/hooks/YOUR_SECRET_TOKEN",
{
method: "POST",
headers: { "Content-Type": "application/json" },
body: JSON.stringify({
action: "call.cancel",
data: { call_id: "call_abc_789" }
})
}
);
const data = await response.json();
console.log(data);
Authentication uses the secret token embedded in the URL. No separate credential setup is required in n8n.
{
"name": "HuskyVoice – Cancel Call via Webhook",
"nodes": [
{
"parameters": {
"method": "POST",
"url": "https://api.huskyvoice.ai/v1/hooks/YOUR_SECRET_TOKEN",
"sendBody": true,
"specifyBody": "json",
"jsonBody": "{\n \"action\": \"call.cancel\",\n \"data\": {\n \"call_id\": \"call_abc_789\"\n }\n}"
},
"id": "1",
"name": "Cancel Call",
"type": "n8n-nodes-base.httpRequest",
"typeVersion": 4.2,
"position": [250, 300]
}
],
"connections": {},
"settings": {},
"meta": { "instanceId": "huskyvoice-docs" }
}
Important Constraints
A call progresses through these states in order:
queued → initiated → ringing → in_progress
✅ Cancellation is only possible at the queued stage.
❌ Once a call moves past queued, it cannot be stopped via the cancel endpoint.
- Timing: You can only cancel calls that are in the
queuedstate. - Active Calls: Once a call moves to
initiated,ringing, orin_progress, it cannot be cancelled via these endpoints. - Idempotency: Repeatedly sending a cancel request for the same
call_idis safe and will not cause errors.