List Phone Numbers Page
GET https://api.elevenlabs.io/v1/convai/v2/phone-numbers
Retrieve a page of Phone Numbers
Reference: https://elevenlabs.io/docs/api-reference/phone-numbers/list-v-2
Servers
Section titled “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
Section titled “Request”Query parameters
Section titled “Query parameters”page_size(integer, optional, default: 100) — Number of phone numbers per pagesearch(string, optional, nullable) — Filter by phone number ID, label, or phone number. A phone number ID must match exactly; label and phone number matching is a case-insensitive substring.label(string, optional, nullable) — Filter by label. Matching is a case-insensitive substring.phone_number(string, optional, nullable) — Filter by phone numberprovider(enum, optional, nullable) — Filter by telephony provider- Allowed values:
twilio,sip_trunk,exotel
- Allowed values:
supports_outbound(boolean, optional, nullable) — Filter by whether the phone number can place outbound callsagent_id(string, optional, nullable) — Filter by assigned agent IDbranch_id(string, optional, nullable) — Filter by assigned branch IDsort_by(enum, optional, nullable) — The field to sort the results by- Allowed values:
label,phone_number
- Allowed values:
sort_direction(enum, optional) — The direction to sort the results- Allowed values:
asc,desc
- Allowed values:
cursor(string, optional, nullable) — Used for fetching next page. Cursor is returned in the response.
Response
Section titled “Response”Successful Response
phone_numbers(list of GetPhoneNumbersPageResponseModelPhoneNumbersItems, required) — The phone numbers on this pagenext_cursor(string, optional, nullable) — Pass this value ascursorto fetch the next page. Null when there are no more results.has_more(boolean, optional, default: false) — Whether there are more results available
Errors
Section titled “Errors”422 Unprocessable Entity Error
Section titled “422 Unprocessable Entity Error”Validation Error
detail(list of ValidationError, optional)
GetPhoneNumbersPageResponseModelPhoneNumbersItems
Section titled “GetPhoneNumbersPageResponseModelPhoneNumbersItems”provider:exotel(GetPhoneNumberExotelResponseModel)label(string, required) — Label for the phone numberphone_number(string, required) — Phone numberphone_number_id(string, required) — The ID of the phone numberassigned_agent(PhoneNumberAgentInfo, optional, nullable) — The agent that is assigned to the phone numbersupports_inbound(boolean, optional, default: true, deprecated) — This field is deprecated and will be removed in the future. Whether this phone number supports inbound callssupports_outbound(boolean, optional, default: true, deprecated) — This field is deprecated and will be removed in the future. Whether this phone number supports outbound calls
provider:sip_trunk(GetPhoneNumberSIPTrunkResponseModel)label(string, required) — Label for the phone numberlivekit_stack(enum, required, default: standard) — Type of Livekit stack used for this number.- Allowed values:
standard,static
- Allowed values:
phone_number(string, required) — Phone numberphone_number_id(string, required) — The ID of the phone numberassigned_agent(PhoneNumberAgentInfo, optional, nullable) — The agent that is assigned to the phone numberinbound_trunk(GetPhoneNumberInboundSIPTrunkConfigResponseModel, optional, nullable) — Configuration of the Inbound SIP trunk - if configured.outbound_trunk(GetPhoneNumberOutboundSIPTrunkConfigResponseModel, optional, nullable) — Configuration of the Outbound SIP trunk - if configured.store_sip_messages(boolean, optional, default: true) — Whether to store SIP messages for this phone number.provider_config(GetPhoneNumberOutboundSIPTrunkConfigResponseModel, optional, nullable, deprecated) — SIP Trunk configuration details for a phone numbersupports_inbound(boolean, optional, default: true, deprecated) — This field is deprecated and will be removed in the future. Whether this phone number supports inbound callssupports_outbound(boolean, optional, default: true, deprecated) — This field is deprecated and will be removed in the future. Whether this phone number supports outbound calls
provider:twilio(GetPhoneNumberTwilioResponseModel)label(string, required) — Label for the phone numberphone_number(string, required) — Phone numberphone_number_id(string, required) — The ID of the phone numberassigned_agent(PhoneNumberAgentInfo, optional, nullable) — The agent that is assigned to the phone numbersupports_inbound(boolean, optional, default: true, deprecated) — This field is deprecated and will be removed in the future. Whether this phone number supports inbound callssupports_outbound(boolean, optional, default: true, deprecated) — This field is deprecated and will be removed in the future. Whether this phone number supports outbound calls
ValidationError
Section titled “ValidationError”loc(list of ValidationErrorLocItems, required)msg(string, required)type(string, required)
PhoneNumberAgentInfo
Section titled “PhoneNumberAgentInfo”agent_id(string, required) — The ID of the agentagent_name(string, required) — The name of the agentenvironment(string, optional, nullable) — Environment to use for resolving environment variables on calls to this number.branch_id(string, optional, nullable) — Agent branch to use for calls to this number.
GetPhoneNumberInboundSIPTrunkConfigResponseModel
Section titled “GetPhoneNumberInboundSIPTrunkConfigResponseModel”allowed_addresses(list of string, required) — List of IP addresses that are allowed to use the trunk. Each item in the list can be an individual IP address or a Classless Inter-Domain Routing notation representing a CIDR block.allowed_numbers(list of string, required, nullable) — List of phone numbers that are allowed to use the trunk.media_encryption(enum, required, default: allowed)- Allowed values:
disabled,allowed,required
- Allowed values:
has_auth_credentials(boolean, required) — Whether authentication credentials are configuredusername(string, optional, nullable) — SIP trunk username (if available)remote_domains(list of string, optional, nullable) — Domains of remote SIP servers used to validate TLS certificates.attributes_to_headers(map from string to string, optional) — Map of dynamic variable name to header name for attributes_to_headers
GetPhoneNumberOutboundSIPTrunkConfigResponseModel
Section titled “GetPhoneNumberOutboundSIPTrunkConfigResponseModel”SIP Trunk configuration details for a phone number
address(string, required) — Hostname or IP the SIP INVITE is sent totransport(enum, required, default: auto) — Protocol to use for SIP transport- Allowed values:
auto,udp,tcp,tls
- Allowed values:
media_encryption(enum, required, default: allowed) — Whether or not to encrypt media (data layer).- Allowed values:
disabled,allowed,required
- Allowed values:
has_auth_credentials(boolean, required) — Whether authentication credentials are configuredheaders(map from string to string, optional) — SIP headers for INVITE requestattributes_to_headers(map from string to string, optional) — Map of dynamic variable name to header name for attributes_to_headersusername(string, optional, nullable) — SIP trunk username (if available)has_outbound_trunk(boolean, optional, default: false) — Whether a LiveKit SIP outbound trunk is configuredenabled_codecs(list of enum, optional) — Media codecs that are offered in the SDP for outbound calls. If empty, all supported codecs are offered.- Allowed values:
G722/8000,PCMU/8000,PCMA/8000
- Allowed values:
ValidationErrorLocItems
Section titled “ValidationErrorLocItems”Examples
Section titled “Examples”Response
{
"phone_numbers": [
{
"provider": "twilio",
"label": "Customer Support",
"phone_number": "+1234567890",
"phone_number_id": "phone_123"
}
],
"next_cursor": "string",
"has_more": false
}SDK Code
import { ElevenLabsClient } from "@elevenlabs/elevenlabs-js";
async function main() {
const client = new ElevenLabsClient();
await client.conversationalAi.phoneNumbers.listV2({});
}
main();
from elevenlabs import ElevenLabs
client = ElevenLabs()
client.conversational_ai.phone_numbers.list_v_2()
package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://api.elevenlabs.io/v1/convai/v2/phone-numbers"
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))
}require 'uri'
require 'net/http'
url = URI("https://api.elevenlabs.io/v1/convai/v2/phone-numbers")
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_bodyimport 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")
.asString();<?php
require_once('vendor/autoload.php');
$client = new \GuzzleHttp\Client();
$response = $client->request('GET', 'https://api.elevenlabs.io/v1/convai/v2/phone-numbers');
echo $response->getBody();using RestSharp;
var client = new RestClient("https://api.elevenlabs.io/v1/convai/v2/phone-numbers");
var request = new RestRequest(Method.GET);
IRestResponse response = client.Execute(request);import Foundation
let request = NSMutableURLRequest(url: NSURL(string: "https://api.elevenlabs.io/v1/convai/v2/phone-numbers")! 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()