> ## 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.

# Prepare a phone number connection

> Prepare an owned number for Nixflex, verify the target agent and connection state and reconcile import or removal outcomes without exposing credentials.

**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)

Prepare an owned carrier number for Nixflex with the correct credentials, agent assignment and routing checks.

Input: **Owned carrier number** · Assignment: **Active owned agent** · Routing: **Verify result**

**The important part**

* Import connects an existing eligible number; it is not a number purchase or port.
* Credentials stay private and must match the selected carrier and account.
* An uncertain routing result needs reconciliation before another import.

[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 verify](https://docs.nixflex.com/guides/developer/phone-numbers/import-and-connect.md) | Follow initial setup and routing checks. |
| [Replace credentials](https://docs.nixflex.com/guides/developer/phone-numbers/credentials-and-removal.md) | Keep the existing number and settings. |

## Prerequisites

Keep `NIXFLEX_API_KEY` private on the server. Raw HTTP base URL: `https://api.nixflex.com/v1`. Node and Python SDK base URL: `https://api.nixflex.com`. The SDK adds `/v1`. Use owned identifiers; SDK and CLI examples need the [documented minimum versions](https://docs.nixflex.com/sdks/ecosystem.md#install-a-client). Prepare the number’s authorised connection details through your private configuration process.

## 1. Read existing numbers

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 the target account and agent

Use an active agent owned by the same account. A number already connected elsewhere or still settling an earlier operation cannot be treated as a fresh import. Do not change origin labels to bypass account checks.

## 3. Prepare the documented import

Connect an owned number in the dashboard or from your server. The [number import reference](https://docs.nixflex.com/api-reference/phone-numbers/import.md) lists the credential fields for each carrier. Keep those values in protected server configuration.

## 4. Reconcile the saved state

Submit the intended import once and retain any returned operation information. Read back the owned number and verify the real routing result. A saved credential or signature key does not confirm that a later callback was verified.

## 5. Move with the supported update

To change agents within the account, use an agent-only number PATCH after busy work settles. Do not remove and re-import as the normal move procedure. Removal has its own external-cleanup and uncertain-state handling.

## Example response

A number read returns `{"phone_number":{...}}` with safe public settings and read-only `source`. Private credentials and internal operation tokens are excluded.

## Errors and limits

| Condition | Handling |
| - | - |
| Already connected or pending | Reconcile existing state before a new import. |
| Busy number | Wait for current work to settle. |
| Unknown routing outcome | Preserve pending state; do not claim completion. |
| Remove connection | It does not guarantee cancellation of external rental. |
| Connection-specific fields | Use the exact API contract; do not rename enums. |

## Next steps

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


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