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

# Elenca pagina dei numeri di telefono

GET https://api.elevenlabs.io/v1/convai/v2/phone-numbers

Recupera una pagina di numeri di telefono

Reference: https://elevenlabs.io/docs/eleven-agents/api-reference/phone-numbers/list-v-2

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

### Query parameters

- `page_size` (integer, optional, default: 100) — Numero di numeri di telefono per pagina
- `search` (string, optional) — Filtra in base all'ID del numero di telefono, all'etichetta o al numero di telefono. L'ID del numero di telefono deve corrispondere esattamente; la corrispondenza di etichetta e numero di telefono è una sottostringa senza distinzione tra maiuscole e minuscole.
- `label` (string, optional) — Filtra in base all'etichetta. La corrispondenza è una sottostringa senza distinzione tra maiuscole e minuscole.
- `phone_number` (string, optional) — Filtra in base al numero di telefono
- `provider` (enum, optional) — Filtra in base al provider di telefonia
  - Allowed values: `twilio`, `sip_trunk`, `exotel`
- `supports_outbound` (boolean, optional) — Filtra in base alla possibilità del numero di telefono di effettuare chiamate in uscita
- `agent_id` (string, optional) — Filtra in base all'ID dell'agente assegnato
- `branch_id` (string, optional) — Filtra in base all'ID del branch assegnato
- `sort_by` (enum, optional) — Il campo in base al quale ordinare i risultati
  - Allowed values: `label`, `phone_number`
- `sort_direction` (enum, optional) — La direzione per ordinare i risultati
  - Allowed values: `asc`, `desc`
- `cursor` (string, optional) — Usato per recuperare la pagina successiva. Il cursore viene restituito nella risposta.

## Response

### 200

Risposta riuscita

- `phone_numbers` (list of GetPhoneNumbersPageResponseModelPhoneNumbersItem, required) — I numeri di telefono in questa pagina
- `next_cursor` (string, optional) — Passa questo valore come `cursor` per recuperare la pagina successiva. Null quando non ci sono altri risultati.
- `has_more` (boolean, optional, default: false) — Indica se sono disponibili altri risultati

## Errors

### 422 Phone Numbers List V2request Unprocessable Entity Error

Errore di convalida

- `detail` (list of ValidationError, optional)

## Types

### GetPhoneNumbersPageResponseModelPhoneNumbersItem

- `provider`: `exotel`
  - `label` (string, required) — Etichetta del numero di telefono
  - `phone_number` (string, required) — Numero di telefono
  - `phone_number_id` (string, required) — L'ID del numero di telefono
  - `assigned_agent` (PhoneNumberAgentInfo, optional) — L'agente assegnato al numero di telefono
  - `supports_inbound` (boolean, optional, default: true, deprecated) — Questo campo è deprecato e verrà rimosso in futuro. Indica se questo numero di telefono supporta le chiamate in entrata.
  - `supports_outbound` (boolean, optional, default: true, deprecated) — Questo campo è deprecato e verrà rimosso in futuro. Indica se questo numero di telefono supporta le chiamate in uscita.
- `provider`: `sip_trunk`
  - `label` (string, required) — Etichetta del numero di telefono
  - `livekit_stack` (enum, required, default: standard) — Tipo di stack Livekit usato per questo numero.
    - Allowed values: `standard`, `static`
  - `phone_number` (string, required) — Numero di telefono
  - `phone_number_id` (string, required) — L'ID del numero di telefono
  - `assigned_agent` (PhoneNumberAgentInfo, optional) — L'agente assegnato al numero di telefono
  - `inbound_trunk` (GetPhoneNumberInboundSipTrunkConfigResponseModel, optional) — Configurazione del trunk SIP in entrata, se configurato.
  - `outbound_trunk` (GetPhoneNumberOutboundSipTrunkConfigResponseModel, optional) — Configurazione del trunk SIP in uscita, se configurato.
  - `store_sip_messages` (boolean, optional, default: true) — Indica se archiviare i messaggi SIP per questo numero di telefono.
  - `provider_config` (GetPhoneNumberOutboundSipTrunkConfigResponseModel, optional, deprecated) — Dettagli della configurazione del trunk SIP per un numero di telefono
  - `supports_inbound` (boolean, optional, default: true, deprecated) — Questo campo è deprecato e verrà rimosso in futuro. Indica se questo numero di telefono supporta le chiamate in entrata.
  - `supports_outbound` (boolean, optional, default: true, deprecated) — Questo campo è deprecato e verrà rimosso in futuro. Indica se questo numero di telefono supporta le chiamate in uscita.
- `provider`: `twilio`
  - `label` (string, required) — Etichetta del numero di telefono
  - `phone_number` (string, required) — Numero di telefono
  - `phone_number_id` (string, required) — L'ID del numero di telefono
  - `assigned_agent` (PhoneNumberAgentInfo, optional) — L'agente assegnato al numero di telefono
  - `supports_inbound` (boolean, optional, default: true, deprecated) — Questo campo è deprecato e verrà rimosso in futuro. Indica se questo numero di telefono supporta le chiamate in entrata.
  - `supports_outbound` (boolean, optional, default: true, deprecated) — Questo campo è deprecato e verrà rimosso in futuro. Indica se questo numero di telefono supporta le chiamate in uscita.

### ValidationError

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

### PhoneNumberAgentInfo

- `agent_id` (string, required) — L'ID dell'agente
- `agent_name` (string, required) — Il nome dell'agente
- `environment` (string, optional) — Ambiente da usare per risolvere le variabili di ambiente nelle chiamate a questo numero.
- `branch_id` (string, optional) — Ramo dell'agente da usare per le chiamate a questo numero.

