Pricing: Phone Numbers Resource

The Pricing Phone Numbers resource provides a simple API to pull real-time, account-specific pricing for Twilio's phone numbers.

Prices can be retrieved at a country level via the Pricing Phone Numbers Countries resource.

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

Looking for details on pricing for Twilio products? Check out Twilio's pricing page.

ベースURL

リファレンスドキュメントの URL はすべて、次のベース URL を使用しています。

https://pricing.twilio.com/v1

認証

REST APIへのHTTPリクエストはHTTPのBasic認証により保護されます。Twilioが認証を処理する方法を確認するには、セキュリティードキュメントを参照してください。つまり、HTTPのBasic認証にはアカウントSIDをユーザー名として、そして認証トークンをパスワードとして使用するということです。

curl -G https://pricing.twilio.com/v1/PhoneNumbers/Countries/US \
    -u '[YOUR ACCOUNT SID]:[YOUR AUTH TOKEN]'

You can find your account SID and auth token on your dashboard.

Pricing Phone Numbers Country Instance Resource

このリソースは、電話番号タイプ別の特定の国の Twilio 電話番号料金(PhoneNumberPrices)を表します。

リソース URL

https://pricing.twilio.com/v1/PhoneNumbers/Countries/{Country}

{Country} は、ISO 3166-1 alpha-2 フォーマットの国コードです。

Pricing Phone Numbers Country リソースには、次のプロパティがあります。

名前 概要

Name of the country (not PII)

iso_country

The ISO country code of this number (not PII)

phone_number_prices

List of PhoneNumberPrice records (not PII)

price_unit

The currency in which prices are measured, in ISO 4127 format (e.g. usd, eur, jpy). (not PII)

PhoneNumberPrice record

プロパティ 概要
NumberType 電話番号タイプです(localmobilenational、または toll free のいずれか)。
BasePrice この Twilio 電話番号タイプの 1 ヶ月あたりの小売料金です。
CurrentPrice この Twilio 電話番号タイプの現在の 1 ヶ月あたりの料金(数量割引またはカスタム割引の適用対象)です。

コードサンプルを読み込んでいます...
Language
SDKバージョン:
  • 4.x
  • 5.x
レスポンス形式:
  • JSON
SDKバージョン:
  • 6.x
  • 7.x
SDKバージョン:
  • 2.x
  • 3.x
SDKバージョン:
  • 4.x
  • 5.x
SDKバージョン:
  • 5.x
  • 6.x
SDKバージョン:
  • 4.x
  • 5.x
形式:
  • JSON
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const PricingClient = require('twilio').PricingClient;
const client = new PricingClient(accountSid, authToken);

client.phoneNumbers.countries('US').get((err, country) => {
  country.phoneNumberPrices.forEach(phonePrices => {
    console.log(phonePrices.numberType + ' ' + phonePrices.currentPrice + '\n');
  });
});
// Get your Account SID and Auth Token from twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';

// Get twilio-node from twilio.com/docs/libraries/node
const client = require('twilio')(accountSid, authToken).pricing;

client.phoneNumbers
  .countries('US')
  .fetch()
  .then(country => {
    country.phoneNumberPrices.forEach(price => {
      console.log(`${price.number_type} ${price.current_price}`);
    });
  })
  .catch(error => {
    console.log(error);
    throw error;
  });
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
using Twilio.Pricing;

class Example
{
  static void Main(string[] args)
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    const string authToken = "your_auth_token";
    var pricingClient = new PricingClient(accountSid, authToken);

    // Look up pricing information for the US
    var country = pricingClient.GetPhoneNumberCountry("US");
    // Print number pricing for this country
    foreach (PhoneNumberPrice p in country.PhoneNumberPrices)
    {
        Console.WriteLine(p.NumberType);
        Console.WriteLine(p.CurrentPrice);
    } 
  }
}
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Pricing_Services_Twilio($sid, $token);

$country = $client->phoneNumberCountries->get("US");

foreach ($country->phone_number_prices as $p) {
    echo $p->number_type . " " . $p->current_price . "\n";
}
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::PricingClient.new account_sid, auth_token

@country = @client.phone_numbers.countries.get('US')
@country.phone_number_prices.each do |p|
  puts "#{p['number_type']} #{p['current_price']}"
end
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using Twilio;
using Twilio.Rest.Pricing.V1.Messaging;

public class Example
{
    public static void Main(string[] args)
    {
        // Find your Account SID and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";

        TwilioClient.Init(accountSid, authToken);

        var country = CountryResource.Fetch("EE");

        foreach (var price in country.InboundSmsPrices)
        {
            Console.WriteLine(price.CurrentPrice);
        }
    }
}
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
require_once '/path/to/vendor/autoload.php'; // Loads the library

use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";

$client = new Client($sid, $token);

$country = $client->pricing->phoneNumbers->countries("US")->fetch();

foreach ($country->phoneNumberPrices as $p) {
    echo "{$p["number_type"]} {$p["current_price"]}\n";
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioPricingClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = TwilioPricingClient(account_sid, auth_token)

country = client.phone_numbers.countries.get("US")

for p in country.phone_number_prices:
    print("{} {}".format(p['number_type'], p['current_price']))
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'twilio-ruby'

# Get your Account SID and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new(account_sid, auth_token)

country = @client.pricing.phone_numbers.countries('US')
country.fetch.phone_number_prices.each do |p|
  puts "#{p['number_type']} #{p['current_price']}"
end
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioPricingClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.pricing.PhoneNumberCountry;

public class Example {

	// Find your Account Sid and Token at twilio.com/user/account
	public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
	public static final String AUTH_TOKEN = "your_auth_token";

	public static void main(String[] args) throws TwilioRestException {
		TwilioPricingClient client = new TwilioPricingClient(ACCOUNT_SID, AUTH_TOKEN);

		// Get Twilio PhoneNumber pricing information for a specific country
		PhoneNumberCountry c = client.getPhoneNumberCountry("US");

		for (PhoneNumberCountry.NumberPrice p : c.getPhoneNumberPrices()) {
			// For each number type, print the type and its current price
			System.out.println(p.getNumberType().toString());
			System.out.println(p.getCurrentPrice().toString());
		}
	}
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

country = client.pricing \
                .phone_numbers \
                .countries("US") \
                .fetch()

for p in country.phone_number_prices:
    print("{} {}".format(p['type'], p['current_price']))
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.rest.pricing.v1.phonenumber.Country;
import com.twilio.type.PhoneNumberPrice;

public class Example {
  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    // Get Twilio PhoneNumber pricing information for a specific country
    Country country = Country.fetcher("US").fetch();

    for (PhoneNumberPrice p : country.getPhoneNumberPrices()) {
      // For each number type, print the type and its current price
      System.out.println(p.getType());
      System.out.println(p.getCurrentPrice());
    }
  }
}
curl -XGET https://pricing.twilio.com/v1/PhoneNumbers/Countries/US \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
{
    "country": "United States",
    "iso_country": "US",
    "phone_number_prices": [
        {
            "number_type": "local",
            "base_price": "1.00",
            "current_price": "1.00"
        },
        {
            "number_type": "toll free",
            "base_price": "2.00",
            "current_price": "2.00"
        }
    ],
    "price_unit": "USD",
    "url": "https://pricing.twilio.com/v1/PhoneNumbers/Countries/US"
}
米国向けの電話番号料金を取得する

Pricing Phone Numbers Country List Resource

リソース URL

https://pricing.twilio.com/v1/PhoneNumbers/Countries

HTTP GET

Twilio 電話番号がサポートされている国のリストを返します。このリストはページ情報を含みます。

Twilio 電話番号がサポートされている国のリストを取得します。

コードサンプルを読み込んでいます...
Language
SDKバージョン:
  • 4.x
  • 5.x
レスポンス形式:
  • JSON
SDKバージョン:
  • 6.x
  • 7.x
SDKバージョン:
  • 2.x
  • 3.x
SDKバージョン:
  • 4.x
  • 5.x
SDKバージョン:
  • 5.x
  • 6.x
SDKバージョン:
  • 4.x
  • 5.x
形式:
  • JSON
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const PricingClient = require('twilio').PricingClient;
const client = new PricingClient(accountSid, authToken);

client.phoneNumbers.countries.list((error, countries) => {
  countries['countries'].forEach(c => {
    console.log(c.isoCountry + '\n');
  });
});
// Get your Account SID and Auth Token from twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';

// Get twilio-node from twilio.com/docs/libraries/node
const client = require('twilio')(accountSid, authToken).pricing;

client.phoneNumbers.countries
  .list()
  .then(countries => {
    countries.forEach(country => {
      console.log(country.isoCountry);
    });
  })
  .catch(error => {
    console.log(error);
    throw error;
  });
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio.Pricing;

class Example
{
  static void Main(string[] args)
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account 
    const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    const string authToken = "your_auth_token";
    var pricingClient = new PricingClient(accountSid, authToken);

    // List countries where Twilio Phone Numbers are available
    var result = pricingClient.ListPhoneNumberCountries();
    foreach (PhoneNumberCountry c in result.Countries)
    {
        Console.WriteLine(c.IsoCountry);
    }
  }
}
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Pricing_Services_Twilio($sid, $token);

