Free Accounts & Free Advice

REST API: SMS Messages

The SMS/Messages resource has been deprecated, replaced by the Messages resource, and may be removed in future versions of the Twilio API.
Since the Messages resource is a superset of SMS/Messages, we recommend its use going forward.

An SMS Message instance resource represents an inbound
or outbound SMS message. Whenever someone sends an SMS message to one of your
Twilio numbers, or when you send an SMS message via the REST API or using the
<Sms> verb, Twilio creates an SMS Message instance resource and associates it
with your account.

The SMS Messages list resource represents the set of SMS messages sent from and
received by an account.

The phone number that initiated the message in E.164 format. For incoming messages, this will be the remote phone. For outgoing messages, this will be one of your Twilio phone numbers.

To

The phone number that received the message in E.164 format. For incoming messages, this will be one of your Twilio phone numbers. For outgoing messages, this will be the remote phone.

Body

The text body of the SMS message. Up to 160 characters long.

Status

The status of this SMS message. Either queued, sending, sent,failed, or received.

Direction

The direction of this SMS message. inbound for incoming messages, outbound-api for messages initiated via the REST API, outbound-call for messages initiated during a call or outbound-reply for messages initiated in response to an incoming SMS.

Price

The amount billed for the message, in the currency associated with the account.

PriceUnit

The currency in which Price is measured, in ISO 4127 format (e.g. usd, eur, jpy).

You may limit the list by providing certain query string parameters to the listing resource. Note, parameters are case-sensitive:

Parameter

Description

To

Only show SMS messages to this phone number.

From

Only show SMS messages from this phone number.

DateSent

Only show SMS messages sent on this date (in GMT format), given as YYYY-MM-DD. Example: DateSent=2009-07-06. You can also specify inequality, such as DateSent<=YYYY-MM-DD for SMS messages that were sent on or before midnight on a date, and DateSent>=YYYY-MM-DD for SMS messages sent on or after midnight on a date.