Skip to contentSkip to navigationSkip to topbar
Rate this page:
On this page

REST API: Addresses


An Address instance resource represents your or your customer's physical location within a country. Around the world, some local authorities require the name and address of the user to be on file with Twilio to purchase and own a phone number. Address requirements are exposed as a property on the AvailablePhoneNumber resource.

Addresses contain the name of your company or your customer's company in addition to location information and an optional friendly name. Each Address created on an account or subaccount can be used for any phone numbers purchased on that account. After creating an address, it can be used to satisfy the requirements for multiple phone numbers and phone numbers with address requirements can be purchased using the IncomingPhoneNumber resource.

In some countries, to comply with local regulations, addresses are validated to ensure the integrity and accuracy of the data provided. In those countries, if the address you provide does not pass validation, it is not accepted as an Address and the error code 21628 is returned. If the address submitted is not an exact match but is similar to a valid address, we'll create the Address using the valid address we found, unless you include the AutoCorrectAddress=false parameter in the request. In that case, we'll provide it as a suggested address in error code 21629. If the suggested address is indeed the address of your company or your customer's company, then use the suggested format to create a valid Address.

The Address list resource represents all of the Addresses that you have created on your account within Twilio. You can POST to Addresses to create a new address or modify an existing address.


Address Properties

address-properties page anchor
Property nameTypePIIDescription
account_sidSID<AC>
Not PII

The SID of the Account that is responsible for the Address resource.

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

citystring

The city in which the address is located.


customer_namestring
PII MTL: 30 days

The name associated with the address.This property has a maximum length of 16 4-byte characters, or 21 3-byte characters.


date_updatedstring<date-time-rfc-2822>

The date and time in GMT that the resource was last updated specified in RFC 2822(link takes you to an external page) format.


friendly_namestring

The string that you assigned to describe the resource.


iso_countrystring<iso-country-code>

The ISO country code of the address.


postal_codestring

The postal code of the address.


regionstring

The state or region of the address.


sidSID<AD>

The unique string that that we created to identify the Address resource.

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

streetstring

The number and street address of the address.


uristring

The URI of the resource, relative to https://api.twilio.com.


emergency_enabledboolean

Whether emergency calling has been enabled on this number.


validatedboolean

Whether the address has been validated to comply with local regulation. In countries that require valid addresses, an invalid address will not be accepted. true indicates the Address has been validated. false indicate the country doesn't require validation or the Address is not valid.


verifiedboolean

Whether the address has been verified to comply with regulation. In countries that require valid addresses, an invalid address will not be accepted. true indicates the Address has been verified. false indicate the country doesn't require verified or the Address is not valid.


street_secondarystring

The additional number and street address of the address.


Create an Address resource

create-an-address-resource page anchor
POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Addresses.json

Creates a new Address within your account.

Path parameters

path-parameters page anchor
Property nameTypeRequiredPIIDescription
AccountSidSID<AC>required

The SID of the Account that will be responsible for the new Address resource.

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

The name to associate with the new address.


Streetstringrequired

The number and street address of the new address.


Citystringrequired

The city of the new address.


Regionstringrequired

The state or region of the new address.


PostalCodestringrequired

The postal code of the new address.


IsoCountrystring<iso-country-code>required

The ISO country code of the new address.


FriendlyNamestringOptional

A descriptive string that you create to describe the new address. It can be up to 64 characters long.


EmergencyEnabledbooleanOptional

Whether to enable emergency calling on the new address. Can be: true or false.


AutoCorrectAddressbooleanOptional

Whether we should automatically correct the address. Can be: true or false and the default is true. If empty or true, we will correct the address you provide if necessary. If false, we won't alter the address you provide.


StreetSecondarystringOptional

The additional number and street address of the address.

Create an Address

create-an-address page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_24
// Download the helper library from https://www.twilio.com/docs/node/install
_24
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_24
_24
// Find your Account SID and Auth Token at twilio.com/console
_24
// and set the environment variables. See http://twil.io/secure
_24
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_24
const authToken = process.env.TWILIO_AUTH_TOKEN;
_24
const client = twilio(accountSid, authToken);
_24
_24
async function createAddress() {
_24
const address = await client.addresses.create({
_24
city: "city",
_24
customerName: "customer_name",
_24
isoCountry: "US",
_24
postalCode: "postal_code",
_24
region: "region",
_24
street: "street",
_24
streetSecondary: "street_secondary",
_24
});
_24
_24
console.log(address.accountSid);
_24
}
_24
_24
createAddress();

Output