foreach ($client->phoneNumberCountries as $c) {
    echo $c->iso_country . "\n";
}
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::PricingClient.new account_sid, auth_token

@countries = @client.phone_numbers.countries.list
@countries.each do |c|
  puts c.iso_country
end
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using Twilio;
using Twilio.Rest.Pricing.V1.PhoneNumber;

public class Example
{
    public static void Main(string[] args)
    {
        // Find your Account SID and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";

        TwilioClient.Init(accountSid, authToken);

        var countries = CountryResource.Read();

        foreach (var country in countries)
        {
            Console.WriteLine(country.IsoCountry);
        }
    }
}
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
require_once '/path/to/vendor/autoload.php'; // Loads the library

use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";

$client = new Client($sid, $token);

$phoneNumberCountries = $client->pricing->phoneNumbers->countries->read();

foreach ($phoneNumberCountries as $c) {
    echo $c->isoCountry . PHP_EOL;
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioPricingClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = TwilioPricingClient(account_sid, auth_token)

countries = client.phone_numbers.countries.list()

for c in countries:
    print(c.iso_country)
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'twilio-ruby'

# Get your Account SID and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new(account_sid, auth_token)

countries = @client.pricing.phone_numbers.countries.list
countries.each do |c|
  puts c.iso_country
end
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioPricingClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.list.pricing.PhoneNumberCountryList;
import com.twilio.sdk.resource.instance.pricing.PhoneNumberCountry;

public class Example {

	// Find your Account Sid and Token at twilio.com/user/account
	public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
	public static final String AUTH_TOKEN = "your_auth_token";

	public static void main(String[] args) throws TwilioRestException {
		TwilioPricingClient client = new TwilioPricingClient(ACCOUNT_SID, AUTH_TOKEN);

		// Get a list of countries where Twilio Numbers are available
		PhoneNumberCountryList list = client.getPhoneNumberCountries();

		for (PhoneNumberCountry c : list.getPageData()) {
			System.out.println(c.getIsoCountry());
		}
	}
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

phone_number_countries = client.pricing \
                               .phone_numbers \
                               .countries \
                               .list()

for country in phone_number_countries:
    print(country.iso_country)
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.base.ResourceSet;
import com.twilio.rest.pricing.v1.phonenumber.Country;

public class Example {
  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    // Get a list of countries where Twilio Numbers are available
    ResourceSet<Country> countries = Country.reader().read();

    for (Country country : countries) {
      System.out.println(country.getIsoCountry());
    }
  }
}
curl -XGET https://pricing.twilio.com/v1/PhoneNumbers/Countries \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
{
    "meta": {
        "page": 0,
        "page_size": 50,
        "first_page_url": "https://pricing.twilio.com/v1/PhoneNumbers/Countries?PageSize=50&Page=0",
        "previous_page_url": null,
        "url": "https://pricing.twilio.com/v1/PhoneNumbers/Countries?PageSize=50&Page=0",
        "next_page_url": null,
        "key": "countries"
    },
    "countries": [
        {
            "country": "Austria",
            "iso_country": "AT",
            "url": "https://pricing.twilio.com/v1/PhoneNumbers/Countries/AT"
        },
        {
            "country": "Australia",
            "iso_country": "AU",
            "url": "https://pricing.twilio.com/v1/PhoneNumbers/Countries/AU"
        },
	...
     ]
}
Twilio番号の用意されている国を一覧する

ヘルプが必要ですか?

誰しもが一度は考える「コーディングって難しい」。そんな時は、お問い合わせフォームから質問してください。 または、Stack Overflow でTwilioタグのついた情報から欲しいものを探してみましょう。

コードサンプルを読み込んでいます...
SDKバージョン:
  • 4.x
  • 5.x
レスポンス形式:
  • JSON
SDKバージョン:
  • 6.x
  • 7.x
SDKバージョン:
  • 2.x
  • 3.x
SDKバージョン:
  • 4.x
  • 5.x
SDKバージョン:
  • 5.x
  • 6.x
SDKバージョン:
  • 4.x
  • 5.x
形式:
  • JSON
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const PricingClient = require('twilio').PricingClient;
const client = new PricingClient(accountSid, authToken);

client.phoneNumbers.countries('US').get((err, country) => {
  country.phoneNumberPrices.forEach(phonePrices => {
    console.log(phonePrices.numberType + ' ' + phonePrices.currentPrice + '\n');
  });
});
// Get your Account SID and Auth Token from twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';

// Get twilio-node from twilio.com/docs/libraries/node
const client = require('twilio')(accountSid, authToken).pricing;

client.phoneNumbers
  .countries('US')
  .fetch()
  .then(country => {
    country.phoneNumberPrices.forEach(price => {
      console.log(`${price.number_type} ${price.current_price}`);
    });
  })
  .catch(error => {
    console.log(error);
    throw error;
  });
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio;
using Twilio.Pricing;

class Example
{
  static void Main(string[] args)
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account
    const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    const string authToken = "your_auth_token";
    var pricingClient = new PricingClient(accountSid, authToken);

    // Look up pricing information for the US
    var country = pricingClient.GetPhoneNumberCountry("US");
    // Print number pricing for this country
    foreach (PhoneNumberPrice p in country.PhoneNumberPrices)
    {
        Console.WriteLine(p.NumberType);
        Console.WriteLine(p.CurrentPrice);
    } 
  }
}
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Pricing_Services_Twilio($sid, $token);

