VoiceNumber Resource
On this reference page, you'll learn the methods and pricing details available through the VoiceNumber Resource. See Related how-to documentation to learn the steps to use the info on this page.
Property nameTypeRequiredPIIDescriptionChild properties
The destination phone number in E.164 format, which consists of a + followed by the country code and subscriber number.
The origination phone number in [E.164 format, which consists of a + followed by the country code and subscriber number.
The currency in which prices are measured, specified in ISO 4127 format (e.g. usd, eur, jpy).
The absolute URL of the resource.
GET https://pricing.twilio.com/v2/Voice/Numbers/{DestinationNumber}
Property nameTypeRequiredPIIDescription
1// Download the helper library from https://www.twilio.com/docs/node/install2const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";34// Find your Account SID at twilio.com/console5// Provision API Keys at twilio.com/console/runtime/api-keys6// and set the environment variables. See http://twil.io/secure7// For local testing, you can use your Account SID and Auth token8const accountSid = process.env.TWILIO_ACCOUNT_SID;9const apiKey = process.env.TWILIO_API_KEY;10const apiSecret = process.env.TWILIO_API_SECRET;11const client = twilio(apiKey, apiSecret, { accountSid: accountSid });1213async function fetchVoiceNumber() {14const number = await client.pricing.v2.voice.numbers("+11111111111").fetch();1516console.log(number.destinationNumber);17}1819fetchVoiceNumber();
Response
1{2"country": "United States",3"destination_number": "+11111111111",4"inbound_call_price": {5"base_price": null,6"current_price": null,7"number_type": null8},9"iso_country": "US",10"origination_number": "+987654321",11"outbound_call_prices": [12{13"base_price": "0.013",14"current_price": "0.013",15"origination_prefixes": [16"ALL"17]18}19],20"price_unit": "USD",21"url": "https://pricing.twilio.com/v2/Voice/Numbers/+18001234567"22}