Skip to contentSkip to navigationSkip to topbar
On this page

Pricing: Trunking Resource


The Pricing Trunking resource provides a simple API to pull real-time, account-specific pricing for Twilio's Elastic SIP Trunking.

Prices can be retrieved at a country level via the Pricing Trunking Countries resource or for a specific phone number via the Pricing Trunking Numbers resource.

You may also wish to check out our Pricing API resources for Twilio's Voice, Messaging and Phone Number products.

Looking for details on pricing for Twilio products? Check out Twilio's pricing page(link takes you to an external page).


Base URL

base-url page anchor

All URLs in the reference documentation use the following base URL:

https://pricing.twilio.com/v2/trunking

HTTP requests to the REST API are protected with HTTP Basic authentication(link takes you to an external page). To learn more about how Twilio handles authentication, please refer to our security documentation. In short, you will use your Twilio account SID as the username and your auth token as the password for HTTP Basic authentication.

1
curl -G https://pricing.twilio.com/v2/Trunking/Countries/US \
2
-u '[YOUR ACCOUNT SID]:[YOUR AUTH TOKEN]'
3

You can find your account SID and auth token on your dashboard(link takes you to an external page).


Pricing Trunking Country List Resource

pricing-trunking-country-list page anchor

Resource URL

list-uri page anchor
1
https://pricing.twilio.com/v2/Trunking/Countries
2

This resource returns a list of countries where Twilio trunking services are available and the corresponding URL for retrieving the country specific trunking prices. This list includes paging information.

Retrieve a list of countries where Twilio trunking services are available.

Read CountryLink to code sample: Read Country
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function listTrunkingCountry() {
11
const countries = await client.pricing.v2.countries.list({ limit: 20 });
12
13
countries.forEach((c) => console.log(c.country));
14
}
15
16
listTrunkingCountry();

Output

1
{
2
"countries": [
3
{
4
"country": "Andorra",
5
"iso_country": "AD",
6
"url": "https://pricing.twilio.com/v2/Trunking/Countries/AD"
7
}
8
],
9
"meta": {
10
"first_page_url": "https://pricing.twilio.com/v2/Trunking/Countries?PageSize=50&Page=0",
11
"key": "countries",
12
"next_page_url": null,
13
"page": 0,
14
"page_size": 50,
15
"previous_page_url": null,
16
"url": "https://pricing.twilio.com/v2/Trunking/Countries?PageSize=50&Page=0"
17
}
18
}

Get Prices for Individual Countries

get-prices-for-individual-countries page anchor

You can also retrieve pricing information for individual countries.

Get Trunking Prices for Individual CountriesLink to code sample: Get Trunking Prices for Individual Countries
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function fetchTrunkingCountry() {
11
const country = await client.pricing.v2.countries("BB").fetch();
12
13
console.log(country.country);
14
}
15
16
fetchTrunkingCountry();

Output

1
{
2
"country": "United States",
3
"originating_call_prices": [
4
{
5
"base_price": null,
6
"current_price": "0.0085",
7
"number_type": "local"
8
},
9
{
10
"base_price": null,
11
"current_price": "0.022",
12
"number_type": "toll free"
13
}
14
],
15
"iso_country": "BB",
16
"terminating_prefix_prices": [
17
{
18
"base_price": null,
19
"current_price": "0.090",
20
"destination_prefixes": [
21
"1907"
22
],
23
"friendly_name": "Outbound Trunking Minute - United States - Alaska",
24
"origination_prefixes": [
25
"ALL"
26
]
27
},
28
{
29
"base_price": null,
30
"current_price": "0.013",
31
"destination_prefixes": [
32
"1808"
33
],
34
"friendly_name": "Outbound Trunking Minute - United States - Hawaii",
35
"origination_prefixes": [
36
"ALL"
37
]
38
},
39
{
40
"base_price": null,
41
"current_price": "0.013",
42
"destination_prefixes": [
43
"1800",
44
"1844",
45
"1855",
46
"1866",
47
"1877",
48
"1888"
49
],
50
"friendly_name": "Outbound Trunking Minute - United States & Canada - Toll Free",
51
"origination_prefixes": [
52
"ALL"
53
]
54
},
55
{
56
"base_price": null,
57
"current_price": "0.013",
58
"destination_prefixes": [
59
"1"
60
],
61
"friendly_name": "Outbound Trunking Minute - United States & Canada",
62
"origination_prefixes": [
63
"ALL"
64
]
65
}
66
],
67
"price_unit": "USD",
68
"url": "https://pricing.twilio.com/v2/Trunking/Countries/US"
69
}

Pricing Trunking Country Instance Resource

pricing-trunking-country-instance page anchor
1
https://pricing.twilio.com/v2/Trunking/Countries/{Country}
2

where {Country} is the ISO 3166-1 alpha-2 format(link takes you to an external page) country code

This resource represents prices to make trunking calls to phone numbers in a given country, organized by phone number prefix (TerminatingPrefixPriceWithOrigin), and the prices to receive trunking calls on Twilio phone numbers in this country, organized by phone number type (OriginatingCallPrices).

A Pricing Trunking Country resource is represented by the following properties:

Property nameTypeRequiredDescriptionChild properties
countrystringOptional
Not PII

The name of the country.


iso_countrystring<iso-country-code>Optional

urlstring<uri>Optional

The absolute URL of the resource.


terminating_prefix_pricesarray[object<outbound-prefix-price-with-origin>]Optional

The list of TerminatingPrefixPrice records.


originating_call_pricesarray[object<inbound-call-price>]Optional

The list of OriginatingCallPrice records.


price_unitstring<currency>Optional

The currency in which prices are measured, specified in ISO 4127(link takes you to an external page) format (e.g. usd, eur, jpy).

TerminatingPrefixPrices record

terminating-prefix-prices page anchor
PropertyDescription
DestinationPrefixesSet of destination phone number prefixes for the requested country with the same pricing
OriginationPrefixesSet of origination phone number prefixes for the requested country with the same pricing. Valid set elements include specific prefixes, ALL (representing the entire set of all valid prefixes), or ROW (representing the rest-of-world, which is the set of remaining prefixes that aren't specifically listed)
FriendlyNameDescriptive text for this set of prefixes
BasePriceIn the current version of the API, this value will always be null
CurrentPriceThe current price per minute (which accounts for any volume or custom price discounts) to make a call to numbers matching this prefix list.

OriginatingCallPrice record

originating-call-price page anchor
PropertyDescription
NumberTypeThe phone number type, either local, mobile, national, or toll free
BasePriceIn the current version of the API, this value will always be null
CurrentPriceThe current price per minute (which accounts for any volume or custom price discounts) to receive a call to this phone number type.

Pricing Trunking Number Instance Resource

pricing-trunking-number-instance page anchor

This resource represents the prices to make trunking calls to a given phone number (TerminatingPrefixPrices) and the prices to receive trunking calls to this Twilio phone number (OriginatingCallPrice).

1
https://pricing.twilio.com/v2/Trunking/Numbers/{Phone Number}
2

where {Phone Number} is the phone number in E.164(link takes you to an external page) format

Property nameTypeRequiredDescriptionChild properties
destination_numberstring<phone-number>Optional

The destination phone number in E.164 format, which consists of a + followed by the country code and subscriber number.


origination_numberstring<phone-number>Optional

The origination phone number in [E.164 format, which consists of a + followed by the country code and subscriber number.


countrystringOptional

The name of the country.


iso_countrystring<iso-country-code>Optional

terminating_prefix_pricesarray[object<outbound-prefix-price-with-origin>]Optional

originating_call_priceobject<inbound-call-price>Optional

price_unitstring<currency>Optional

The currency in which prices are measured, specified in ISO 4127(link takes you to an external page) format (e.g. usd, eur, jpy).


urlstring<uri>Optional

The absolute URL of the resource.

TerminatingCallPrices record

terminating-call-prices page anchor
PropertyDescription
BasePriceIn the current version of the API, this value will always be null
CurrentPriceThe current price per minute (which accounts for any volume or custom price discounts) to make a call to this number
OriginationPrefixesSet of origination phone number prefixes for the requested country with the same pricing. Valid set elements include specific prefixes, ALL (representing the entire set of all valid prefixes), or ROW (representing the rest-of-world, which is the set of remaining prefixes that aren't specifically listed)

Retrieve trunking prices for phone number +15108675310.

1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function fetchTrunkingNumber() {
11
const number = await client.pricing.v2.numbers("+15017122661").fetch();
12
13
console.log(number.destinationNumber);
14
}
15
16
fetchTrunkingNumber();

Output

1
{
2
"country": "United States",
3
"destination_number": "+15017122661",
4
"originating_call_price": {
5
"base_price": null,
6
"current_price": null,
7
"number_type": null
8
},
9
"iso_country": "US",
10
"origination_number": null,
11
"terminating_prefix_prices": [
12
{
13
"base_price": null,
14
"current_price": "0.013",
15
"destination_prefixes": [
16
"1800"
17
],
18
"friendly_name": "Trunking Outbound Minute - United States Zone 1b",
19
"origination_prefixes": [
20
"ALL"
21
]
22
}
23
],
24
"price_unit": "USD",
25
"url": "https://pricing.twilio.com/v2/Trunking/Numbers/+18001234567"
26
}

Resource URL by Origination Number

list-uri-by-origination-number page anchor
1
https://pricing.twilio.com/v2/Trunking/Numbers/{Destination Number}?OriginationNumber={Origination Number}
2

Filter by Origination Number Example

filter-by-origination-number-example page anchor

Retrieve trunking prices for phone number +15108675310 where the Origination Number is +18001234567.

Get Trunking Prices for Number by Origination NumberLink to code sample: Get Trunking Prices for Number by Origination Number
1
// Download the helper library from https://www.twilio.com/docs/node/install
2
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
3
4
// Find your Account SID and Auth Token at twilio.com/console
5
// and set the environment variables. See http://twil.io/secure
6
const accountSid = process.env.TWILIO_ACCOUNT_SID;
7
const authToken = process.env.TWILIO_AUTH_TOKEN;
8
const client = twilio(accountSid, authToken);
9
10
async function fetchTrunkingNumber() {
11
const number = await client.pricing.v2
12
.numbers("+11111111111")
13
.fetch({ originationNumber: "+15108675310" });
14
15
console.log(number.destinationNumber);
16
}
17
18
fetchTrunkingNumber();

Output

1
{
2
"country": "United States",
3
"destination_number": "+11111111111",
4
"originating_call_price": {
5
"base_price": null,
6
"current_price": null,
7
"number_type": null
8
},
9
"iso_country": "US",
10
"origination_number": "+15108675310",
11
"terminating_prefix_prices": [
12
{
13
"base_price": null,
14
"current_price": "0.013",
15
"destination_prefixes": [
16
"1800"
17
],
18
"friendly_name": "Trunking Outbound Minute - United States Zone 1b",
19
"origination_prefixes": [
20
"ALL"
21
]
22
}
23
],
24
"price_unit": "USD",
25
"url": "https://pricing.twilio.com/v2/Trunking/Numbers/+18001234567"
26
}

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.