$country = $client->phoneNumberCountries->get("US");

foreach ($country->phone_number_prices as $p) {
    echo $p->number_type . " " . $p->current_price . "\n";
}
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::PricingClient.new account_sid, auth_token

@country = @client.phone_numbers.countries.get('US')
@country.phone_number_prices.each do |p|
  puts "#{p['number_type']} #{p['current_price']}"
end
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using Twilio;
using Twilio.Rest.Pricing.V1.Messaging;

public class Example
{
    public static void Main(string[] args)
    {
        // Find your Account SID and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";

        TwilioClient.Init(accountSid, authToken);

        var country = CountryResource.Fetch("EE");

        foreach (var price in country.InboundSmsPrices)
        {
            Console.WriteLine(price.CurrentPrice);
        }
    }
}
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
require_once '/path/to/vendor/autoload.php'; // Loads the library

use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";

$client = new Client($sid, $token);

$country = $client->pricing->phoneNumbers->countries("US")->fetch();

foreach ($country->phoneNumberPrices as $p) {
    echo "{$p["number_type"]} {$p["current_price"]}\n";
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioPricingClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = TwilioPricingClient(account_sid, auth_token)

country = client.phone_numbers.countries.get("US")

for p in country.phone_number_prices:
    print("{} {}".format(p['number_type'], p['current_price']))
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'twilio-ruby'

# Get your Account SID and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new(account_sid, auth_token)

country = @client.pricing.phone_numbers.countries('US')
country.fetch.phone_number_prices.each do |p|
  puts "#{p['number_type']} #{p['current_price']}"
end
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioPricingClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.instance.pricing.PhoneNumberCountry;

public class Example {

	// Find your Account Sid and Token at twilio.com/user/account
	public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
	public static final String AUTH_TOKEN = "your_auth_token";

	public static void main(String[] args) throws TwilioRestException {
		TwilioPricingClient client = new TwilioPricingClient(ACCOUNT_SID, AUTH_TOKEN);

		// Get Twilio PhoneNumber pricing information for a specific country
		PhoneNumberCountry c = client.getPhoneNumberCountry("US");

		for (PhoneNumberCountry.NumberPrice p : c.getPhoneNumberPrices()) {
			// For each number type, print the type and its current price
			System.out.println(p.getNumberType().toString());
			System.out.println(p.getCurrentPrice().toString());
		}
	}
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

country = client.pricing \
                .phone_numbers \
                .countries("US") \
                .fetch()

for p in country.phone_number_prices:
    print("{} {}".format(p['type'], p['current_price']))
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.rest.pricing.v1.phonenumber.Country;
import com.twilio.type.PhoneNumberPrice;

public class Example {
  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    // Get Twilio PhoneNumber pricing information for a specific country
    Country country = Country.fetcher("US").fetch();

    for (PhoneNumberPrice p : country.getPhoneNumberPrices()) {
      // For each number type, print the type and its current price
      System.out.println(p.getType());
      System.out.println(p.getCurrentPrice());
    }
  }
}
curl -XGET https://pricing.twilio.com/v1/PhoneNumbers/Countries/US \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
{
    "country": "United States",
    "iso_country": "US",
    "phone_number_prices": [
        {
            "number_type": "local",
            "base_price": "1.00",
            "current_price": "1.00"
        },
        {
            "number_type": "toll free",
            "base_price": "2.00",
            "current_price": "2.00"
        }
    ],
    "price_unit": "USD",
    "url": "https://pricing.twilio.com/v1/PhoneNumbers/Countries/US"
}
SDKバージョン:
  • 4.x
  • 5.x
レスポンス形式:
  • JSON
SDKバージョン:
  • 6.x
  • 7.x
SDKバージョン:
  • 2.x
  • 3.x
SDKバージョン:
  • 4.x
  • 5.x
SDKバージョン:
  • 5.x
  • 6.x
SDKバージョン:
  • 4.x
  • 5.x
形式:
  • JSON
// Download the Node helper library from twilio.com/docs/node/install
// These vars are your accountSid and authToken from twilio.com/user/account
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';
const PricingClient = require('twilio').PricingClient;
const client = new PricingClient(accountSid, authToken);

client.phoneNumbers.countries.list((error, countries) => {
  countries['countries'].forEach(c => {
    console.log(c.isoCountry + '\n');
  });
});
// Get your Account SID and Auth Token from twilio.com/console
const accountSid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX';
const authToken = 'your_auth_token';

// Get twilio-node from twilio.com/docs/libraries/node
const client = require('twilio')(accountSid, authToken).pricing;

client.phoneNumbers.countries
  .list()
  .then(countries => {
    countries.forEach(country => {
      console.log(country.isoCountry);
    });
  })
  .catch(error => {
    console.log(error);
    throw error;
  });
// Download the twilio-csharp library from twilio.com/docs/csharp/install
using System;
using Twilio.Pricing;

class Example
{
  static void Main(string[] args)
  {
    // Find your Account Sid and Auth Token at twilio.com/user/account 
    const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
    const string authToken = "your_auth_token";
    var pricingClient = new PricingClient(accountSid, authToken);

    // List countries where Twilio Phone Numbers are available
    var result = pricingClient.ListPhoneNumberCountries();
    foreach (PhoneNumberCountry c in result.Countries)
    {
        Console.WriteLine(c.IsoCountry);
    }
  }
}
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
require_once('/path/to/twilio-php/Services/Twilio.php'); // Loads the library

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";
$client = new Pricing_Services_Twilio($sid, $token);

foreach ($client->phoneNumberCountries as $c) {
    echo $c->iso_country . "\n";
}
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'twilio-ruby'

# Get your Account Sid and Auth Token from twilio.com/user/account
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::PricingClient.new account_sid, auth_token

@countries = @client.phone_numbers.countries.list
@countries.each do |c|
  puts c.iso_country
end
// Download the twilio-csharp library from twilio.com/docs/libraries/csharp
using System;
using Twilio;
using Twilio.Rest.Pricing.V1.PhoneNumber;

public class Example
{
    public static void Main(string[] args)
    {
        // Find your Account SID and Auth Token at twilio.com/console
        const string accountSid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
        const string authToken = "your_auth_token";

        TwilioClient.Init(accountSid, authToken);

        var countries = CountryResource.Read();

        foreach (var country in countries)
        {
            Console.WriteLine(country.IsoCountry);
        }
    }
}
<?php
// Get the PHP helper library from https://twilio.com/docs/libraries/php
require_once '/path/to/vendor/autoload.php'; // Loads the library

use Twilio\Rest\Client;

// Your Account Sid and Auth Token from twilio.com/user/account
$sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
$token = "your_auth_token";

$client = new Client($sid, $token);

$phoneNumberCountries = $client->pricing->phoneNumbers->countries->read();

foreach ($phoneNumberCountries as $c) {
    echo $c->isoCountry . PHP_EOL;
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import TwilioPricingClient

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = TwilioPricingClient(account_sid, auth_token)

countries = client.phone_numbers.countries.list()

for c in countries:
    print(c.iso_country)
# Get twilio-ruby from twilio.com/docs/ruby/install
require 'twilio-ruby'

# Get your Account SID and Auth Token from twilio.com/console
account_sid = 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX'
auth_token = 'your_auth_token'
@client = Twilio::REST::Client.new(account_sid, auth_token)

countries = @client.pricing.phone_numbers.countries.list
countries.each do |c|
  puts c.iso_country
end
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.sdk.TwilioPricingClient;
import com.twilio.sdk.TwilioRestException;
import com.twilio.sdk.resource.list.pricing.PhoneNumberCountryList;
import com.twilio.sdk.resource.instance.pricing.PhoneNumberCountry;

public class Example {

	// Find your Account Sid and Token at twilio.com/user/account
	public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
	public static final String AUTH_TOKEN = "your_auth_token";

	public static void main(String[] args) throws TwilioRestException {
		TwilioPricingClient client = new TwilioPricingClient(ACCOUNT_SID, AUTH_TOKEN);

		// Get a list of countries where Twilio Numbers are available
		PhoneNumberCountryList list = client.getPhoneNumberCountries();

		for (PhoneNumberCountry c : list.getPageData()) {
			System.out.println(c.getIsoCountry());
		}
	}
}
# Download the Python helper library from twilio.com/docs/python/install
from twilio.rest import Client

# Your Account Sid and Auth Token from twilio.com/user/account
account_sid = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX"
auth_token = "your_auth_token"
client = Client(account_sid, auth_token)

phone_number_countries = client.pricing \
                               .phone_numbers \
                               .countries \
                               .list()

for country in phone_number_countries:
    print(country.iso_country)
// Install the Java helper library from twilio.com/docs/java/install
import com.twilio.Twilio;
import com.twilio.base.ResourceSet;
import com.twilio.rest.pricing.v1.phonenumber.Country;

public class Example {
  // Find your Account Sid and Token at twilio.com/user/account
  public static final String ACCOUNT_SID = "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX";
  public static final String AUTH_TOKEN = "your_auth_token";

  public static void main(String[] args) {
    Twilio.init(ACCOUNT_SID, AUTH_TOKEN);

    // Get a list of countries where Twilio Numbers are available
    ResourceSet<Country> countries = Country.reader().read();

    for (Country country : countries) {
      System.out.println(country.getIsoCountry());
    }
  }
}
curl -XGET https://pricing.twilio.com/v1/PhoneNumbers/Countries \
    -u 'ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX:your_auth_token'
{
    "meta": {
        "page": 0,
        "page_size": 50,
        "first_page_url": "https://pricing.twilio.com/v1/PhoneNumbers/Countries?PageSize=50&Page=0",
        "previous_page_url": null,
        "url": "https://pricing.twilio.com/v1/PhoneNumbers/Countries?PageSize=50&Page=0",
        "next_page_url": null,
        "key": "countries"
    },
    "countries": [
        {
            "country": "Austria",
            "iso_country": "AT",
            "url": "https://pricing.twilio.com/v1/PhoneNumbers/Countries/AT"
        },
        {
            "country": "Australia",
            "iso_country": "AU",
            "url": "https://pricing.twilio.com/v1/PhoneNumbers/Countries/AU"
        },
	...
     ]
}