> This is a page from the ElevenLabs documentation. For a complete page index, fetch https://elevenlabs.io/docs/llms.txt. For the full documentation in a single file, fetch https://elevenlabs.io/docs/llms-full.txt.

# फ़ोन नंबर इंपोर्ट करें

POST https://api.elevenlabs.io/v1/convai/phone-numbers
Content-Type: application/json

प्रोवाइडर कॉन्फ़िगरेशन (Twilio, Exotel या SIP trunk) से फ़ोन नंबर इंपोर्ट करें

Reference: https://elevenlabs.io/docs/api-reference/phone-numbers/create

## Servers

- `https://api.elevenlabs.io` (Production, default)
- `https://api.us.elevenlabs.io` (Production US)
- `https://api.eu.residency.elevenlabs.io` (Production EU)
- `https://api.in.residency.elevenlabs.io` (Production India)
- `https://api.sg.residency.elevenlabs.io` (Production Singapore)

## Request

### Body (application/json)

This endpoint expects a conversational_ai_phone_numbers_create_Request.

- `conversational_ai_phone_numbers_create_Request`

## Response

### 200

सफल रिस्पॉन्स

- `phone_number_id` (string, required) — Phone entity ID

## Errors

### 422 Unprocessable Entity Error

वैलिडेशन एरर

- `detail` (list of ValidationError, optional)

## Types

### CreateTwilioPhoneNumberRequest

- `phone_number` (string, required) — फ़ोन नंबर
- `label` (string, required) — फ़ोन नंबर का लेबल
- `sid` (string, required) — Twilio Account SID (`AC` से शुरू) या API Key SID (`SK` से शुरू)
- `token` (string, required) — `sid` के साथ जोड़ा गया secret: Account SID के लिए Account Auth Token या API Key SID के लिए API Key Secret
- `provider` ("twilio", optional, default: twilio)
- `agent_id` (string, optional, nullable) — फ़ोन नंबर असाइन करने के लिए एजेंट ID
- `account_auth_token` (string, optional, nullable) — Twilio Account Auth Token, जो इनबाउंड webhook हस्ताक्षरों को सत्यापित करने के लिए API Key इंपोर्ट हेतु आवश्यक है
- `region_config` (RegionConfigRequest, optional, nullable) — Twilio अतिरिक्त क्षेत्र कॉन्फ़िगरेशन
- `enable_sms` (boolean, optional, default: true) — इनबाउंड SMS को ElevenLabs पर रूट करें। डिफ़ॉल्ट रूप से चालू है; जिन नंबरों में यह समर्थित नहीं है, उनके लिए SMS कॉन्फ़िगरेशन छोड़ने हेतु इसे false पर सेट करें।
- `supports_inbound` (boolean, optional, default: true, deprecated) — यह फ़ील्ड डिप्रिकेटेड है और भविष्य में हटा दी जाएगी। क्या यह फ़ोन नंबर इनबाउंड कॉल सपोर्ट करता है।
- `supports_outbound` (boolean, optional, default: true, deprecated) — यह फ़ील्ड डिप्रिकेटेड है और भविष्य में हटा दी जाएगी। क्या यह फ़ोन नंबर आउटबाउंड कॉल सपोर्ट करता है।

### CreateExotelPhoneNumberRequest

- `phone_number` (string, required) — फ़ोन नंबर
- `label` (string, required) — फ़ोन नंबर का लेबल
- `account_sid` (string, required) — Exotel Account SID
- `api_key` (string, required) — Exotel API Key
- `api_token` (string, required) — Exotel API Token
- `api_subdomain` (enum, required) — क्षेत्र-विशिष्ट Exotel API host
  - Allowed values: `api.in.exotel.com`, `api.exotel.com`
- `app_id` (string, required) — Calls/connect में इस्तेमाल होने वाला Exotel applet identifier
- `provider` ("exotel", optional, default: exotel)
- `agent_id` (string, optional, nullable) — फ़ोन नंबर असाइन करने के लिए एजेंट ID
- `applet_url` (string, optional, nullable) — वैकल्पिक पूर्ण applet URL override। डिफ़ॉल्ट रूप से account SID और app ID से प्राप्त Exotel start_voice URL इस्तेमाल होता है।
- `supports_inbound` (boolean, optional, default: true, deprecated) — यह फ़ील्ड डिप्रिकेटेड है और भविष्य में हटा दी जाएगी। क्या यह फ़ोन नंबर इनबाउंड कॉल सपोर्ट करता है।
- `supports_outbound` (boolean, optional, default: true, deprecated) — यह फ़ील्ड डिप्रिकेटेड है और भविष्य में हटा दी जाएगी। क्या यह फ़ोन नंबर आउटबाउंड कॉल सपोर्ट करता है।