### GetPhoneNumberInboundSipTrunkConfigResponseModel

- `allowed_addresses` (list of string, required) — Elenco degli indirizzi IP autorizzati a usare il trunk. Ogni elemento dell'elenco può essere un singolo indirizzo IP o una notazione Classless Inter-Domain Routing che rappresenta un blocco CIDR.
- `media_encryption` (enum, required, default: allowed)
  - Allowed values: `disabled`, `allowed`, `required`
- `has_auth_credentials` (boolean, required) — Se le credenziali di autenticazione sono configurate
- `allowed_numbers` (list of string, optional) — Elenco dei numeri di telefono autorizzati a usare il trunk.
- `username` (string, optional) — Nome utente del trunk SIP, se disponibile
- `remote_domains` (list of string, optional) — Domini dei server SIP remoti utilizzati per convalidare i certificati TLS.
- `attributes_to_headers` (map from string to string, optional) — Mappa del nome della variabile dinamica al nome dell'header per attributes_to_headers

### GetPhoneNumberOutboundSipTrunkConfigResponseModel

Dettagli della configurazione del trunk SIP per un numero di telefono

- `address` (string, required) — Hostname o IP a cui viene inviato il SIP INVITE
- `transport` (enum, required, default: auto) — Protocollo da utilizzare per il trasporto SIP
  - Allowed values: `auto`, `udp`, `tcp`, `tls`
- `media_encryption` (enum, required, default: allowed) — Se crittografare i media (livello dati).
  - Allowed values: `disabled`, `allowed`, `required`
- `has_auth_credentials` (boolean, required) — Se le credenziali di autenticazione sono configurate
- `headers` (map from string to string, optional) — Header SIP per la richiesta INVITE
- `attributes_to_headers` (map from string to string, optional) — Mappa del nome della variabile dinamica al nome dell'header per attributes_to_headers
- `username` (string, optional) — Nome utente del trunk SIP, se disponibile
- `has_outbound_trunk` (boolean, optional, default: false) — Se è configurato un trunk SIP in uscita LiveKit
- `enabled_codecs` (list of enum, optional) — Codec multimediali offerti nell'SDP per le chiamate in uscita. Se vuoto, vengono offerti tutti i codec supportati.
  - Allowed values: `G722/8000`, `PCMU/8000`, `PCMA/8000`

### ValidationErrorLocItem

## Examples

**Response**

```json
{
  "phone_numbers": [
    {
      "provider": "exotel",
      "label": "Exotel Outbound",
      "phone_number": "+919999999999",
      "phone_number_id": "phnum_X3Pbu5gP6NNKBscdCdwB",
      "assigned_agent": {
        "agent_id": "F3Pbu5gP6NNKBscdCdwB",
        "agent_name": "My Agent"
      }
    }
  ],
  "next_cursor": "next_cursor",
  "has_more": true
}
```

**SDK Code**

```python
import requests

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

querystring = {"agent_id":"agent_id","branch_id":"branch_id","cursor":"cursor","label":"label","page_size":"1","phone_number":"phone_number","provider":"twilio","search":"search","sort_by":"label","sort_direction":"asc","supports_outbound":"true"}

response = requests.get(url, params=querystring)

print(response.json())
```

```javascript
const url = 'https://api.elevenlabs.io/v1/convai/v2/phone-numbers?agent_id=agent_id&branch_id=branch_id&cursor=cursor&label=label&page_size=1&phone_number=phone_number&provider=twilio&search=search&sort_by=label&sort_direction=asc&supports_outbound=true';
const options = {method: 'GET'};

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"
	"net/http"
	"io"
)

func main() {

	url := "https://api.elevenlabs.io/v1/convai/v2/phone-numbers?agent_id=agent_id&branch_id=branch_id&cursor=cursor&label=label&page_size=1&phone_number=phone_number&provider=twilio&search=search&sort_by=label&sort_direction=asc&supports_outbound=true"

	req, _ := http.NewRequest("GET", url, nil)

	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/v2/phone-numbers?agent_id=agent_id&branch_id=branch_id&cursor=cursor&label=label&page_size=1&phone_number=phone_number&provider=twilio&search=search&sort_by=label&sort_direction=asc&supports_outbound=true")

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

request = Net::HTTP::Get.new(url)

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.get("https://api.elevenlabs.io/v1/convai/v2/phone-numbers?agent_id=agent_id&branch_id=branch_id&cursor=cursor&label=label&page_size=1&phone_number=phone_number&provider=twilio&search=search&sort_by=label&sort_direction=asc&supports_outbound=true")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('GET', 'https://api.elevenlabs.io/v1/convai/v2/phone-numbers?agent_id=agent_id&branch_id=branch_id&cursor=cursor&label=label&page_size=1&phone_number=phone_number&provider=twilio&search=search&sort_by=label&sort_direction=asc&supports_outbound=true');

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

```csharp
using RestSharp;

var client = new RestClient("https://api.elevenlabs.io/v1/convai/v2/phone-numbers?agent_id=agent_id&branch_id=branch_id&cursor=cursor&label=label&page_size=1&phone_number=phone_number&provider=twilio&search=search&sort_by=label&sort_direction=asc&supports_outbound=true");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/convai/v2/phone-numbers?agent_id=agent_id&branch_id=branch_id&cursor=cursor&label=label&page_size=1&phone_number=phone_number&provider=twilio&search=search&sort_by=label&sort_direction=asc&supports_outbound=true")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "GET"

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()
```