Import phone number
curl --request POST \
--url https://api.nixflex.com/v1/phone-numbersimport requests
url = "https://api.nixflex.com/v1/phone-numbers"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.nixflex.com/v1/phone-numbers', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$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"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.nixflex.com/v1/phone-numbers")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nixflex.com/v1/phone-numbers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyPhone numbers
Import phone number
POST /v1/phone-numbers
POST
/
v1
/
phone-numbers
Import phone number
curl --request POST \
--url https://api.nixflex.com/v1/phone-numbersimport requests
url = "https://api.nixflex.com/v1/phone-numbers"
response = requests.post(url)
print(response.text)const options = {method: 'POST'};
fetch('https://api.nixflex.com/v1/phone-numbers', 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",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
]);
$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"
req, _ := http.NewRequest("POST", url, nil)
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.nixflex.com/v1/phone-numbers")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.nixflex.com/v1/phone-numbers")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
response = http.request(request)
puts response.read_bodyAttaches a phone number you already own to one of your agents. Nixflex supports Twilio and Telnyx.
You do not choose the carrier with a field — it is inferred from the credentials you send. Send Twilio credentials and the number is imported as a Twilio number; send a Telnyx API key and it is imported as a Telnyx number.
Nixflex points the number’s voice, SMS and status webhooks at the engine for you.
What Telnyx numbers support today
A Telnyx import returns
Twilio
Telnyx
Existing integrations need no changes. If you only ever send
twilio_sid and
twilio_token, nothing about this endpoint has changed for you.Twilio
curl -X POST https://api.nixflex.com/v1/phone-numbers \
-H "Authorization: Bearer KEY_ID:KEY_SECRET" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "+447446466847",
"twilio_sid": "ACxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"twilio_token": "your_twilio_auth_token",
"agent_id": "agent_125207e452f8714a"
}'
| Field | Type | Required | Notes |
|---|---|---|---|
phone_number | string | Yes | E.164 format (+44...). Must already exist in your Twilio account |
twilio_sid | string | Yes | Your Twilio Account SID, format AC + 32 hex characters |
twilio_token | string | Yes | Your Twilio Auth Token |
agent_id | string | Yes | Must be an agent you own |
custom_prompt | string | No | Per-number prompt override. Max 8000 characters |
Importing replaces the existing webhooks on the Twilio number. If another
system uses this number, it will stop receiving calls and SMS.
Telnyx
Telnyx works differently, and the difference matters. On Twilio, the webhook URL lives on the number. On Telnyx, the webhook lives on a TeXML Application, and numbers are assigned to that application. Nixflex never creates the application — you create it once in your Telnyx portal, then every number you assign to it is handled by Nixflex.1
Create a TeXML Application in your Telnyx portal
Set its voice webhook URL to
https://api.nixflex.com/telnyx-voice, method POST, webhook API version 2. Copy the application’s ID — that is your telnyx_connection_id.2
Check the codec settings
Enable G711U. Turn G722 / HD Voice off. The engine speaks mu-law only; a call that negotiates another codec will connect but carry no usable audio.
3
Import the number
Nixflex assigns the number to your TeXML application for you.
curl -X POST https://api.nixflex.com/v1/phone-numbers \
-H "Authorization: Bearer KEY_ID:KEY_SECRET" \
-H "Content-Type: application/json" \
-d '{
"phone_number": "+443301901028",
"telnyx_api_key": "KEY0123456789...",
"telnyx_connection_id": "2512345678901234567",
"agent_id": "agent_125207e452f8714a"
}'
| Field | Type | Required | Notes |
|---|---|---|---|
phone_number | string | Yes | E.164 format. Must already exist in your Telnyx account |
telnyx_api_key | string | Yes | A Telnyx API key with access to the number |
telnyx_connection_id | string | Yes | The ID of your TeXML Application |
agent_id | string | Yes | Must be an agent you own |
custom_prompt | string | No | Per-number prompt override. Max 8000 characters |
camelCase works everywhere too:
phoneNumber, twilioSid, twilioToken,
telnyxApiKey, telnyxConnectionId, agentId, customPrompt.| Status | |
|---|---|
| Inbound calls | Yes |
| Recording | Yes |
| Cold and warm transfer | Yes |
| Concurrency limits | Yes |
| Booking, custom functions, analysis, webhooks | Yes |
| Live Monitor | Yes |
| Inbound SMS and auto-reply | Yes |
| Sending SMS | Yes |
| SMS delivery status | Yes |
| SMS campaigns | Yes |
| Outbound calls | Yes |
| Outbound recording | Yes |
| Keypad input (DTMF) | Yes |
| Carrier voicemail detection (AMD) | Yes |
Telnyx numbers support the same feature set as Twilio numbers, including SMS campaigns
and delivery receipts. You do not need to pick a carrier based on features - pick on
price, coverage, and whichever account you already have.
Response
201 Created:
{
"phone_number": {
"phone_number": "+447446466847",
"agent_id": "agent_125207e452f8714a",
"provider": "twilio",
"twilio_number_sid": "PN451e0ddf654327e36baab58dfbcd30d6",
"inbound_enabled": true,
"outbound_enabled": true
}
}
"provider": "telnyx" and telnyx_number_id instead of twilio_number_sid.
Errors
Both carriers| Code | HTTP | Cause |
|---|---|---|
missing_field | 400 | A required field is empty |
invalid_phone_format | 400 | Not E.164 format |
custom_prompt_too_long | 400 | Over 8000 characters |
agent_not_found | 404 | agent_id does not exist |
agent_not_owned | 403 | The agent belongs to a different API key |
number_already_imported | 409 | Already attached to an agent |
| Code | HTTP | Cause |
|---|---|---|
invalid_twilio_sid | 400 | SID does not match AC + 32 hex |
twilio_invalid_credentials | 401 | SID and token rejected by Twilio |
twilio_auth_failed | 401 | Twilio authentication error |
number_not_in_twilio | 404 | Number not in your Twilio account |
| Code | HTTP | Cause |
|---|---|---|
telnyx_invalid_credentials | 401 | API key rejected by Telnyx |
number_not_in_telnyx | 404 | Number not in your Telnyx account |
telnyx_assign_failed | 400 | Could not assign the number to that TeXML application — check the ID |
telnyx_error | 500 | Telnyx returned an unexpected error |
Use case: reseller onboarding
// 1. Buy a number from your Twilio account
const twilio = require('twilio')(YOUR_TWILIO_SID, YOUR_TWILIO_TOKEN);
const available = await twilio.availablePhoneNumbers('GB').local.list({ limit: 1 });
const purchased = await twilio.incomingPhoneNumbers.create({
phoneNumber: available[0].phoneNumber
});
// 2. Attach it to your Nixflex agent
await fetch('https://api.nixflex.com/v1/phone-numbers', {
method: 'POST',
headers: {
'Authorization': `Bearer ${NIXFLEX_KEY_ID}:${NIXFLEX_KEY_SECRET}`,
'Content-Type': 'application/json'
},
body: JSON.stringify({
phone_number: purchased.phoneNumber,
twilio_sid: YOUR_TWILIO_SID,
twilio_token: YOUR_TWILIO_TOKEN,
agent_id: 'agent_your_template'
})
});