> ## Documentation Index
> Fetch the complete documentation index at: https://docs.nixflex.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Manage phone number settings in code

> Read and update Nixflex phone number settings, move a number between agents and handle busy or uncertain results while preserving number-owned configuration.

**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. `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](https://docs.nixflex.com/ai-rules.md#phone-numbers)

Read an owned number, change only its intended settings and verify the result without recreating its connections.

Scope: **Owned number** · Move: **Agent-only PATCH** · Verification: **Read back**

**The important part**

* URL-encode the number, including the leading plus sign.
* Moving an owned number preserves number-owned settings but changes inherited agent behaviour.
* Null means inherit only on fields that explicitly document it.

[Business guide](https://docs.nixflex.com/guides/business/phone-numbers.md) · [API reference](https://docs.nixflex.com/api-reference/introduction.md) · [Glossary](https://docs.nixflex.com/guides/glossary.md)

## Choose the task

| Task | Outcome |
| - | - |
| [Import and connect](https://docs.nixflex.com/guides/developer/phone-numbers/import-and-connect.md) | Prepare a new owned-number connection. |
| [Routing and overrides](https://docs.nixflex.com/guides/developer/phone-numbers/routing-and-overrides.md) | Move agents or change focused settings. |
| [Credentials and removal](https://docs.nixflex.com/guides/developer/phone-numbers/credentials-and-removal.md) | Replace private credentials or reconcile disconnection. |

## Prerequisites

Keep the full account credential in `NIXFLEX_API_KEY`. Choose an owned active number and agent. URL-encode the number, including its leading plus sign. Examples use placeholder identifiers; replace them with owned values before running.

## 1. Read the number

Node and Python below use their standard HTTP clients. Keep `NIXFLEX_API_KEY` on the server. The CLI examples require a CLI version that supports the command; see [release status](https://docs.nixflex.com/sdks/ecosystem.md). No example retries a mutation automatically.

```bash cURL theme={"dark"}
curl --fail-with-body --request GET \
  --url "https://api.nixflex.com/v1/phone-numbers/%2B12025550100" \
  --header "Authorization: Bearer $NIXFLEX_API_KEY"
```

```javascript Node theme={"dark"}
const response = await fetch('https://api.nixflex.com/v1/phone-numbers/%2B12025550100', {
  method: 'GET',
  redirect: 'error',
  signal: AbortSignal.timeout(30_000),
  headers: { Authorization: `Bearer ${process.env.NIXFLEX_API_KEY}` },
});
const result = await response.json();
if (!response.ok) throw new Error(`HTTP ${response.status}: ${result?.error?.code ?? "unavailable"}`);
// Handle the private result without logging the full response.
```

```python Python theme={"dark"}
import os, json
from urllib.request import HTTPRedirectHandler, Request, build_opener

class NoRedirect(HTTPRedirectHandler):
    def redirect_request(self, request, file, code, message, headers, new_url):
        return None

request = Request(
    'https://api.nixflex.com/v1/phone-numbers/%2B12025550100',
    method='GET',
    headers={'Authorization': 'Bearer ' + os.environ['NIXFLEX_API_KEY']},
)
with build_opener(NoRedirect).open(request, timeout=30) as response:
    result = json.load(response)
    # Handle the private result without logging it.
```

```powershell CLI (PowerShell) theme={"dark"}
nixflex numbers get +12025550100 --json --base-url https://api.nixflex.com
```

## 2. Check ownership and channel switches

Read the saved `source`, `agent_id` and channel flags. `source` is assigned by the import route, not a writable permission switch. `web_calls_enabled` is effective only with `web_agent_enabled`; website custom functions require `web_functions_enabled`. Dashboard source filtering does not transfer account ownership.

## 3. Send a focused change

Use `PATCH /v1/phone-numbers/{number}`. For example, `{"sms_reply_enabled":true}` changes the SMS switch; it does not write SMS instructions. Only documented nullable fields accept null. A number’s explicit recording boolean overrides the agent, while its null value inherits.

## 4. Move without re-importing

Use an agent-only PATCH, `{"agent_id":"agent_destination"}`. The destination must be active and owned by the same account. Live calls, replies, campaigns or number operations can produce `number_busy`. Settings, integrations and history remain on the number; inherited agent behaviour and knowledge change.

## 5. Read back and reconcile

GET the number after a confirmed update. On a lost mutation response, read its state before repeating. Removal also has cleanup and uncertainty states; it is not a promise that every telephone routing change finished or that number rental ended.

## Example response

A number GET returns the safe number object, including `phone_number`, `agent_id`, read-only `source` and saved public settings. Credentials are not returned. Use the [GET schema](https://docs.nixflex.com/api-reference/phone-numbers/get.md) for its complete shape.

## Errors and limits

| Condition | Handling |
| - | - |
| 404 or inaccessible number/agent | Check the owning account and identifiers. |
| 409 `number_busy` | Wait for in-flight work, then read state again. |
| Pending or uncertain routing cleanup | Reconcile the existing number; do not blindly remove and import. |
| Invalid field or type | Correct it; null is not a universal reset. |
| Number list | Use the endpoint’s opt-in cursor paging; returned count is not a total. |

## Next steps

* [Read number](https://docs.nixflex.com/api-reference/phone-numbers/get.md)
* [Update number](https://docs.nixflex.com/api-reference/phone-numbers/update.md)
* [Import number](https://docs.nixflex.com/api-reference/phone-numbers/import.md)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.