_18
{
_18
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18
"city": "city",
_18
"customer_name": "customer_name",
_18
"date_created": "Tue, 18 Aug 2015 17:07:30 +0000",
_18
"date_updated": "Tue, 18 Aug 2015 17:07:30 +0000",
_18
"emergency_enabled": false,
_18
"friendly_name": null,
_18
"iso_country": "US",
_18
"postal_code": "postal_code",
_18
"region": "region",
_18
"sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_18
"street": "street",
_18
"street_secondary": "street_secondary",
_18
"validated": false,
_18
"verified": false,
_18
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Addresses/ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"
_18
}

If successful, Twilio will respond with a representation of the new address.

Address Validation Related Errors

av-errors page anchor
Error CodeError NameError Description
21615Phone Number Requires a Local AddressTo purchase this number you must have an Address on your account that satisfies the local address requirements.
21628Address Validation ErrorThe address you have provided cannot be validated.
21629Address Validation Error - Check Suggested AddressThe address you have provided cannot be validated. A similar address has been found to be valid. The suggested address is included in the error message body.

Fetch an Address resource

fetch-an-address-resource page anchor
GET https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Addresses/{Sid}.json

Property nameTypeRequiredPIIDescription
AccountSidSID<AC>required

The SID of the Account that is responsible for the Address resource to fetch.

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

SidSID<AD>required

The Twilio-provided string that uniquely identifies the Address resource to fetch.

Pattern: ^AD[0-9a-fA-F]{32}$Min length: 34Max length: 34
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function fetchAddress() {
_18
const address = await client
_18
.addresses("ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX")
_18
.fetch();
_18
_18
console.log(address.accountSid);
_18
}
_18
_18
fetchAddress();

Output

_18
{
_18
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18
"city": "SF",
_18
"customer_name": "name",
_18
"date_created": "Tue, 18 Aug 2015 17:07:30 +0000",
_18
"date_updated": "Tue, 18 Aug 2015 17:07:30 +0000",
_18
"emergency_enabled": false,
_18
"friendly_name": null,
_18
"iso_country": "US",
_18
"postal_code": "94019",
_18
"region": "CA",
_18
"sid": "ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18
"street": "4th",
_18
"street_secondary": null,
_18
"validated": false,
_18
"verified": false,
_18
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Addresses/ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"
_18
}


Read multiple Address resources

read-multiple-address-resources page anchor
GET https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Addresses.json

Returns a list of Address resource representations, each representing an address within your account. The list includes [paging information][paging-info].

Property nameTypeRequiredPIIDescription
AccountSidSID<AC>required

The SID of the Account that is responsible for the Address resource to read.

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

The customer_name of the Address resources to read.


FriendlyNamestringOptional

The string that identifies the Address resources to read.


IsoCountrystring<iso-country-code>Optional

The ISO country code of the Address resources to read.


PageSizeintegerOptional

How many resources to return in each list page. The default is 50, and the maximum is 1000.

Minimum: 1Maximum: 1000

PageintegerOptional

The page index. This value is simply for client state.

Minimum: 0

PageTokenstringOptional

The page token. This is provided by the API.

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_16
// Download the helper library from https://www.twilio.com/docs/node/install
_16
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_16
_16
// Find your Account SID and Auth Token at twilio.com/console
_16
// and set the environment variables. See http://twil.io/secure
_16
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_16
const authToken = process.env.TWILIO_AUTH_TOKEN;
_16
const client = twilio(accountSid, authToken);
_16
_16
async function listAddress() {
_16
const addresses = await client.addresses.list({ limit: 20 });
_16
_16
addresses.forEach((a) => console.log(a.accountSid));
_16
}
_16
_16
listAddress();

Output

_33
{
_33
"addresses": [
_33
{
_33
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_33
"city": "SF",
_33
"customer_name": "name",
_33
"date_created": "Tue, 18 Aug 2015 17:07:30 +0000",
_33
"date_updated": "Tue, 18 Aug 2015 17:07:30 +0000",
_33
"emergency_enabled": false,
_33
"friendly_name": null,
_33
"iso_country": "US",
_33
"postal_code": "94019",
_33
"region": "CA",
_33
"sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_33
"street": "4th",
_33
"street_secondary": null,
_33
"validated": false,
_33
"verified": false,
_33
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Addresses/ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"
_33
}
_33
],
_33
"end": 0,
_33
"first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Addresses.json?PageSize=50&Page=0",
_33
"last_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Addresses.json?PageSize=50&Page=0",
_33
"next_page_uri": null,
_33
"num_pages": 1,
_33
"page": 0,
_33
"page_size": 50,
_33
"previous_page_uri": null,
_33
"start": 0,
_33
"total": 1,
_33
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Addresses.json?PageSize=50&Page=0"
_33
}

Show all addresses matching the Customer Name 'Customer 123'

