List available phone number blocks
GET
/
available_phone_number_blocks
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const availablePhoneNumberBlocks = await client.availablePhoneNumberBlocks.list();
console.log(availablePhoneNumberBlocks.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
available_phone_number_blocks = client.available_phone_number_blocks.list()
print(available_phone_number_blocks.data)package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
availablePhoneNumberBlocks, err := client.AvailablePhoneNumberBlocks.List(context.TODO(), telnyx.AvailablePhoneNumberBlockListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", availablePhoneNumberBlocks.Data)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.availablephonenumberblocks.AvailablePhoneNumberBlockListParams;
import com.telnyx.sdk.models.availablephonenumberblocks.AvailablePhoneNumberBlockListResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
AvailablePhoneNumberBlockListResponse availablePhoneNumberBlocks = client.availablePhoneNumberBlocks().list();
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
available_phone_number_blocks = telnyx.available_phone_number_blocks.list
puts(available_phone_number_blocks)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$availablePhoneNumberBlocks = $client->availablePhoneNumberBlocks->list(
filter: [
'countryCode' => 'country_code',
'locality' => 'locality',
'nationalDestinationCode' => 'national_destination_code',
'phoneNumberType' => 'local',
],
);
var_dump($availablePhoneNumberBlocks);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx available-phone-number-blocks list \
--api-key 'My API Key'curl --request GET \
--url https://api.telnyx.com/v2/available_phone_number_blocks \
--header 'Authorization: Bearer <token>'{
"data": [
{
"record_type": "available_phone_number_block",
"phone_number": "+19705555000",
"range": 10,
"region_information": [
{
"region_type": "country_code",
"region_name": "US"
}
],
"cost_information": {
"upfront_cost": "3.21",
"monthly_cost": "6.54",
"currency": "USD"
},
"features": [
{
"name": "sms"
},
{
"name": "voice"
}
]
}
],
"meta": {
"total_results": 100,
"best_effort_results": 50
}
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}{
"errors": [
{
"code": "10009",
"title": "Authentication failed",
"detail": "Could not understand the provided credentials.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10009"
}
}
]
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}Authorizations
Bearer authentication header of the form Bearer <token>, where <token> is your auth token.
Query Parameters
Consolidated filter parameter (deepObject style). Originally: filter[locality], filter[country_code], filter[national_destination_code], filter[phone_number_type]
Show child attributes
Show child attributes
Was this page helpful?
⌘I
JavaScript
import Telnyx from 'telnyx';
const client = new Telnyx({
apiKey: process.env['TELNYX_API_KEY'], // This is the default and can be omitted
});
const availablePhoneNumberBlocks = await client.availablePhoneNumberBlocks.list();
console.log(availablePhoneNumberBlocks.data);import os
from telnyx import Telnyx
client = Telnyx(
api_key=os.environ.get("TELNYX_API_KEY"), # This is the default and can be omitted
)
available_phone_number_blocks = client.available_phone_number_blocks.list()
print(available_phone_number_blocks.data)package main
import (
"context"
"fmt"
"github.com/team-telnyx/telnyx-go"
"github.com/team-telnyx/telnyx-go/option"
)
func main() {
client := telnyx.NewClient(
option.WithAPIKey("My API Key"),
)
availablePhoneNumberBlocks, err := client.AvailablePhoneNumberBlocks.List(context.TODO(), telnyx.AvailablePhoneNumberBlockListParams{})
if err != nil {
panic(err.Error())
}
fmt.Printf("%+v\n", availablePhoneNumberBlocks.Data)
}package com.telnyx.sdk.example;
import com.telnyx.sdk.client.TelnyxClient;
import com.telnyx.sdk.client.okhttp.TelnyxOkHttpClient;
import com.telnyx.sdk.models.availablephonenumberblocks.AvailablePhoneNumberBlockListParams;
import com.telnyx.sdk.models.availablephonenumberblocks.AvailablePhoneNumberBlockListResponse;
public final class Main {
private Main() {}
public static void main(String[] args) {
TelnyxClient client = TelnyxOkHttpClient.fromEnv();
AvailablePhoneNumberBlockListResponse availablePhoneNumberBlocks = client.availablePhoneNumberBlocks().list();
}
}require "telnyx"
telnyx = Telnyx::Client.new(api_key: "My API Key")
available_phone_number_blocks = telnyx.available_phone_number_blocks.list
puts(available_phone_number_blocks)<?php
require_once dirname(__DIR__) . '/vendor/autoload.php';
use Telnyx\Client;
use Telnyx\Core\Exceptions\APIException;
$client = new Client(apiKey: getenv('TELNYX_API_KEY') ?: 'My API Key');
try {
$availablePhoneNumberBlocks = $client->availablePhoneNumberBlocks->list(
filter: [
'countryCode' => 'country_code',
'locality' => 'locality',
'nationalDestinationCode' => 'national_destination_code',
'phoneNumberType' => 'local',
],
);
var_dump($availablePhoneNumberBlocks);
} catch (APIException $e) {
echo $e->getMessage();
}telnyx available-phone-number-blocks list \
--api-key 'My API Key'curl --request GET \
--url https://api.telnyx.com/v2/available_phone_number_blocks \
--header 'Authorization: Bearer <token>'{
"data": [
{
"record_type": "available_phone_number_block",
"phone_number": "+19705555000",
"range": 10,
"region_information": [
{
"region_type": "country_code",
"region_name": "US"
}
],
"cost_information": {
"upfront_cost": "3.21",
"monthly_cost": "6.54",
"currency": "USD"
},
"features": [
{
"name": "sms"
},
{
"name": "voice"
}
]
}
],
"meta": {
"total_results": 100,
"best_effort_results": 50
}
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}{
"errors": [
{
"code": "10009",
"title": "Authentication failed",
"detail": "Could not understand the provided credentials.",
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10009"
}
}
]
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}{
"errors": [
{
"code": "10007",
"title": "Unexpected error",
"detail": "An unexpected error occured.",
"source": {
"pointer": "/base",
"parameter": "<string>"
},
"meta": {
"url": "https://developers.telnyx.com/docs/overview/errors/10015"
}
}
]
}