Skip to main content
DELETE
/
api
/
phone-numbers
/
{phone-number}
curl -X DELETE "https://api.zudu.ai/api/phone-numbers/+14155551234" \
  -H "X-API-KEY: sk_Abc123Def456Ghi789Jkl012Mno345Pqr678Stu901Vwx234Yz" \
  -H "X-API-SECRET: s3cr3t_Xyz789Abc123Def456Ghi789Jkl012Mno345Pqr678Stu901Vwx234" \
{
  "message": "Phone number deleted successfully",
  "status": "success",
  "error": null,
  "data": {
    "phone_number": "+14155551234",
    "organization_id": "org_1234567890",
    "cleanup_results": {
      "dispatch_rule": true,
      "inbound_trunk": true,
      "outbound_trunk": true
    }
}
Permanently delete a phone number from your organization. This endpoint will also attempt to clean up associated LiveKit resources (dispatch rules, inbound trunks, and outbound trunks).
curl -X DELETE "https://api.zudu.ai/api/phone-numbers/+14155551234" \
  -H "X-API-KEY: sk_Abc123Def456Ghi789Jkl012Mno345Pqr678Stu901Vwx234Yz" \
  -H "X-API-SECRET: s3cr3t_Xyz789Abc123Def456Ghi789Jkl012Mno345Pqr678Stu901Vwx234" \
{
  "message": "Phone number deleted successfully",
  "status": "success",
  "error": null,
  "data": {
    "phone_number": "+14155551234",
    "organization_id": "org_1234567890",
    "cleanup_results": {
      "dispatch_rule": true,
      "inbound_trunk": true,
      "outbound_trunk": true
    }
}

Path Parameters

phone-number
string
required
The phone number to delete in E.164 formatExample: +14155551234Note: The phone number should be URL-encoded if it contains special characters (e.g., %2B14155551234 for +14155551234)

Headers

X-API-KEY
string
required
Your API key (format: sk_...)
X-API-SECRET
string
required
Your API secret (format: s3cr3t_...)

Response Fields

phone_number
string
The deleted phone number
organization_id
string
The organization ID
cleanup_results
object
Results of LiveKit resource cleanup
  • dispatch_rule: true if dispatch rule was deleted successfully, false otherwise
  • inbound_trunk: true if inbound trunk was deleted successfully, false otherwise
  • outbound_trunk: true if outbound trunk was deleted successfully, false otherwise
Note: The phone number is always deleted from the database, even if some LiveKit cleanup fails
cleanup_warnings
array
Array of warning messages if any LiveKit resources failed to deleteOnly present if some cleanup operations failedExample: ["Dispatch rule deletion failed: Resource not found", "Inbound trunk deletion failed: Timeout"]

Error Responses

error
string
Unauthorized - Missing or invalid API key/secret
error
string
Not Found - Phone number does not exist
{
  "message": "Phone number not found",
  "status": "error",
  "error": "Phone number '+14155551234' does not exist in organization 'org_1234567890'"
}
error
string
Internal Server Error - Failed to delete phone number
{
  "message": "Failed to delete phone number",
  "status": "error",
  "error": "Database connection failed"
}

Notes

  • This action is permanent and cannot be undone
  • The endpoint attempts to clean up LiveKit resources in this order:
    1. Dispatch rule (must be deleted before trunk)
    2. Inbound trunk
    3. Outbound trunk
  • If LiveKit cleanup fails for some resources, the phone number is still deleted from the database
  • Check cleanup_results and cleanup_warnings in the response to see if manual cleanup is needed
  • Phone numbers should be URL-encoded in the path (e.g., %2B for +)
  • The phone number will be removed from your organization immediately
  • Any agents assigned to this phone number will need to be updated separately