curl --request DELETE \
--url "https://api.nixflex.com/v1/calls/call_example" \
--header "Authorization: Bearer $NIXFLEX_API_KEY"
const response = await fetch("https://api.nixflex.com/v1/calls/call_example", {
method: 'DELETE', redirect: 'error', signal: AbortSignal.timeout(30_000),
headers: {Authorization: `Bearer ${process.env.NIXFLEX_API_KEY}`},
});
const result = await response.json();
if (!response.ok && result.error?.code !== 'hangup_pending') {
throw new Error(`HTTP ${response.status}: ${result.error?.code || 'unknown'}`);
}
// A queued reply is not deletion success. Show the returned state privately.
const deleted = response.ok && result.deleted === true;
import json, os
from urllib.error import HTTPError
from urllib.request import HTTPRedirectHandler, Request, build_opener
class NoRedirect(HTTPRedirectHandler):
def redirect_request(self, req, fp, code, msg, headers, newurl):
return None
opener = build_opener(NoRedirect())
request = Request("https://api.nixflex.com/v1/calls/call_example", method="DELETE",
headers={"Authorization": "Bearer " + os.environ["NIXFLEX_API_KEY"]})
try:
with opener.open(request, timeout=30) as response:
result = json.load(response)
deleted = result.get("deleted") is True
except HTTPError as error:
result = json.load(error)
deleted = False
if result.get("error", {}).get("code") != "hangup_pending":
raise
# Keep result private. Queued hang-up continues without a polling write loop.
$headers = @{ Authorization = "Bearer $env:NIXFLEX_API_KEY" }
$deleted = $false
try {
$result = Invoke-RestMethod -Method DELETE -Uri "https://api.nixflex.com/v1/calls/call_example" -Headers $headers -MaximumRedirection 0 -TimeoutSec 30
$deleted = $result.deleted -eq $true
} catch {
# A 503 is not completed deletion. Read the safe error response privately.
# hangup_pending continues automatically; do not start a write polling loop.
throw
}
# Use $result privately. Only $deleted confirms content removal.
import Nixflex, { NixflexServerError } from 'nixflex';
const apiKey = process.env.NIXFLEX_API_KEY;
const baseUrl = 'https://api.nixflex.com';
const resourceId = process.env.NXF_CALL_ID;
if (!apiKey || !baseUrl || !resourceId) throw new Error('Configure the account, host and approved resource ID.');
const client = new Nixflex({apiKey, baseUrl, maxRetries: 0});
try {
const receipt = await client.calls.delete(resourceId);
if (receipt.deleted !== true || receipt.call_id !== resourceId || typeof receipt.recording_deleted !== 'boolean' ||
!['carrier_best_effort', 'queued'].includes(receipt.recording_cleanup)) {
throw new Error('Deletion is not confirmed.');
}
console.log('Content deletion confirmed; recording and history rules still apply.');
} catch (error) {
if (error instanceof NixflexServerError && error.status === 503 &&
error.code === 'hangup_pending' && error.details?.deleted === false &&
error.details?.retry_pending === true) {
console.log('Deletion queued; the server continues after hang-up.');
} else {
// Keep the error private. Reconcile an unknown result before a deliberate repeat.
throw error;
}
}
import os
from nixflex import Nixflex
from nixflex.errors import NixflexServerError
with Nixflex(api_key=os.environ["NIXFLEX_API_KEY"],
base_url="https://api.nixflex.com", max_retries=0) as client:
try:
receipt = client.calls.delete(os.environ["NXF_CALL_ID"])
if (receipt.get("deleted") is not True
or receipt.get("call_id") != os.environ["NXF_CALL_ID"]
or not isinstance(receipt.get("recording_deleted"), bool)
or receipt.get("recording_cleanup") not in ("carrier_best_effort", "queued")):
raise RuntimeError("Deletion is not confirmed.")
print("Content deletion confirmed; recording and history rules still apply.")
except NixflexServerError as error:
if (error.status == 503 and error.code == "hangup_pending"
and error.details.get("deleted") is False
and error.details.get("retry_pending") is True):
print("Deletion queued; the server continues after hang-up.")
else:
raise # Keep private; reconcile an unknown result before a deliberate repeat.
nixflex calls delete "$NXF_CALL_ID" --confirm --json --base-url "https://api.nixflex.com"
{
"name": "delete_call",
"arguments": {
"call_id": "call_fixture",
"confirm": true
}
}
{
"call_id": "call_example",
"deleted": true,
"recording_deleted": false,
"recording_cleanup": "queued"
}
{
"error": {
"type": "server_error",
"code": "hangup_pending",
"message": "The call has not confirmed it ended yet. Deletion is queued and will finish once hang-up is confirmed.",
"doc_url": "https://docs.nixflex.com/errors/hangup_pending",
"details": {
"deleted": false,
"retry_pending": true
}
}
}
Calls
Delete a call
Hang up and delete an owned call, track recording cleanup and safely resume queued deletion while retaining used charges.
DELETE
/
calls
/
{id}
curl --request DELETE \
--url "https://api.nixflex.com/v1/calls/call_example" \
--header "Authorization: Bearer $NIXFLEX_API_KEY"
const response = await fetch("https://api.nixflex.com/v1/calls/call_example", {
method: 'DELETE', redirect: 'error', signal: AbortSignal.timeout(30_000),
headers: {Authorization: `Bearer ${process.env.NIXFLEX_API_KEY}`},
});
const result = await response.json();
if (!response.ok && result.error?.code !== 'hangup_pending') {
throw new Error(`HTTP ${response.status}: ${result.error?.code || 'unknown'}`);
}
// A queued reply is not deletion success. Show the returned state privately.
const deleted = response.ok && result.deleted === true;
import json, os
from urllib.error import HTTPError
from urllib.request import HTTPRedirectHandler, Request, build_opener
class NoRedirect(HTTPRedirectHandler):
def redirect_request(self, req, fp, code, msg, headers, newurl):
return None
opener = build_opener(NoRedirect())
request = Request("https://api.nixflex.com/v1/calls/call_example", method="DELETE",
headers={"Authorization": "Bearer " + os.environ["NIXFLEX_API_KEY"]})
try:
with opener.open(request, timeout=30) as response:
result = json.load(response)
deleted = result.get("deleted") is True
except HTTPError as error:
result = json.load(error)
deleted = False
if result.get("error", {}).get("code") != "hangup_pending":
raise
# Keep result private. Queued hang-up continues without a polling write loop.
$headers = @{ Authorization = "Bearer $env:NIXFLEX_API_KEY" }
$deleted = $false
try {
$result = Invoke-RestMethod -Method DELETE -Uri "https://api.nixflex.com/v1/calls/call_example" -Headers $headers -MaximumRedirection 0 -TimeoutSec 30
$deleted = $result.deleted -eq $true
} catch {
# A 503 is not completed deletion. Read the safe error response privately.
# hangup_pending continues automatically; do not start a write polling loop.
throw
}
# Use $result privately. Only $deleted confirms content removal.
import Nixflex, { NixflexServerError } from 'nixflex';
const apiKey = process.env.NIXFLEX_API_KEY;
const baseUrl = 'https://api.nixflex.com';
const resourceId = process.env.NXF_CALL_ID;
if (!apiKey || !baseUrl || !resourceId) throw new Error('Configure the account, host and approved resource ID.');
const client = new Nixflex({apiKey, baseUrl, maxRetries: 0});
try {
const receipt = await client.calls.delete(resourceId);
if (receipt.deleted !== true || receipt.call_id !== resourceId || typeof receipt.recording_deleted !== 'boolean' ||
!['carrier_best_effort', 'queued'].includes(receipt.recording_cleanup)) {
throw new Error('Deletion is not confirmed.');
}
console.log('Content deletion confirmed; recording and history rules still apply.');
} catch (error) {
if (error instanceof NixflexServerError && error.status === 503 &&
error.code === 'hangup_pending' && error.details?.deleted === false &&
error.details?.retry_pending === true) {
console.log('Deletion queued; the server continues after hang-up.');
} else {
// Keep the error private. Reconcile an unknown result before a deliberate repeat.
throw error;
}
}
import os
from nixflex import Nixflex
from nixflex.errors import NixflexServerError
with Nixflex(api_key=os.environ["NIXFLEX_API_KEY"],
base_url="https://api.nixflex.com", max_retries=0) as client:
try:
receipt = client.calls.delete(os.environ["NXF_CALL_ID"])
if (receipt.get("deleted") is not True
or receipt.get("call_id") != os.environ["NXF_CALL_ID"]
or not isinstance(receipt.get("recording_deleted"), bool)
or receipt.get("recording_cleanup") not in ("carrier_best_effort", "queued")):
raise RuntimeError("Deletion is not confirmed.")
print("Content deletion confirmed; recording and history rules still apply.")
except NixflexServerError as error:
if (error.status == 503 and error.code == "hangup_pending"
and error.details.get("deleted") is False
and error.details.get("retry_pending") is True):
print("Deletion queued; the server continues after hang-up.")
else:
raise # Keep private; reconcile an unknown result before a deliberate repeat.
nixflex calls delete "$NXF_CALL_ID" --confirm --json --base-url "https://api.nixflex.com"
{
"name": "delete_call",
"arguments": {
"call_id": "call_fixture",
"confirm": true
}
}
{
"call_id": "call_example",
"deleted": true,
"recording_deleted": false,
"recording_cleanup": "queued"
}
{
"error": {
"type": "server_error",
"code": "hangup_pending",
"message": "The call has not confirmed it ended yet. Deletion is queued and will finish once hang-up is confirmed.",
"doc_url": "https://docs.nixflex.com/errors/hangup_pending",
"details": {
"deleted": false,
"retry_pending": true
}
}
}
FIXED · account
Do not send a request body. Review the ID and effect before sending; completed content removal cannot be undone.
Deleting one call hangs it up first if it is still running, then removes its content. An Owner or Admin can delete; a Member cannot. A confirmed content deletion can still have queued recording cleanup. Nixflex recording cleanup does not certify carrier erasure or remove customer-managed copies. Used charges and required financial records remain, with no refund.
The 503 flags are inside
DELETE /v1/calls covers the owning account’s calls and related recordings. It takes no number or campaign filter. Its result reports sms_deleted=0.
NOT OFFERED → do this instead · number There is no bulk erase for just one customer’s number in a shared account. Resolve and verify each tenant-owned call ID, then use single-call deletion.
YOU CAN CHANGE · agent New agents inherit account retention on creation. Use the agent update to change its saved call-retention policy.
SCOPE · call Read availability first. Stored links expire. Distinguish pending, expired, unavailable and customer storage.
Read the compact AI rules
Deleting one call hangs it up first if it is still running, then removes its content.
Method: DELETE ·
Success: 200 ·
Permission: Owner or Admin
The important part
- Running calls are hung up before content deletion.
- A queued hang-up is not a completed delete; the same request safely resumes it.
- Used charges remain. Customer-managed copies have their own lifecycle.
Authentication
Use the owning account’s server-side credential inAuthorization: Bearer KEY_ID:KEY_SECRET. An organisation API key has Owner authority. Personal dashboard sessions need Owner or Admin authority; Members receive 403.
Request fields
| Field | Type | Required | Limits |
|---|---|---|---|
id (path) | string | Yes | 1–200 characters; the exact owned identifier. |
Response fields
HTTP 200 confirms content deletion. It does not erase billing or every external copy.| Field | Type | Meaning |
|---|---|---|
call_id | string | The requested owned call ID. |
deleted | boolean | True: call content is removed after confirmed hang-up. |
recording_deleted | boolean | True when the Nixflex copy is confirmed absent; false while its cleanup is queued. |
recording_cleanup | string | queued or carrier_best_effort. Carrier cleanup remains best effort even when our copy is gone. |
Example request
This request changes the selected resource. SetNIXFLEX_API_KEY privately for the same account and host; use an owned identifier. The examples send once.
The SDK/CLI tabs use the exact supported clients. Configure NIXFLEX_API_KEY and NXF_CALL_ID privately. Raw HTTP base URL: https://api.nixflex.com/v1. Node and Python SDK base URL: https://api.nixflex.com. The SDK adds /v1. Configure MCP with the same origin and account. SDKs preserve the known queued error; other uncertain errors use outcome_unknown with the server code in details.original_code.
curl --request DELETE \
--url "https://api.nixflex.com/v1/calls/call_example" \
--header "Authorization: Bearer $NIXFLEX_API_KEY"
const response = await fetch("https://api.nixflex.com/v1/calls/call_example", {
method: 'DELETE', redirect: 'error', signal: AbortSignal.timeout(30_000),
headers: {Authorization: `Bearer ${process.env.NIXFLEX_API_KEY}`},
});
const result = await response.json();
if (!response.ok && result.error?.code !== 'hangup_pending') {
throw new Error(`HTTP ${response.status}: ${result.error?.code || 'unknown'}`);
}
// A queued reply is not deletion success. Show the returned state privately.
const deleted = response.ok && result.deleted === true;
import json, os
from urllib.error import HTTPError
from urllib.request import HTTPRedirectHandler, Request, build_opener
class NoRedirect(HTTPRedirectHandler):
def redirect_request(self, req, fp, code, msg, headers, newurl):
return None
opener = build_opener(NoRedirect())
request = Request("https://api.nixflex.com/v1/calls/call_example", method="DELETE",
headers={"Authorization": "Bearer " + os.environ["NIXFLEX_API_KEY"]})
try:
with opener.open(request, timeout=30) as response:
result = json.load(response)
deleted = result.get("deleted") is True
except HTTPError as error:
result = json.load(error)
deleted = False
if result.get("error", {}).get("code") != "hangup_pending":
raise
# Keep result private. Queued hang-up continues without a polling write loop.
$headers = @{ Authorization = "Bearer $env:NIXFLEX_API_KEY" }
$deleted = $false
try {
$result = Invoke-RestMethod -Method DELETE -Uri "https://api.nixflex.com/v1/calls/call_example" -Headers $headers -MaximumRedirection 0 -TimeoutSec 30
$deleted = $result.deleted -eq $true
} catch {
# A 503 is not completed deletion. Read the safe error response privately.
# hangup_pending continues automatically; do not start a write polling loop.
throw
}
# Use $result privately. Only $deleted confirms content removal.
import Nixflex, { NixflexServerError } from 'nixflex';
const apiKey = process.env.NIXFLEX_API_KEY;
const baseUrl = 'https://api.nixflex.com';
const resourceId = process.env.NXF_CALL_ID;
if (!apiKey || !baseUrl || !resourceId) throw new Error('Configure the account, host and approved resource ID.');
const client = new Nixflex({apiKey, baseUrl, maxRetries: 0});
try {
const receipt = await client.calls.delete(resourceId);
if (receipt.deleted !== true || receipt.call_id !== resourceId || typeof receipt.recording_deleted !== 'boolean' ||
!['carrier_best_effort', 'queued'].includes(receipt.recording_cleanup)) {
throw new Error('Deletion is not confirmed.');
}
console.log('Content deletion confirmed; recording and history rules still apply.');
} catch (error) {
if (error instanceof NixflexServerError && error.status === 503 &&
error.code === 'hangup_pending' && error.details?.deleted === false &&
error.details?.retry_pending === true) {
console.log('Deletion queued; the server continues after hang-up.');
} else {
// Keep the error private. Reconcile an unknown result before a deliberate repeat.
throw error;
}
}
import os
from nixflex import Nixflex
from nixflex.errors import NixflexServerError
with Nixflex(api_key=os.environ["NIXFLEX_API_KEY"],
base_url="https://api.nixflex.com", max_retries=0) as client:
try:
receipt = client.calls.delete(os.environ["NXF_CALL_ID"])
if (receipt.get("deleted") is not True
or receipt.get("call_id") != os.environ["NXF_CALL_ID"]
or not isinstance(receipt.get("recording_deleted"), bool)
or receipt.get("recording_cleanup") not in ("carrier_best_effort", "queued")):
raise RuntimeError("Deletion is not confirmed.")
print("Content deletion confirmed; recording and history rules still apply.")
except NixflexServerError as error:
if (error.status == 503 and error.code == "hangup_pending"
and error.details.get("deleted") is False
and error.details.get("retry_pending") is True):
print("Deletion queued; the server continues after hang-up.")
else:
raise # Keep private; reconcile an unknown result before a deliberate repeat.
nixflex calls delete "$NXF_CALL_ID" --confirm --json --base-url "https://api.nixflex.com"
{
"name": "delete_call",
"arguments": {
"call_id": "call_fixture",
"confirm": true
}
}
Example response
{
"call_id": "call_example",
"deleted": true,
"recording_deleted": false,
"recording_cleanup": "queued"
}
{
"error": {
"type": "server_error",
"code": "hangup_pending",
"message": "The call has not confirmed it ended yet. Deletion is queued and will finish once hang-up is confirmed.",
"doc_url": "https://docs.nixflex.com/errors/hangup_pending",
"details": {
"deleted": false,
"retry_pending": true
}
}
}
Errors
| Status / code | Meaning | What to do |
|---|---|---|
400 invalid_delete | Invalid identifier length. | Use the exact owned ID, from 1 to 200 characters. |
| 401 | Missing or invalid authentication. | Check the credential and host privately. |
403 permission_denied | The personal session cannot delete. | Ask an Owner or Admin; never give a Member the account key as a workaround. |
404 not_found | The item is missing or belongs to another account. | Check the saved ID and account. Do not infer another account’s data. |
| 429 | Rate limited. | Honour Retry-After and avoid a polling write loop. |
503 hangup_pending | Hang-up is unconfirmed; deletion is queued. | Show queued, not deleted. The worker continues automatically; the same DELETE safely resumes it. |
503 deletion_unavailable | Deletion could not be confirmed. | Check the list and repeat the same DELETE if needed; an existing request safely resumes. |
error.details, not at the response root. hangup_pending includes deleted:false and retry_pending:true; deletion_unavailable includes deleted:false without promising that a queue exists.
Retry and idempotency
If hang-up is not confirmed, HTTP 503hangup_pending returns error.details.deleted:false and error.details.retry_pending:true. Deletion stays queued and continues automatically. Repeating the same DELETE for the same account and ID safely resumes it. A lost response or deletion_unavailable is not success: check the list, then repeat that same DELETE if needed. Missing and foreign IDs share HTTP 404. Bulk call deletion and account closure keep separate safety rules.
Use bounded reads to refresh the list. Do not treat the generic write-retry rule for call creation or SMS sending as the deletion rule: this same-ID DELETE can be repeated deliberately to resume cleanup. It does not require an Idempotency-Key header.
Related endpoints
Authorizations
Path Parameters
Response
Call content deleted. Recording cleanup has its own explicit state.