Retrieve a list of messages belonging to the account used to make the request
A Message resource represents an inbound or outbound message.
Retrieve a list of messages belonging to the account used to make the request
Path parameters
-
The SID of the Account that created the Message resources to read.
Query parameters
-
To string(phone-number)
Read messages sent to only this phone number.
-
From string(phone-number)
Read messages sent from only this phone number or alphanumeric sender ID.
-
DateSent string(date-time)
The date of the messages to show. Specify a date as
YYYY-MM-DD
in GMT to read only messages sent on this date. For example:2009-07-06
. You can also specify an inequality, such asDateSent<=YYYY-MM-DD
, to read messages sent on or before midnight on a date, andDateSent>=YYYY-MM-DD
to read messages sent on or after midnight on a date. -
DateSent< string(date-time)
The date of the messages to show. Specify a date as
YYYY-MM-DD
in GMT to read only messages sent on this date. For example:2009-07-06
. You can also specify an inequality, such asDateSent<=YYYY-MM-DD
, to read messages sent on or before midnight on a date, andDateSent>=YYYY-MM-DD
to read messages sent on or after midnight on a date. -
DateSent> string(date-time)
The date of the messages to show. Specify a date as
YYYY-MM-DD
in GMT to read only messages sent on this date. For example:2009-07-06
. You can also specify an inequality, such asDateSent<=YYYY-MM-DD
, to read messages sent on or before midnight on a date, andDateSent>=YYYY-MM-DD
to read messages sent on or after midnight on a date. -
PageSize integer
How many resources to return in each list page. The default is 50, and the maximum is 1000.
Minimum value is
1
, maximum value is1000
.
curl \
-X GET https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Messages.json \
--user "username:password"
{
"end": 42,
"first_page_uri": "https://example.com",
"messages": [
{
"account_sid": "string",
"api_version": "string",
"body": "string",
"date_created": "string",
"date_sent": "string",
"date_updated": "string",
"direction": "inbound",
"error_code": 42,
"error_message": "string",
"from": "string",
"messaging_service_sid": "string",
"num_media": "string",
"num_segments": "string",
"price": "string",
"price_unit": "string",
"sid": "string",
"status": "queued",
"subresource_uris": {},
"to": "string",
"uri": "string"
}
],
"next_page_uri": "https://example.com",
"page": 42,
"page_size": 42,
"previous_page_uri": "https://example.com",
"start": 42,
"uri": "https://example.com"
}
{
"end": 42,
"first_page_uri": "https://example.com",
"messages": [
{
"account_sid": "string",
"api_version": "string",
"body": "string",
"date_created": "string",
"date_sent": "string",
"date_updated": "string",
"direction": "inbound",
"error_code": 42,
"error_message": "string",
"from": "string",
"messaging_service_sid": "string",
"num_media": "string",
"num_segments": "string",
"price": "string",
"price_unit": "string",
"sid": "string",
"status": "queued",
"subresource_uris": {},
"to": "string",
"uri": "string"
}
],
"next_page_uri": "https://example.com",
"page": 42,
"page_size": 42,
"previous_page_uri": "https://example.com",
"start": 42,
"uri": "https://example.com"
}