# Criteria for retrieving messaging information

The `criteria` object specifies what messaging information is returned and how the returned information is sorted.

The `criteria` object has three main properties: `Type`, `Filter`, and `Sort`. These are described in the following table. Properties enclosed in brackets are optional.

Table: Criteria object properties
Property | Description | Type | Value
--- | --- | --- | ---
`criteria.Type` | Specifies the type of messaging objects to retrieve. | string | Possible values: `"Inbox"`
`[criteria.Filter]` | Specifies how the information to be retrieved is filtered. | object | Object with the properties specified below
`[criteria.Filter.MessageTypeList]` | Specifies the type or types of messages to retrieve. | array of strings | Possible values: `"SMS"` `"MMS"` `"unknown"` Note: The current implementation only recognizes SMS and MMS. Other types of messages are `unknown`.
`[criteria.Filter.MessageId]` | Specifies the unique ID of the message to retrieve. If `MessageId` is specified, then only the message with that ID is retrieved. | number |
`[criteria.Filter.SenderList]` | Specifies the message recipients. Only messages sent to these recipients are retrieved. | array of strings |
`[criteria.Filter.Subject]` | Specifies the message subjects. Only messages with these subjects are retrieved. Note: SMS does not support subject. This property is only valid for MMS. | string |
`[criteria.Filter.StartDate]` | If only `StartDate` is specified, all messages received on or after this date are retrieved. If both `StartDate` and `EndDate` are specified, all messages received within these dates are retrieved. If `EndDate` is earlier than `StartDate`, an error is returned. | date object |
`[criteria.Filter.EndDate]` | If only `EndDate` is specified, all messages received on or before this date are retrieved. If both `StartDate` and `EndDate` are specified, all messages received within these dates are retrieved. If `EndDate` is earlier than `StartDate`, an error is returned. | date object |
`[criteria.Sort]` | Specifies how the returned list of information is sorted. | object | Object with the properties specified below
`[criteria.Sort.Key]` | Specifies the value to sort by. Note: By default, sorting is done in ascending order based on `Date`. | string | Possible values: `"Date"` `"Size"` `"Sender"` `"Subject"` `"MessageId"`
`[criteria.Sort.Order]` | Specifies the sort order. | string | Possible values: `"Ascending"` `"Descending"`