Delete phone number
curl --request DELETE \
--url https://api.nixflex.com/v1/phone-numbers/{phone_number}import requests
url = "https://api.nixflex.com/v1/phone-numbers/{phone_number}"
response = requests.delete(url)
print(response.text)const options = {method: 'DELETE'};
fetch('https://api.nixflex.com/v1/phone-numbers/{phone_number}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nixflex.com/v1/phone-numbers/{phone_number}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.nixflex.com/v1/phone-numbers/{phone_number}"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.nixflex.com/v1/phone-numbers/{phone_number}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nixflex.com/v1/phone-numbers/{phone_number}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_bodyPhone numbers
Delete phone number
DELETE /v1/phone-numbers/:phoneNumber
DELETE
/
v1
/
phone-numbers
/
{phone_number}
Delete phone number
curl --request DELETE \
--url https://api.nixflex.com/v1/phone-numbers/{phone_number}import requests
url = "https://api.nixflex.com/v1/phone-numbers/{phone_number}"
response = requests.delete(url)
print(response.text)const options = {method: 'DELETE'};
fetch('https://api.nixflex.com/v1/phone-numbers/{phone_number}', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.nixflex.com/v1/phone-numbers/{phone_number}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "DELETE",
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.nixflex.com/v1/phone-numbers/{phone_number}"
req, _ := http.NewRequest("DELETE", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.delete("https://api.nixflex.com/v1/phone-numbers/{phone_number}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nixflex.com/v1/phone-numbers/{phone_number}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Delete.new(url)
response = http.request(request)
puts response.read_bodyDisconnects a number from your Nixflex account. Clears the carrier configuration so calls no longer route to the engine - on Twilio the number’s webhooks, on Telnyx the assignment to your TeXML application, then removes the row from our database.
URL-encode the
Two API calls, clean separation — Nixflex stops routing, you handle Twilio billing.
Request
curl -X DELETE https://api.nixflex.com/v1/phone-numbers/+447446466847 \
-H "Authorization: Bearer KEY_ID:KEY_SECRET"
+ if your HTTP client doesn’t do it automatically: %2B447446466847.
Response
200 OK:
{
"phone_number": {
"phone_number": "+447446466847",
"deleted": true
}
}
What this does NOT do
This endpoint does not release the number from your carrier:
- ❌ Number stays in your carrier account
- ❌ Carrier billing continues
- ❌ Number is not cancelled
Reversible
Deleting just clears webhooks and the database row. Re-importing the same number with the same data restores everything. Useful for testing.Errors
| Code | HTTP | Cause |
|---|---|---|
number_not_found | 404 | Number doesn’t exist OR belongs to a different account |
Use case: customer offboarding
// 1. Stop Nixflex from routing calls
await fetch(
`https://api.nixflex.com/v1/phone-numbers/${customerNumber}`,
{
method: 'DELETE',
headers: {
'Authorization': `Bearer ${NIXFLEX_KEY_ID}:${NIXFLEX_KEY_SECRET}`
}
}
);
// 2. Release the number from Twilio (your responsibility)
const twilio = require('twilio')(YOUR_TWILIO_SID, YOUR_TWILIO_TOKEN);
await twilio.incomingPhoneNumbers(numberSid).remove();