curl --request POST \
--url 'https://api.nixflex.com/v1/phone-numbers/%2B12025550123/credentials' \
--header "Authorization: Bearer $NIXFLEX_API_KEY" \
--header 'Content-Type: application/json' \
--data '{"twilio_sid":"AC00000000000000000000000000000000","twilio_token":"REPLACE_PRIVATELY"}'
const response = await fetch('https://api.nixflex.com/v1/phone-numbers/%2B12025550123/credentials', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.NIXFLEX_API_KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({"twilio_sid":"AC00000000000000000000000000000000","twilio_token":"REPLACE_PRIVATELY"}),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const result = await response.json();
// Handle the private result without logging it.
import os, json
from urllib.request import Request, urlopen
request = Request('https://api.nixflex.com/v1/phone-numbers/%2B12025550123/credentials', method='POST',
headers={'Authorization': 'Bearer ' + os.environ['NIXFLEX_API_KEY'], 'Content-Type': 'application/json'},
data="{\"twilio_sid\":\"AC00000000000000000000000000000000\",\"twilio_token\":\"REPLACE_PRIVATELY\"}".encode("utf-8"))
with urlopen(request, timeout=30) as response:
result = json.load(response)
# Handle the private result without logging it.
$headers = @{ Authorization = "Bearer $env:NIXFLEX_API_KEY" }
$body = '{"twilio_sid":"AC00000000000000000000000000000000","twilio_token":"REPLACE_PRIVATELY"}'
$result = Invoke-RestMethod -Method POST -Uri 'https://api.nixflex.com/v1/phone-numbers/%2B12025550123/credentials' -Headers $headers -DisableKeepAlive -ContentType "application/json" -Body ([Text.Encoding]::UTF8.GetBytes($body))
# Handle $result privately.
{
"phone_number": "+12025550123",
"provider": "twilio",
"updated": true
}
Phone numbers
Update phone number credentials
Update carrier credentials for an imported Nixflex phone number in place. Preserve settings and handle uncertain routing or credential saves safely.
POST
/
phone-numbers
/
{phoneNumber}
/
credentials
curl --request POST \
--url 'https://api.nixflex.com/v1/phone-numbers/%2B12025550123/credentials' \
--header "Authorization: Bearer $NIXFLEX_API_KEY" \
--header 'Content-Type: application/json' \
--data '{"twilio_sid":"AC00000000000000000000000000000000","twilio_token":"REPLACE_PRIVATELY"}'
const response = await fetch('https://api.nixflex.com/v1/phone-numbers/%2B12025550123/credentials', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.NIXFLEX_API_KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({"twilio_sid":"AC00000000000000000000000000000000","twilio_token":"REPLACE_PRIVATELY"}),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const result = await response.json();
// Handle the private result without logging it.
import os, json
from urllib.request import Request, urlopen
request = Request('https://api.nixflex.com/v1/phone-numbers/%2B12025550123/credentials', method='POST',
headers={'Authorization': 'Bearer ' + os.environ['NIXFLEX_API_KEY'], 'Content-Type': 'application/json'},
data="{\"twilio_sid\":\"AC00000000000000000000000000000000\",\"twilio_token\":\"REPLACE_PRIVATELY\"}".encode("utf-8"))
with urlopen(request, timeout=30) as response:
result = json.load(response)
# Handle the private result without logging it.
$headers = @{ Authorization = "Bearer $env:NIXFLEX_API_KEY" }
$body = '{"twilio_sid":"AC00000000000000000000000000000000","twilio_token":"REPLACE_PRIVATELY"}'
$result = Invoke-RestMethod -Method POST -Uri 'https://api.nixflex.com/v1/phone-numbers/%2B12025550123/credentials' -Headers $headers -DisableKeepAlive -ContentType "application/json" -Body ([Text.Encoding]::UTF8.GetBytes($body))
# Handle $result privately.
{
"phone_number": "+12025550123",
"provider": "twilio",
"updated": true
}
FIXED · account A number belongs to an account and agent. On a shared agent always pass that customer’s eligible from_number.
NOT OFFERED → do this instead · number Fixed welcome_message, language, general timezone and pickup delay belong to the agent. Use Dynamic greeting and the number’s custom_prompt for its opening. Split agents for different fixed settings.
YOU CAN CHANGE · number PATCH fields below. Clearing depends on the field. Null record_call or require_booking_confirmation inherits. Use the number’s voicemail controls.
Choose exactly one carrier pair (option 1).
Choose exactly one carrier pair (option 2).
Send exactly the credential pair for the number’s existing carrier. Twilio uses
The response confirms the owned number and carrier. No credential or resource snapshot is returned.
calcom_timezone_override, custom_prompt, voice_id, sms_reply_enabled, sms_prompt, web_prompt, speaking_rate, dtmf_enabled, require_booking_confirmation, record_call, recording_source, voicemail_leave_enabled, voicemail_message.
SCOPE · number Import an owned carrier number, assign an agent, edit its channels or remove its Nixflex connection.
For a different greeting per business, keep Dynamic greeting on (the default) and put the opening line in that number’s custom_prompt. For example, “Start every call with: Thank you for calling Oak and Stone”.
Read the compact AI rules
Update carrier credentials for an imported Nixflex phone number in place. Preserve settings and handle uncertain routing or credential saves safely.
Method: POST ·
Success: 200 ·
Scope: Owning account
The important part
- Use exactly one supported credential pair; do not mix carrier fields.
- This replaces connection credentials. Keep both request and response out of logs.
Authentication
UseAuthorization: Bearer KEY_ID:KEY_SECRET for the owning account. An organisation API key has Owner authority. Personal sessions use the role rules documented in Authentication; do not treat a Member session as an API key.
Request fields
| Field | Type | Required | Default and limits |
|---|---|---|---|
phoneNumber (path) | string | Yes | Owned E.164 number. URL-encode the leading +. |
| Field | Type | Required | Default | Limits and meaning |
|---|---|---|---|---|
twilio_sid | string | Yes | Omitted | |
twilio_token | string | Yes | Omitted | Private submitted credential. Outer whitespace is trimmed; blank values and CR/LF/NUL are refused. At most 4096 characters |
| Field | Type | Required | Default | Limits and meaning |
|---|---|---|---|---|
telnyx_api_key | string | Yes | Omitted | Private submitted credential. Outer whitespace is trimmed; blank values and CR/LF/NUL are refused. At most 4096 characters |
telnyx_connection_id | string | Yes | Omitted | Your existing TeXML app connection ID. At most 200 characters |
twilio_sid and twilio_token; Telnyx uses telnyx_api_key and telnyx_connection_id for your existing TeXML app. Mixed pairs, extra fields, a provider switch, agent fields and settings fields are refused. Outer whitespace is trimmed; blank values are refused. Telnyx values cannot contain CR, LF or NUL. Secrets are write-only and are never returned.
Verification checks that the new carrier account owns this exact number before changing routing. Twilio voice, SMS and status URLs are repointed to Nixflex and application/trunk overrides are cleared. Telnyx attaches the submitted TeXML app without changing shared app webhooks. The number ID, assigned agent, prompts, switches, pickup delay, integrations and history remain.
A changed Telnyx credential identity clears verification evidence, keeps the public key and needs the existing fresh test-call and approval flow. Identical current credentials retain existing verification when the resource also matches. Do not delete and re-import a number to recover from an uncertain credential update.
Response fields
200 returns the following shape.
| Field | Type | Meaning |
|---|---|---|
phone_number | string | Always returned. |
provider | string | Allowed: twilio, telnyx |
updated | boolean | Always returned. |
Example request
Production HTTP examples. Replace the placeholder identifiers with resources owned by the account. SetNIXFLEX_API_KEY privately; never print it.
curl --request POST \
--url 'https://api.nixflex.com/v1/phone-numbers/%2B12025550123/credentials' \
--header "Authorization: Bearer $NIXFLEX_API_KEY" \
--header 'Content-Type: application/json' \
--data '{"twilio_sid":"AC00000000000000000000000000000000","twilio_token":"REPLACE_PRIVATELY"}'
const response = await fetch('https://api.nixflex.com/v1/phone-numbers/%2B12025550123/credentials', {
method: 'POST',
headers: { Authorization: `Bearer ${process.env.NIXFLEX_API_KEY}`, 'Content-Type': 'application/json' },
body: JSON.stringify({"twilio_sid":"AC00000000000000000000000000000000","twilio_token":"REPLACE_PRIVATELY"}),
});
if (!response.ok) throw new Error(`HTTP ${response.status}`);
const result = await response.json();
// Handle the private result without logging it.
import os, json
from urllib.request import Request, urlopen
request = Request('https://api.nixflex.com/v1/phone-numbers/%2B12025550123/credentials', method='POST',
headers={'Authorization': 'Bearer ' + os.environ['NIXFLEX_API_KEY'], 'Content-Type': 'application/json'},
data="{\"twilio_sid\":\"AC00000000000000000000000000000000\",\"twilio_token\":\"REPLACE_PRIVATELY\"}".encode("utf-8"))
with urlopen(request, timeout=30) as response:
result = json.load(response)
# Handle the private result without logging it.
$headers = @{ Authorization = "Bearer $env:NIXFLEX_API_KEY" }
$body = '{"twilio_sid":"AC00000000000000000000000000000000","twilio_token":"REPLACE_PRIVATELY"}'
$result = Invoke-RestMethod -Method POST -Uri 'https://api.nixflex.com/v1/phone-numbers/%2B12025550123/credentials' -Headers $headers -DisableKeepAlive -ContentType "application/json" -Body ([Text.Encoding]::UTF8.GetBytes($body))
# Handle $result privately.
Example response
Illustrative response with placeholder identifiers.{
"phone_number": "+12025550123",
"provider": "twilio",
"updated": true
}
Errors
Branch onerror.code, not the wording of error.message. The envelope includes type, code, message, doc_url and details.
| Status / code | What it means | What to do |
|---|---|---|
400 · invalid_request | invalid_request, invalid_credentials | Correct the named field or query using the request table before trying again. |
400 · invalid_credentials | The supplied credential pair is invalid. | Supply exactly one complete supported credential pair through private secret handling. |
401 · unauthorized | The credential is missing or invalid. | Check the full account credential and API host privately; stop the retry loop. |
403 · permission_denied | This actor cannot perform the operation. | Resolve the account or role restriction through an authorised person. |
403 · account_unavailable | The account is unavailable for this operation. | Resolve the account or role restriction through an authorised person. |
404 · number_not_found | The number is absent or inaccessible to this account. | Check the exact owned identifier and current resource state; do not probe another account. |
404 · number_not_in_account | The number does not belong to this account. | Check the exact owned identifier and current resource state; do not probe another account. |
409 · carrier_mismatch | The credentials do not match the existing number carrier. | Use credentials for this number’s existing carrier; this endpoint does not migrate it. |
409 · number_operation_pending | Another number operation is unfinished. | Wait for the existing number operation to settle and read the number again. |
409 · number_release_pending | Number removal or release is unfinished. | Wait for removal/release work to settle; do not overwrite credentials during it. |
429 · rate_limit_exceeded | The request limit was reached. | Stop automatic retries; wait for the limit and reconcile state before a deliberate action. |
503 · carrier_unavailable | The carrier could not complete the request. | Treat the outcome as uncertain and read the affected resource before another deliberate change. |
503 · credential_update_unavailable | The credential change could not be confirmed. | Treat the outcome as uncertain and read the affected resource before another deliberate change. |
503 · carrier_outcome_unknown | The carrier change outcome cannot be confirmed. | Reconcile the existing carrier change; do not submit different credentials or assume no change occurred. |
503 · credential_save_pending | The carrier change succeeded; its local save is unfinished. | The carrier change is confirmed. Deliberately retry identical details only to finish the local save. |
invalid_credentials is HTTP 400, not an API-authentication 401. carrier_outcome_unknown: stop automatic retries and contact support with details.operation_id if present. credential_save_pending: the carrier change is confirmed; deliberately resubmit identical details to finish the local save without a second carrier change. A pending number/release operation must be resolved first. Never use delete/re-import as recovery.
Retry and idempotency
Disable automatic write retries. A lost response leaves the result uncertain; read the affected resource before another deliberate action. No general Idempotency-Key replay guarantee applies. See retry rules.Related endpoints
Authorizations
Path Parameters
Body
application/json