Retrieve a list of messages belonging to the account used to make the request

GET /2010-04-01/Accounts/{AccountSid}/Messages.json

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

  • AccountSid string Required

    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 as DateSent<=YYYY-MM-DD, to read messages sent on or before midnight on a date, and DateSent>=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 as DateSent<=YYYY-MM-DD, to read messages sent on or before midnight on a date, and DateSent>=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 as DateSent<=YYYY-MM-DD, to read messages sent on or before midnight on a date, and DateSent>=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 is 1000.

Responses

  • OK

    Hide response attributes Show response attributes object
    • end integer
    • first_page_uri string(uri)
    • messages array[object]
      Hide messages attributes Show messages attributes array[object]
      • account_sid string | null

        The SID of the Account that created the resource

        Minimum length is 34, maximum length is 34. Format should match the following pattern: ^AC[0-9a-fA-F]{32}$.

      • api_version string | null

        The API version used to process the message

      • body string | null

        The message text

      • date_created string(date-time-rfc-2822) | null

        The RFC 2822 date and time in GMT that the resource was created

      • date_sent string(date-time-rfc-2822) | null

        The RFC 2822 date and time in GMT when the message was sent

      • date_updated string(date-time-rfc-2822) | null

        The RFC 2822 date and time in GMT that the resource was last updated

      • direction string | null

        The direction of the message

        Values are inbound, outbound-api, outbound-call, or outbound-reply.

      • error_code integer | null

        The error code associated with the message

      • error_message string | null

        The description of the error_code

      • from string(phone-number) | null

        The phone number that initiated the message

      • The SID of the Messaging Service used with the message.

        Minimum length is 34, maximum length is 34. Format should match the following pattern: ^MG[0-9a-fA-F]{32}$.

      • num_media string | null

        The number of media files associated with the message

      • num_segments string | null

        The number of messages used to deliver the message body

      • price string | null

        The amount billed for the message

      • price_unit string(currency) | null

        The currency in which price is measured

      • sid string | null

        The unique string that identifies the resource

        Minimum length is 34, maximum length is 34. Format should match the following pattern: ^(SM|MM)[0-9a-fA-F]{32}$.

      • status string | null

        The status of the message

        Values are queued, sending, sent, failed, delivered, undelivered, receiving, received, accepted, scheduled, read, partially_delivered, or canceled.

      • subresource_uris object(uri-map) | null

        A list of related resources identified by their relative URIs

      • to string | null

        The phone number that received the message

      • uri string | null

        The URI of the resource, relative to https://api.twilio.com

    • next_page_uri string(uri)
    • page integer
    • page_size integer
    • start integer
    • uri string(uri)
GET /2010-04-01/Accounts/{AccountSid}/Messages.json
curl \
 -X GET https://api.twilio.com/2010-04-01/Accounts/{AccountSid}/Messages.json \
 --user "username:password"
Response examples (200)
{
  "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"
}
Response examples (200)
{
  "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"
}