show-all-addresses-matching-the-customer-name-customer-123 page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_19
// Download the helper library from https://www.twilio.com/docs/node/install
_19
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_19
_19
// Find your Account SID and Auth Token at twilio.com/console
_19
// and set the environment variables. See http://twil.io/secure
_19
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_19
const authToken = process.env.TWILIO_AUTH_TOKEN;
_19
const client = twilio(accountSid, authToken);
_19
_19
async function listAddress() {
_19
const addresses = await client.addresses.list({
_19
customerName: "Customer 123",
_19
limit: 20,
_19
});
_19
_19
addresses.forEach((a) => console.log(a.accountSid));
_19
}
_19
_19
listAddress();

Output

_33
{
_33
"addresses": [
_33
{
_33
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_33
"city": "SF",
_33
"customer_name": "name",
_33
"date_created": "Tue, 18 Aug 2015 17:07:30 +0000",
_33
"date_updated": "Tue, 18 Aug 2015 17:07:30 +0000",
_33
"emergency_enabled": false,
_33
"friendly_name": null,
_33
"iso_country": "US",
_33
"postal_code": "94019",
_33
"region": "CA",
_33
"sid": "ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_33
"street": "4th",
_33
"street_secondary": null,
_33
"validated": false,
_33
"verified": false,
_33
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Addresses/ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"
_33
}
_33
],
_33
"end": 0,
_33
"first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Addresses.json?PageSize=50&Page=0",
_33
"last_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Addresses.json?PageSize=50&Page=0",
_33
"next_page_uri": null,
_33
"num_pages": 1,
_33
"page": 0,
_33
"page_size": 50,
_33
"previous_page_uri": null,
_33
"start": 0,
_33
"total": 1,
_33
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Addresses.json?PageSize=50&Page=0"
_33
}

List Dependent PNS Subresources

list-dependent-pns-subresources page anchor

Show all phone numbers on your account that require the address AD2a0747eba6abf96b7e3c3ff0b4530f6e

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_18
// Download the helper library from https://www.twilio.com/docs/node/install
_18
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_18
_18
// Find your Account SID and Auth Token at twilio.com/console
_18
// and set the environment variables. See http://twil.io/secure
_18
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_18
const authToken = process.env.TWILIO_AUTH_TOKEN;
_18
const client = twilio(accountSid, authToken);
_18
_18
async function listDependentPhoneNumber() {
_18
const dependentPhoneNumbers = await client
_18
.addresses("AD2a0747eba6abf96b7e3c3ff0b4530f6e")
_18
.dependentPhoneNumbers.list({ limit: 20 });
_18
_18
dependentPhoneNumbers.forEach((d) => console.log(d.sid));
_18
}
_18
_18
listDependentPhoneNumber();

Output

_42
{
_42
"dependent_phone_numbers": [
_42
{
_42
"sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_42
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_42
"friendly_name": "3197004499318",
_42
"phone_number": "+3197004499318",
_42
"voice_url": null,
_42
"voice_method": "POST",
_42
"voice_fallback_url": null,
_42
"voice_fallback_method": "POST",
_42
"voice_caller_id_lookup": false,
_42
"date_created": "Thu, 23 Feb 2017 10:26:31 -0800",
_42
"date_updated": "Thu, 23 Feb 2017 10:26:31 -0800",
_42
"sms_url": "",
_42
"sms_method": "POST",
_42
"sms_fallback_url": "",
_42
"sms_fallback_method": "POST",
_42
"address_requirements": "any",
_42
"capabilities": {
_42
"Voice": false,
_42
"SMS": true,
_42
"MMS": false
_42
},
_42
"status_callback": "",
_42
"status_callback_method": "POST",
_42
"api_version": "2010-04-01",
_42
"voice_application_sid": null,
_42
"sms_application_sid": "",
_42
"trunk_sid": null,
_42
"emergency_status": "Inactive",
_42
"emergency_address_sid": null,
_42
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/IncomingPhoneNumbers/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"
_42
}
_42
],
_42
"first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Addresses/ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/DependentPhoneNumbers.json?Page=0&PageSize=50",
_42
"next_page_uri": null,
_42
"page": 0,
_42
"page_size": 50,
_42
"previous_page_uri": null,
_42
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Addresses/ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/DependentPhoneNumbers.json"
_42
}


Read multiple Address Subresources

instance-subresources page anchor

_10
GET https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Addresses/{AddressSid}/DependentPhoneNumbers.json

Returns a list of IncomingPhoneNumbers on your account that require the specified address.

Dependent Phone Numbers Instance Subresource

list-dependent-pns page anchor

Each Address instance resource supports a subresource for viewing which phone numbers are dependent on your existing addresses. In the case that you have two addresses that satisfy the requirement on a given phone number, this subresource will not return the phone number in the list.

The list includes paging information. If you plan on requesting more records than will fit on a single page, you should use the provided nextpageuri rather than incrementing through the pages by page number. Using the nextpageuri helps to ensure that your next request picks up where it left off and can prevent you from retrieving duplicate data if you are actively creating addresses.


Update an Address resource

update-an-address-resource page anchor
POST https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Addresses/{Sid}.json

A POST request attempts to update an individual Address instance and returns the updated resource representation if successful. A successful returned response is identical to that of the HTTP GET.

Note that all fields but IsoCountry can be updated using a POST request. To update the IsoCountry, a new Address must be created.

Property nameTypeRequiredPIIDescription
AccountSidSID<AC>required

The SID of the Account that is responsible for the Address resource to update.

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

SidSID<AD>required

The Twilio-provided string that uniquely identifies the Address resource to update.

Pattern: ^AD[0-9a-fA-F]{32}$Min length: 34Max length: 34
Property nameTypeRequiredPIIDescription
FriendlyNamestringOptional

A descriptive string that you create to describe the address. It can be up to 64 characters long.


CustomerNamestringOptional

The name to associate with the address.


StreetstringOptional

The number and street address of the address.


CitystringOptional

The city of the address.


RegionstringOptional

The state or region of the address.


PostalCodestringOptional

The postal code of the address.


EmergencyEnabledbooleanOptional

Whether to enable emergency calling on the address. Can be: true or false.


AutoCorrectAddressbooleanOptional

Whether we should automatically correct the address. Can be: true or false and the default is true. If empty or true, we will correct the address you provide if necessary. If false, we won't alter the address you provide.


StreetSecondarystringOptional

The additional number and street address of the address.

Update a customer name and street address

update-a-customer-name-and-street-address page anchor

Update the customer name and street to ‘Customer 456' and ‘2 Hasselhoff Lane'.

Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_21
// Download the helper library from https://www.twilio.com/docs/node/install
_21
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_21
_21
// Find your Account SID and Auth Token at twilio.com/console
_21
// and set the environment variables. See http://twil.io/secure
_21
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_21
const authToken = process.env.TWILIO_AUTH_TOKEN;
_21
const client = twilio(accountSid, authToken);
_21
_21
async function updateAddress() {
_21
const address = await client
_21
.addresses("AD2a0747eba6abf96b7e3c3ff0b4530f6e")
_21
.update({
_21
customerName: "Customer 456",
_21
street: "2 Hasselhoff Lane",
_21
});
_21
_21
console.log(address.accountSid);
_21
}
_21
_21
updateAddress();

Output

_18
{
_18
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_18
"city": "SF",
_18
"customer_name": "Customer 456",
_18
"date_created": "Tue, 18 Aug 2015 17:07:30 +0000",
_18
"date_updated": "Tue, 18 Aug 2015 17:07:30 +0000",
_18
"emergency_enabled": false,
_18
"friendly_name": null,
_18
"iso_country": "US",
_18
"postal_code": "94019",
_18
"region": "CA",
_18
"sid": "AD2a0747eba6abf96b7e3c3ff0b4530f6e",
_18
"street": "2 Hasselhoff Lane",
_18
"street_secondary": null,
_18
"validated": false,
_18
"verified": false,
_18
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Addresses/ADaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"
_18
}


Delete an Address resource

delete-an-address-resource page anchor
DELETE https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Addresses/{Sid}.json

Deletes this address from your account.

If this address is required for any active IncomingPhoneNumbers, it cannot be deleted and you will receive Error [21625][21625]. However, if you have a second address that fulfills the AddressRequirement, the address will be successfully deleted. The DependentPhoneNumbers Instance Subresource will allow you to see which IncomingPhoneNumbers require a given address.

If the delete is successful, Twilio will return an HTTP 204 response with no body.

Property nameTypeRequiredPIIDescription
AccountSidSID<AC>required

The SID of the Account that is responsible for the Address resource to delete.

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

SidSID<AD>required

The Twilio-provided string that uniquely identifies the Address resource to delete.

Pattern: ^AD[0-9a-fA-F]{32}$Min length: 34Max length: 34
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_14
// Download the helper library from https://www.twilio.com/docs/node/install
_14
const twilio = require("twilio"); // Or, for ESM: import twilio from "twilio";
_14
_14
// Find your Account SID and Auth Token at twilio.com/console
_14
// and set the environment variables. See http://twil.io/secure
_14
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_14
const authToken = process.env.TWILIO_AUTH_TOKEN;
_14
const client = twilio(accountSid, authToken);
_14
_14
async function deleteAddress() {
_14
await client.addresses("ADXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX").remove();
_14
}
_14
_14
deleteAddress();


Rate this page: