Skip to contentSkip to navigationSkip to topbar
On this page

Inbound Processing Region API - PhoneNumber


In the context of the Inbound Processing Region API, a PhoneNumber resource represents the routing configuration for a particular IncomingPhoneNumber.

By adjusting the value of the voice_region property, you can control which Twilio Region will process and store data related to inbound calls for the phone number.

(warning)

Warning

Changes to this resource may take up to 5 minutes to take effect.


PhoneNumber Properties

phonenumber-properties page anchor
Property nameTypeRequiredDescriptionChild properties
phone_numberstring

Optional

Not PII

The phone number in E.164 format


urlstring<uri>

Optional

The absolute URL of the resource.


sidSID<QQ>

Optional

A 34 character string that uniquely identifies the Inbound Processing Region assignments for this phone number.

Pattern: ^QQ[0-9a-fA-F]{32}$Min length: 34Max length: 34

account_sidSID<AC>

Optional

The unique SID identifier of the Account.

Pattern: ^AC[0-9a-fA-F]{32}$Min length: 34Max length: 34

friendly_namestring

Optional

A human readable description of the Inbound Processing Region assignments for this phone number, up to 64 characters.


voice_regionstring

Optional

The Inbound Processing Region used for this phone number for voice.


date_createdstring<date-time>

Optional

The date that this phone number was assigned an Inbound Processing Region, given in ISO 8601 format.


date_updatedstring<date-time>

Optional

The date that the Inbound Processing Region was updated for this phone number, given in ISO 8601 format.


Fetch a PhoneNumber's current Inbound Processing Region configuration

fetch-a-phonenumbers-current-inbound-processing-region-configuration page anchor
GET https://routes.twilio.com/v2/PhoneNumbers/{PhoneNumber}

Path parameters

path-parameters page anchor
Property nameTypeRequiredPIIDescription
PhoneNumberstringrequired

The phone number in E.164 format

Fetch a PhoneNumber's current Inbound Processing Region configurationLink to code sample: Fetch a PhoneNumber's current Inbound Processing Region configuration
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 fetchPhoneNumber() {
11
const phoneNumber = await client.routes.v2
12
.phoneNumbers("+18001234567")
13
.fetch();
14
15
console.log(phoneNumber.phoneNumber);
16
}
17
18
fetchPhoneNumber();

Output

1
{
2
"phone_number": "+18001234567",
3
"url": "https://routes.twilio.com/v2/PhoneNumbers/+18001234567",
4
"sid": "QQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
6
"friendly_name": "friendly_name",
7
"voice_region": "au1",
8
"date_created": "2015-07-30T20:00:00Z",
9
"date_updated": "2015-07-30T20:00:00Z"
10
}

Update a PhoneNumber's Inbound Processing Region configuration

update-a-phonenumbers-inbound-processing-region-configuration page anchor
POST https://routes.twilio.com/v2/PhoneNumbers/{PhoneNumber}

Property nameTypeRequiredPIIDescription
PhoneNumberstringrequired

The phone number in E.164 format

Encoding type:application/x-www-form-urlencoded
SchemaExample
Property nameTypeRequiredDescriptionChild properties
VoiceRegionstring

Optional

The Inbound Processing Region used for this phone number for voice


FriendlyNamestring

Optional

A human readable description of this resource, up to 64 characters.

Update a PhoneNumber's Inbound Processing Region configurationLink to code sample: Update a PhoneNumber's Inbound Processing Region configuration
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 updatePhoneNumber() {
11
const phoneNumber = await client.routes.v2
12
.phoneNumbers("+18001234567")
13
.update({ voiceRegion: "au1" });
14
15
console.log(phoneNumber.voiceRegion);
16
}
17
18
updatePhoneNumber();

Output

1
{
2
"phone_number": "+18001234567",
3
"url": "https://routes.twilio.com/v2/PhoneNumbers/+18001234567",
4
"sid": "QQaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
5
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
6
"friendly_name": "friendly_name",
7
"voice_region": "au1",
8
"date_created": "2015-07-30T20:00:00Z",
9
"date_updated": "2015-07-30T20:00:00Z"
10
}

Need some help?

Terms of service

Copyright © 2024 Twilio Inc.