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

Outgoing Caller IDs


(warning)

Warning

NOTE: The order of the columns in the CSV is not defined and may change when new fields are added to the API response. Your application design should be resilient to changes in the order of the columns in the CSV response.

An OutgoingCallerId instance resource represents a single verified number that may be used as a caller ID when making outgoing calls via the REST API and within the TwiML <Dial> verb. The OutgoingCallerIds list resource represents the set of an account's verified phone numbers.


OutgoingCallerId Instance Resource

Resource URI


_10
/2010-04-01/Accounts/{AccountSid}/OutgoingCallerIds/{OutgoingCallerIdSid}

Resource Properties

PropertyDescription
SidA 34 character string that uniquely identifies this resource.
DateCreatedThe date that this resource was created, given in RFC 2822 format.
DateUpdatedThe date that this resource was last updated, given in RFC 2822 format.
FriendlyNameA human readable descriptive text for this resource, up to 64 characters long. By default, the FriendlyName is a nicely formatted version of the phone number.
AccountSidThe unique ID of the Account responsible for this Caller Id.
PhoneNumberThe incoming phone number. Formatted with a '+' and country code e.g., +16175551212 (E.164 format).
UriThe URI for this resource, relative to https://api.twilio.com.

HTTP GET

Get Outgoing Caller ID Details

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 fetchOutgoingCallerId() {
_18
const outgoingCallerId = await client
_18
.outgoingCallerIds("PNe905d7e6b410746a0fb08c57e5a186f3")
_18
.fetch();
_18
_18
console.log(outgoingCallerId.sid);
_18
}
_18
_18
fetchOutgoingCallerId();

Output

_10
{
_10
"sid": "PNe905d7e6b410746a0fb08c57e5a186f3",
_10
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_10
"friendly_name": "(415) 867-5309",
_10
"phone_number": "+141586753096",
_10
"date_created": "Fri, 21 Aug 2009 00:11:24 +0000",
_10
"date_updated": "Fri, 21 Aug 2009 00:11:24 +0000",
_10
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OutgoingCallerIds/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"
_10
}

HTTP POST or PUT

Updates the caller ID, and returns the updated resource if successful.

Optional Parameters

There is only one field that you may update:

ParameterDescription
FriendlyNameA human readable description of a Caller ID, with maximum length of 64 characters. Defaults to a nicely formatted version of the phone number.

Update Outgoing Caller ID

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 updateOutgoingCallerId() {
_18
const outgoingCallerId = await client
_18
.outgoingCallerIds("PNe536d32a3c49700934481addd5ce1659")
_18
.update({ friendlyName: "My Second Line" });
_18
_18
console.log(outgoingCallerId.sid);
_18
}
_18
_18
updateOutgoingCallerId();

Output

_10
{
_10
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_10
"date_created": "Fri, 21 Aug 2009 00:11:24 +0000",
_10
"date_updated": "Fri, 21 Aug 2009 00:11:24 +0000",
_10
"friendly_name": "My Second Line",
_10
"phone_number": "+141586753096",
_10
"sid": "PNe536d32a3c49700934481addd5ce1659",
_10
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OutgoingCallerIds/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"
_10
}

The response format is identical to the HTTP GET response documented above.

HTTP DELETE

Deletes the caller ID from the account. Returns an HTTP 204 response if successful, with no body.

Delete Outgoing Caller ID

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 deleteOutgoingCallerId() {
_14
await client.outgoingCallerIds("PNe536d32a3c49700934481addd5ce1659").remove();
_14
}
_14
_14
deleteOutgoingCallerId();


OutgoingCallerIds List Resource

Resource URI


_10
/2010-04-01/Accounts/{AccountSid}/OutgoingCallerIds

HTTP GET

Returns a list of OutgoingCallerId resource representations, each representing a Caller ID number valid for an account. The list includes paging information.

List Filters

The following GET query string parameters allow you to limit the list returned. Note, parameters are case-sensitive:

ParameterDescription
PhoneNumberOnly show the caller id resource that exactly matches this phone number.
FriendlyNameOnly show the caller id resource that exactly matches this name.

List an Account's Outgoing Caller IDs

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 listOutgoingCallerId() {
_16
const outgoingCallerIds = await client.outgoingCallerIds.list({ limit: 20 });
_16
_16
outgoingCallerIds.forEach((o) => console.log(o.sid));
_16
}
_16
_16
listOutgoingCallerId();

Output

_21
{
_21
"end": 0,
_21
"first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OutgoingCallerIds.json?PageSize=50&Page=0",
_21
"next_page_uri": null,
_21
"outgoing_caller_ids": [
_21
{
_21
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_21
"date_created": "Fri, 21 Aug 2009 00:11:24 +0000",
_21
"date_updated": "Fri, 21 Aug 2009 00:11:24 +0000",
_21
"friendly_name": "(415) 867-5309",
_21
"phone_number": "+141586753096",
_21
"sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_21
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OutgoingCallerIds/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"
_21
}
_21
],
_21
"page": 0,
_21
"page_size": 50,
_21
"previous_page_uri": null,
_21
"start": 0,
_21
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OutgoingCallerIds.json?PageSize=50&Page=0"
_21
}

Show Caller ID for a Phone number

Only show the caller id record for phone number (415) 867-5310.

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 listOutgoingCallerId() {
_19
const outgoingCallerIds = await client.outgoingCallerIds.list({
_19
phoneNumber: "+14158675310",
_19
limit: 20,
_19
});
_19
_19
outgoingCallerIds.forEach((o) => console.log(o.sid));
_19
}
_19
_19
listOutgoingCallerId();

Output

_21
{
_21
"end": 0,
_21
"first_page_uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OutgoingCallerIds.json?PageSize=50&Page=0",
_21
"next_page_uri": null,
_21
"outgoing_caller_ids": [
_21
{
_21
"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_21
"date_created": "Fri, 21 Aug 2009 00:11:24 +0000",
_21
"date_updated": "Fri, 21 Aug 2009 00:11:24 +0000",
_21
"friendly_name": "(415) 867-5309",
_21
"phone_number": "+141586753096",
_21
"sid": "PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_21
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OutgoingCallerIds/PNaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"
_21
}
_21
],
_21
"page": 0,
_21
"page_size": 50,
_21
"previous_page_uri": null,
_21
"start": 0,
_21
"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/OutgoingCallerIds.json?PageSize=50&Page=0"
_21
}

HTTP POST

Adds a new CallerID to your account. After making this request, Twilio will return to you a validation code and Twilio will dial the phone number given to perform validation. The code returned must be entered via the phone before the CallerID is added to your account.

The following parameters are accepted:

Required Parameters

ParameterDescription
PhoneNumberThe phone number to verify. Should be formatted with a '+' and country code e.g., +16175551212 (E.164 format). Twilio will also accept unformatted US numbers e.g., (415) 555-1212, 415-555-1212.

Optional Parameters

ParameterDescription
FriendlyNameA human readable description for the new caller ID with maximum length 64 characters. Defaults to a nicely formatted version of the number.
CallDelayThe number of seconds, between 0 and 60, to delay before initiating the verification call. Defaults to 0.
ExtensionDigits to dial after connecting the verification call.
StatusCallbackA URL that Twilio will request when the verification call ends to notify your app if the verification process was successful or not. See StatusCallback parameter below.
StatusCallbackMethodThe HTTP method Twilio should use when requesting the above URL. Defaults to POST.

This will create a new CallerID validation request within Twilio, which initiates a call to the phone number provided and listens for a validation code. The validation request is represented in the response by the following properties:

Response Properties

PropertyDescription
AccountSidThe unique ID of the Account to which the Validation Request belongs.
PhoneNumberThe incoming phone number being validated, formatted with a '+' and country code e.g., +16175551212 (E.164 format).
FriendlyNameThe friendly name you provided, if any.
ValidationCodeThe 6 digit validation code that must be entered via the phone to validate this phone number for Caller ID.
CallSidThe unique id of the Call created for this validation attempt.

StatusCallback Parameter

After the verification call ends, Twilio makes an asynchronous HTTP request to the StatusCallback URL if you provided one in your API request. By capturing this request, you can determine when the call ended and whether or not the number called was successfully verified.

Twilio passes the same parameters to your application in its asynchronous request to the StatusCallback URL as it does in a typical status callback request. The full list of parameters and descriptions of each are in the TwiML Voice: Twilio's Request documentation.

The verification status callback request also passes these additional parameters:

ParameterDescription
VerificationStatusDescribes whether or not the person called correctly entered the validation code. Possible values are success or failed.
OutgoingCallerIdSidIf the verification process was successful, the SID value of the newly-created OutgoingCallerId resource for the verified number.

Add an Outgoing Caller ID

Here are a typical request and response. Typically, you would present the validation code from the response to the user who is trying to verify their phone number. Adding an Outgoing Caller ID via the API has the same result as verifying a number via the Twilio console.

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 createValidationRequest() {
_19
const validationRequest = await client.validationRequests.create({
_19
friendlyName: "My Home Phone Number",
_19
phoneNumber: "+14158675310",
_19
});
_19
_19
console.log(validationRequest.accountSid);
_19
}
_19
_19
createValidationRequest();

Output

_10
{
_10
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_10
"call_sid": "CAaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",
_10
"friendly_name": "My Home Phone Number",
_10
"phone_number": "+14158675310",
_10
"validation_code": "111111"
_10
}

HTTP PUT

Not supported.

HTTP DELETE

Not supported.


Rate this page: