What is a String Identifier (SID)?
A unique key string that Twilio uses to identify specific resources.
Twilio identifies every resource with a 34-character String Identifier (SID). This SID consists of a two-letter prefix followed by 32 hexadecimal digits. You can use the first two characters of the SID to identify its type. The following table includes many of the common prefixes for SIDs. Most API reference pages include multiple SIDs in their list of properties.
| Prefix | Component |
|---|---|
AC | Account |
AD | Physical Address |
AI | AlphaSender |
AL | Access List |
AP | Application |
BN | Brand |
BU | Regulatory Bundle |
CA | Call |
CF | Conference |
CH | Conversation |
CL | Credential List |
CN | Connection |
CP | Conference Participant |
CR | Credential |
DG | Event Sink |
DN | Domain |
ES | Sync List |
EY | Operator Type |
FJ | Flex Plugin Service Release |
FN | Flex Context Execution Resource |
FT | Flex Step |
FW | Flex Workflow |
GA | Conversational Intelligence Service |
GT | Intelligence Service |
HH | Tollfree Number Verification |
HJ | Verification Service |
HX | Message Content |
IG | Conversations Address Configuration |
IM | Chat Message |
IP | SIP IP Address |
IS | Chat Service |
IT | Twilio End User |
KC | Phone Number Proxy Session |
KD | Flex Interaction Resource |
KP | Phone Number Proxy Participant |
KS | Phone Number Proxy |
MB | Chat Member |
ME | Media |
MG | Messaging Service |
MM | Message |
NO | Notification |
PA | Recording Grouping |
PN | Phone Number |
QE | Association with External Campaign |
RD | Regulatory Supporting Document |
RE | Recording |
RL | Role |
RM | Room |
RN | Regulatory Policy Number |
RT | Recording Track |
SC | Shortcode |
SD | SIP Domain |
SK | API Key |
SM | Message |
TR | Transcription |
UO | Flex Interaction Channel |
US | User |
UT | Flex Interaction Channel Participant |
VA | Service Attempting Verification |
VE | Verification Check |
VL | Verification Attempt |
VT | Vetting Record |
WA | TaskRouter Assignment Activity |
WQ | TaskRouter Task Assignment Activity |
WS | TaskRouter Workspace |
WT | TaskRouter Workspace Task |
WW | TaskRouter Workflow |
XB | Marketplace Listing |
XE | WhatsApp Sender |
YF | Verification Factor |
ZB | Serverless Build |
Many API requests to Twilio include a resource SID in their response. To fetch information about that resource, search for and use this SID.
The following example creates an SMS message:
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 and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function createMessage() {11const message = await client.messages.create({12body: "This will be the body of the new message!",13from: "+14155552344",14to: "alex@example.com",15});1617console.log(message.sid);18}1920createMessage();
Response
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"api_version": "2010-04-01",4"body": "This will be the body of the new message!",5"date_created": "Thu, 24 Aug 2023 05:01:45 +0000",6"date_sent": "Thu, 24 Aug 2023 05:01:45 +0000",7"date_updated": "Thu, 24 Aug 2023 05:01:45 +0000",8"direction": "outbound-api",9"error_code": null,10"error_message": null,11"from": "+14155552344",12"num_media": "0",13"num_segments": "1",14"price": null,15"price_unit": null,16"messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",17"sid": "SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",18"status": "queued",19"subresource_uris": {20"media": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Media.json"21},22"to": "alex@example.com",23"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa.json"24}
The JSON response to this API request from Twilio returns a property labeled sid. To retrieve this specific message, use the message SID with the SM prefix. This second call returns data about that specific resource.
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 and Auth Token at twilio.com/console5// and set the environment variables. See http://twil.io/secure6const accountSid = process.env.TWILIO_ACCOUNT_SID;7const authToken = process.env.TWILIO_AUTH_TOKEN;8const client = twilio(accountSid, authToken);910async function fetchMessage() {11const message = await client12.messages("SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa")13.fetch();1415console.log(message.status);16}1718fetchMessage();
Response
1{2"account_sid": "ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",3"api_version": "2010-04-01",4"body": "testing",5"date_created": "Fri, 24 May 2019 17:18:27 +0000",6"date_sent": "Fri, 24 May 2019 17:18:28 +0000",7"date_updated": "Fri, 24 May 2019 17:18:28 +0000",8"direction": "outbound-api",9"error_code": 30007,10"error_message": "Carrier violation",11"from": "+12019235161",12"messaging_service_sid": "MGaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",13"num_media": "0",14"num_segments": "1",15"price": "-0.00750",16"price_unit": "USD",17"sid": "SMaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa",18"status": "sent",19"subresource_uris": {20"media": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/SMb7c0a2ce80504485a6f653a7110836f5/Media.json",21"feedback": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/SMb7c0a2ce80504485a6f653a7110836f5/Feedback.json"22},23"to": "+18182008801",24"uri": "/2010-04-01/Accounts/ACaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaaa/Messages/SMb7c0a2ce80504485a6f653a7110836f5.json"25}