> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.ortavox.ai/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.ortavox.ai/_mcp/server.

# Import phone number

POST https://api.ortavox.ai/v1/telephony/import
Content-Type: application/json

Import a phone number from custom telephony and bind agents

Reference: https://docs.ortavox.ai/api-reference/telephony/import-phone-number

## Authentication

- `Authorization` header (bearer token, required) — Clerk JWT token or OrtaVox API key (sk_live_... or pk_live_...)
- `x-api-key` header (required) — OrtaVox API key (alternative to Bearer token)

## Servers

- `https://api.ortavox.ai` (Production server, default)
- `http://localhost:3000` (Local development server)

## Request

### Body (application/json)

This endpoint expects an object.

- `phone_number` (string, required) — E.164 format phone number
- `termination_uri` (string, required) — SIP trunk termination URI
- `direction` (enum, optional) — Which direction(s) to configure - inbound only, outbound only, or both. Defaults to both if not specified.
  - Allowed values: `inbound`, `outbound`, `both`
- `sip_auth_username` (string, optional) — SIP authentication username (required)
- `sip_auth_password` (string, optional) — SIP authentication password (required)
- `inbound_agent_id` (string, optional) — Agent ID for inbound calls
- `outbound_agent_id` (string, optional) — Agent ID for outbound calls
- `inbound_agent_version` (integer, optional) — Inbound agent version
- `outbound_agent_version` (integer, optional) — Outbound agent version
- `nickname` (string, optional) — Friendly name for the phone number
- `inbound_webhook_url` (string, optional) — Webhook URL for inbound call events

## Response

### 201

Phone number imported successfully

- `data` (V1TelephonyImportPostResponsesContentApplicationJsonSchemaData, optional)

## Errors

### 401 Unauthorized Error

Unauthorized

- `any`

### 409 Conflict Error

Phone number already exists

- `any`

## Types

### V1TelephonyImportPostResponsesContentApplicationJsonSchemaData

- `phone_number` (string, optional)
- `inbound_sip_trunk_id` (string, optional, nullable)
- `outbound_sip_trunk_id` (string, optional, nullable)
- `auth_state` (enum, optional)
  - Allowed values: `authenticated`, `not_authenticated`, `server_error`, `not_verified`
- `auth_state_message` (string, optional, nullable)

## Examples

**Request**

```json
{
  "phone_number": "+14157774444",
  "termination_uri": "sip.uk.didlogic.net"
}
```

**Response**

```json
{
  "data": {
    "phone_number": "string",
    "inbound_sip_trunk_id": "string",
    "outbound_sip_trunk_id": "string",
    "auth_state": "authenticated",
    "auth_state_message": "string"
  }
}
```

**SDK Code**

```python
import requests

url = "https://api.ortavox.ai/v1/telephony/import"

payload = {
    "phone_number": "+14157774444",
    "termination_uri": "sip.uk.didlogic.net"
}
headers = {
    "Authorization": "Bearer <token>",
    "Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.ortavox.ai/v1/telephony/import';
const options = {
  method: 'POST',
  headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
  body: '{"phone_number":"+14157774444","termination_uri":"sip.uk.didlogic.net"}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.ortavox.ai/v1/telephony/import"

	payload := strings.NewReader("{\n  \"phone_number\": \"+14157774444\",\n  \"termination_uri\": \"sip.uk.didlogic.net\"\n}")

	req, _ := http.NewRequest("POST", url, payload)

	req.Header.Add("Authorization", "Bearer <token>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.ortavox.ai/v1/telephony/import")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"phone_number\": \"+14157774444\",\n  \"termination_uri\": \"sip.uk.didlogic.net\"\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://api.ortavox.ai/v1/telephony/import")
  .header("Authorization", "Bearer <token>")
  .header("Content-Type", "application/json")
  .body("{\n  \"phone_number\": \"+14157774444\",\n  \"termination_uri\": \"sip.uk.didlogic.net\"\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.ortavox.ai/v1/telephony/import', [
  'body' => '{
  "phone_number": "+14157774444",
  "termination_uri": "sip.uk.didlogic.net"
}',
  'headers' => [
    'Authorization' => 'Bearer <token>',
    'Content-Type' => 'application/json',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.ortavox.ai/v1/telephony/import");
var request = new RestRequest(Method.POST);
request.AddHeader("Authorization", "Bearer <token>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"phone_number\": \"+14157774444\",\n  \"termination_uri\": \"sip.uk.didlogic.net\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "Authorization": "Bearer <token>",
  "Content-Type": "application/json"
]
let parameters = [
  "phone_number": "+14157774444",
  "termination_uri": "sip.uk.didlogic.net"
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.ortavox.ai/v1/telephony/import")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```