Skip to contentSkip to navigationSkip to topbar
Rate this Page:

What is a String Identifier (SID)?


A String Identifier (SID) is a unique key that is used to identify specific resources.


String Identifiers at Twilio

string-identifiers-at-twilio page anchor

Every Twilio resource has a 34 digit SID. You can use the first two characters of the SID to identify its type. Many of our API calls will return a JSON object containing another resource's SID. Using this SID, you can retrieve more information about the specific resource.

For example, the following code creates an SMS message:

Create a new text message

create-a-new-text-message page anchor
Node.js
Python
C#
Java
Go
PHP
Ruby
twilio-cli
curl

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.messages
_10
.create({from: '+15017122661', body: 'body', to: '+15558675310'})
_10
.then(message => console.log(message.sid));

Output

_24
{
_24
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_24
"api_version": "2010-04-01",
_24
"body": "Hello! 👍",
_24
"date_created": "Thu, 24 Aug 2023 05:01:45 +0000",
_24
"date_sent": "Thu, 24 Aug 2023 05:01:45 +0000",
_24
"date_updated": "Thu, 24 Aug 2023 05:01:45 +0000",
_24
"direction": "outbound-api",
_24
"error_code": null,
_24
"error_message": null,
_24
"from": "+14155552345",
_24
"num_media": "0",
_24
"num_segments": "1",
_24
"price": null,
_24
"price_unit": null,
_24
"messaging_service_sid": "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_24
"sid": "SMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_24
"status": "queued",
_24
"subresource_uris": {
_24
"media": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/SMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Media.json"
_24
},
_24
"to": "+14155552345",
_24
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/SMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX.json"
_24
}

Note how the newly created message has a property named sid. Using this value we can later fetch this specific message.

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

_10
// Download the helper library from https://www.twilio.com/docs/node/install
_10
// Find your Account SID and Auth Token at twilio.com/console
_10
// and set the environment variables. See http://twil.io/secure
_10
const accountSid = process.env.TWILIO_ACCOUNT_SID;
_10
const authToken = process.env.TWILIO_AUTH_TOKEN;
_10
const client = require('twilio')(accountSid, authToken);
_10
_10
client.messages('MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX')
_10
.fetch()
_10
.then(message => console.log(message.status));

Output

_25
{
_25
"account_sid": "ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"api_version": "2010-04-01",
_25
"body": "testing",
_25
"date_created": "Fri, 24 May 2019 17:18:27 +0000",
_25
"date_sent": "Fri, 24 May 2019 17:18:28 +0000",
_25
"date_updated": "Fri, 24 May 2019 17:18:28 +0000",
_25
"direction": "outbound-api",
_25
"error_code": 30007,
_25
"error_message": "Carrier violation",
_25
"from": "+12019235161",
_25
"messaging_service_sid": "MGXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"num_media": "0",
_25
"num_segments": "1",
_25
"price": "-0.00750",
_25
"price_unit": "USD",
_25
"sid": "MMXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX",
_25
"status": "sent",
_25
"subresource_uris": {
_25
"media": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/SMb7c0a2ce80504485a6f653a7110836f5/Media.json",
_25
"feedback": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/SMb7c0a2ce80504485a6f653a7110836f5/Feedback.json"
_25
},
_25
"to": "+18182008801",
_25
"uri": "/2010-04-01/Accounts/ACXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXXX/Messages/SMb7c0a2ce80504485a6f653a7110836f5.json"
_25
}

Using the message SID, which is prefixed with MM, we were able to get more information about that specific resource.


Twilio's product offering is expansive. Products range from Voice and video, Messaging, Internet of Things connectivity, and security. Therefore, you'll encounter many resources along your journey.

Below is a table of the most commonly-seen SID prefixes:

PrefixResource Type
ACAccount
CACall
CFConference
HSDevice (Super SIM)
MMMessage
PAConversation Participant
QUQueue
SDSIP Domain
YCAuthy Challenge

Rate this Page: