Sample - Twilio API
GET/2010-04-01/Accounts/{AccountSid}/Messages/{Sid}.json

Get a message

Retrieves one message belonging to the specified account. Use AccountSid to identify the account and Sid to identify the message, then inspect the returned status, delivery details, timestamps, and pricing information.

  • RetriesRetries up to 2×, 500ms backoff, 30s timeout.

2 parameters
AccountSidstringrequired
The SID of the account associated with the message. Must be a 34-character SID matching the `AC` account identifier format.
Sidstringrequired
The SID of the message to retrieve. Must be a 34-character SID beginning with `SM` or `MM`.

1 status code
200Returns the message object, including its content, direction, sender and recipient, status, resource SIDs, timestamps, pricing, media count, and error details.
bodystringoptional
The text content of the message
num_segmentsstringoptional
The number of segments that make up the complete message. SMS message bodies that exceed the [character limit](https://www.twilio.com/docs/glossary/what-sms-character-limit) are segmented and charged as multiple messages. Note: For messages sent via a Messaging Service, `num_segments` is initially `0`, since a sender hasn't yet been assigned.
directionstringoptional
The direction of the message. Can be: `inbound` for incoming messages, `outbound-api` for messages created by the REST API, `outbound-call` for messages created during a call, or `outbound-reply` for messages created in response to an incoming message.
Allowed:inboundoutbound-apioutbound-calloutbound-reply
fromstringoptional
The sender's phone number (in [E.164](https://en.wikipedia.org/wiki/E.164) format), [alphanumeric sender ID](https://www.twilio.com/docs/sms/quickstart), [Wireless SIM](https://www.twilio.com/docs/iot/wireless/programmable-wireless-send-machine-machine-sms-commands), [short code](https://www.twilio.com/en-us/messaging/channels/sms/short-codes), or [channel address](https://www.twilio.com/docs/messaging/channels) (e.g., `whatsapp:+15554449999`). For incoming messages, this is the number or channel address of the sender. For outgoing messages, this value is a Twilio phone number, alphanumeric sender ID, short code, or channel address from which the message is sent.
tostringoptional
The recipient's phone number (in [E.164](https://en.wikipedia.org/wiki/E.164) format) or [channel address](https://www.twilio.com/docs/messaging/channels) (e.g. `whatsapp:+15552229999`)
date_updatedstringoptional
The [RFC 2822](https://datatracker.ietf.org/doc/html/rfc2822#section-3.3) timestamp (in GMT) of when the Message resource was last updated
pricestringoptional
The amount billed for the message in the currency specified by `price_unit`. The `price` is populated after the message has been sent/received, and may not be immediately availalble. View the [Pricing page](https://www.twilio.com/en-us/pricing) for more details.
error_messagestringoptional
The description of the `error_code` if the Message `status` is `failed` or `undelivered`. If no error was encountered, the value is `null`. The value returned in this field for a specific error cause is subject to change as Twilio improves errors. Users should not use the `error_code` and `error_message` fields programmatically.
uristringoptional
The URI of the Message resource, relative to `https://api.twilio.com`.
account_sidstringoptional
The SID of the [Account](https://www.twilio.com/docs/iam/api/account) associated with the Message resource
num_mediastringoptional
The number of media files associated with the Message resource.
statusstringoptional
The status of the Message. Possible values: `accepted`, `scheduled`, `canceled`, `queued`, `sending`, `sent`, `failed`, `delivered`, `undelivered`, `receiving`, `received`, or `read` (WhatsApp only). For more information, See [detailed descriptions](https://www.twilio.com/docs/sms/api/message-resource#message-status-values).
Allowed:queuedsendingsentfaileddeliveredundeliveredreceivingreceivedacceptedscheduledreadpartially_delivered
messaging_service_sidstringoptional
The SID of the [Messaging Service](https://www.twilio.com/docs/messaging/api/service-resource) associated with the Message resource. A unique default value is assigned if a Messaging Service is not used.
sidstringoptional
The unique, Twilio-provided string that identifies the Message resource.
date_sentstringoptional
The [RFC 2822](https://datatracker.ietf.org/doc/html/rfc2822#section-3.3) timestamp (in GMT) of when the Message was sent. For an outgoing message, this is when Twilio sent the message. For an incoming message, this is when Twilio sent the HTTP request to your incoming message webhook URL.
date_createdstringoptional
The [RFC 2822](https://datatracker.ietf.org/doc/html/rfc2822#section-3.3) timestamp (in GMT) of when the Message resource was created
error_codeintegeroptional
The [error code](https://www.twilio.com/docs/api/errors) returned if the Message `status` is `failed` or `undelivered`. If no error was encountered, the value is `null`. The value returned in this field for a specific error cause is subject to change as Twilio improves errors. Users should not use the `error_code` and `error_message` fields programmatically.
price_unitstringoptional
The currency in which `price` is measured, in [ISO 4127](https://www.iso.org/iso/home/standards/currency_codes.htm) format (e.g. `usd`, `eur`, `jpy`).
api_versionstringoptional
The API version used to process the Message
subresource_urisobjectoptional
A list of related resources identified by their URIs relative to `https://api.twilio.com`

Error handling

AccountSid must be a 34-character SID beginning with AC, and Sid must be a 34-character message SID beginning with SM or MM. Both identifiers must refer to the account and message you intend to retrieve.