### CreateSIPTrunkPhoneNumberRequestV2

- `phone_number` (string, required) — फ़ोन नंबर
- `label` (string, required) — फ़ोन नंबर का लेबल
- `provider` ("sip_trunk", optional, default: sip_trunk)
- `agent_id` (string, optional, nullable) — फ़ोन नंबर असाइन करने के लिए एजेंट ID
- `inbound_trunk_config` (InboundSIPTrunkConfigRequestModel, optional, nullable)
- `outbound_trunk_config` (OutboundSIPTrunkConfigRequestModel, optional, nullable)
- `supports_inbound` (boolean, optional, default: true, deprecated) — यह फ़ील्ड डिप्रिकेटेड है और भविष्य में हटा दी जाएगी। क्या यह फ़ोन नंबर इनबाउंड कॉल सपोर्ट करता है।
- `supports_outbound` (boolean, optional, default: true, deprecated) — यह फ़ील्ड डिप्रिकेटेड है और भविष्य में हटा दी जाएगी। क्या यह फ़ोन नंबर आउटबाउंड कॉल सपोर्ट करता है।

### ValidationError

- `loc` (list of ValidationErrorLocItems, required)
- `msg` (string, required)
- `type` (string, required)

### RegionConfigRequest

- `region_id` (enum, required) — क्षेत्र ID
  - Allowed values: `us1`, `ie1`, `au1`
- `token` (string, required) — इस क्षेत्र के लिए Auth Token
- `edge_location` (enum, required) — इस रीजन के लिए एज लोकेशन
  - Allowed values: `ashburn`, `dublin`, `frankfurt`, `sao-paulo`, `singapore`, `sydney`, `tokyo`, `umatilla`, `roaming`

### InboundSIPTrunkConfigRequestModel

- `allowed_addresses` (list of string, optional, nullable) — ट्रंक का उपयोग करने के लिए अनुमत IP पतों की सूची। सूची में हर आइटम एक अलग IP पता या CIDR ब्लॉक दर्शाने वाला Classless Inter-Domain Routing नोटेशन हो सकता है।
- `allowed_numbers` (list of string, optional, nullable) — ट्रंक का उपयोग करने के लिए अनुमत फ़ोन नंबर की सूची।
- `media_encryption` (enum, optional, default: allowed) — media (data layer) को एन्क्रिप्ट करना है या नहीं।
  - Allowed values: `disabled`, `allowed`, `required`
- `credentials` (SIPTrunkCredentialsRequestModel, optional, nullable) — वैकल्पिक digest authentication credentials (username/password)।
- `remote_domains` (list of string, optional, nullable) — TLS सर्टिफ़िकेट को वैलिडेट करने के लिए इस्तेमाल होने वाले रिमोट SIP सर्वर के डोमेन।
- `attributes_to_headers` (map from string to string, optional) — attributes_to_headers के लिए डायनामिक वेरिएबल नाम और हेडर नाम का मैप

### OutboundSIPTrunkConfigRequestModel

- `address` (string, required) — होस्टनेम या IP, जिस पर SIP INVITE भेजा जाता है।
- `transport` (enum, optional, default: auto) — SIP ट्रांसपोर्ट (सिग्नलिंग लेयर) के लिए इस्तेमाल किया जाने वाला प्रोटोकॉल।
  - Allowed values: `auto`, `udp`, `tcp`, `tls`
- `media_encryption` (enum, optional, default: allowed) — media (data layer) को एन्क्रिप्ट करना है या नहीं।
  - Allowed values: `disabled`, `allowed`, `required`
- `headers` (map from string to string, optional) — INVITE request के लिए SIP X-* headers। ये headers जैसे हैं वैसे ही भेजे जाते हैं और इस call की पहचान करने में मदद कर सकते हैं।
- `attributes_to_headers` (map from string to string, optional) — attributes_to_headers के लिए डायनामिक वेरिएबल नाम और हेडर नाम का मैप
- `credentials` (SIPTrunkCredentialsRequestModel, optional, nullable) — वैकल्पिक digest authentication credentials (username/password)। न दिए जाने पर ACL authentication माना जाता है।
- `enabled_codecs` (list of enum, optional) — आउटबाउंड कॉल के लिए SDP में दिए जाने वाले मीडिया कोडेक। खाली होने पर सभी समर्थित कोडेक दिए जाते हैं।
  - Allowed values: `G722/8000`, `PCMU/8000`, `PCMA/8000`

### ValidationErrorLocItems

### SIPTrunkCredentialsRequestModel

- `username` (string, required) — SIP trunk username
- `password` (string, optional, nullable) — SIP trunk password - निर्दिष्ट न होने पर अपरिवर्तित रहेगा

## Examples

**Request**

```json
{
  "account_sid": "your-account-sid",
  "api_key": "your-api-key",
  "api_subdomain": "api.in.exotel.com",
  "api_token": "********",
  "app_id": "12345",
  "label": "Exotel Outbound",
  "phone_number": "+919999999999",
  "provider": "exotel"
}
```

**Response**

```json
{
  "phone_number_id": "string"
}
```

**SDK Code**

```python
import requests

url = "https://api.elevenlabs.io/v1/convai/phone-numbers"

payload = {
    "account_sid": "your-account-sid",
    "api_key": "your-api-key",
    "api_subdomain": "api.in.exotel.com",
    "api_token": "********",
    "app_id": "12345",
    "label": "Exotel Outbound",
    "phone_number": "+919999999999",
    "provider": "exotel"
}
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript
const url = 'https://api.elevenlabs.io/v1/convai/phone-numbers';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"account_sid":"your-account-sid","api_key":"your-api-key","api_subdomain":"api.in.exotel.com","api_token":"********","app_id":"12345","label":"Exotel Outbound","phone_number":"+919999999999","provider":"exotel"}'
};

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.elevenlabs.io/v1/convai/phone-numbers"

	payload := strings.NewReader("{\n  \"account_sid\": \"your-account-sid\",\n  \"api_key\": \"your-api-key\",\n  \"api_subdomain\": \"api.in.exotel.com\",\n  \"api_token\": \"********\",\n  \"app_id\": \"12345\",\n  \"label\": \"Exotel Outbound\",\n  \"phone_number\": \"+919999999999\",\n  \"provider\": \"exotel\"\n}")

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

	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.elevenlabs.io/v1/convai/phone-numbers")

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"account_sid\": \"your-account-sid\",\n  \"api_key\": \"your-api-key\",\n  \"api_subdomain\": \"api.in.exotel.com\",\n  \"api_token\": \"********\",\n  \"app_id\": \"12345\",\n  \"label\": \"Exotel Outbound\",\n  \"phone_number\": \"+919999999999\",\n  \"provider\": \"exotel\"\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.elevenlabs.io/v1/convai/phone-numbers")
  .header("Content-Type", "application/json")
  .body("{\n  \"account_sid\": \"your-account-sid\",\n  \"api_key\": \"your-api-key\",\n  \"api_subdomain\": \"api.in.exotel.com\",\n  \"api_token\": \"********\",\n  \"app_id\": \"12345\",\n  \"label\": \"Exotel Outbound\",\n  \"phone_number\": \"+919999999999\",\n  \"provider\": \"exotel\"\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.elevenlabs.io/v1/convai/phone-numbers', [
  'body' => '{
  "account_sid": "your-account-sid",
  "api_key": "your-api-key",
  "api_subdomain": "api.in.exotel.com",
  "api_token": "********",
  "app_id": "12345",
  "label": "Exotel Outbound",
  "phone_number": "+919999999999",
  "provider": "exotel"
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://api.elevenlabs.io/v1/convai/phone-numbers");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"account_sid\": \"your-account-sid\",\n  \"api_key\": \"your-api-key\",\n  \"api_subdomain\": \"api.in.exotel.com\",\n  \"api_token\": \"********\",\n  \"app_id\": \"12345\",\n  \"label\": \"Exotel Outbound\",\n  \"phone_number\": \"+919999999999\",\n  \"provider\": \"exotel\"\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = [
  "account_sid": "your-account-sid",
  "api_key": "your-api-key",
  "api_subdomain": "api.in.exotel.com",
  "api_token": "********",
  "app_id": "12345",
  "label": "Exotel Outbound",
  "phone_number": "+919999999999",
  "provider": "exotel"
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/convai/phone-numbers")! 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()
```