v1
latestSwagger 2.02026-07-13151175.7 KBRetrieve Messages
Retrieve the messages you have sent or received.
Scheduled messages are available for retrieval only after the delivery date.
All the parameters are optional. If a value is not supplied for filter, the messages are not filtered.
Messages can be filtered by supplying query clauses in the filter parameter. Each clause has the form name=value where name is the name of a filter field and value is a valid value for that field. A value for a field is optional. Include a clause for a field in the filter only when there is a need to fetch messages that match some value for that field. For a numeric filter field, you can also use the less than operator (<).
If present, the filter value must have at least one clause, but it can contain a combination of clauses. Multiple clauses are separated with the & symbol. Semantically, multiple clauses form a logical conjunction.
For example, if you want to list all messages that were sent as part of a particular submission, your filter contains two clauses and will look something like this
type%3DSENT&submission.id%3D1-00000000000522347562
Because filter is a request parameter, it is important to note that the value for this parameter must be URL encoded. In particular, the = encodes to %3D and the & encodes to %26. Note that you do not have to encode the < character.
Using the previous example to illustrate; after encoding and encasing it, the clauses are transformed into a request that looks like this
GET /v1/messages?filter=type%3DSENT%26submission.id%3D1-00000000000522347562
If the field name or the field value of a clause is not valid, a bad_request error is returned instead of the usual result. The detail field of this error provides more information about the problem.
The table below lists the fields available for filtering
| Field | Type | Values | Note and example |
|---|---|---|---|
| id | Integer | Positive integer | Use the id field with < (or with >) to fetch messages that are older (or newer) than those that are already fetched. <br/>filter=id<123456 |
| type | String | SENT, RECEIVED | SENT are Mobile Terminating (MT) SMSs; RECEIVED are Mobile Originating (MO) SMSs.<br/>filter=type%3DSENT |
| submission.id | String | filter=submission.id%3D1-00000000000522347562 | |
| status.type | String | ACCEPTED, SENT, DELIVERED, FAILED | See the message status.type field for more information. <br/>filter=status.type%3DDELIVERED |
| status.id | String | See the message status.id field for more information. filter=status.id%3DFAILED.EXPIRED | |
| submission.date | String | Formatted Date | A fully specified date (e.g. 2017-01-01T10:00:00+01:00). Use this field with <=, <, > or >= to limit the values. <br/>filter=submission.date%3E%3D2017-01-01T10%3A00%3A00%2B01%3A00 |
| userSuppliedId | String | Use a string value you specified in the userSuppliedId property when you sent the message. Only SENT messages will be retrieved. <br/>filter=userSuppliedId%3Dacc009876 |
Query parameters
The maximum number of messages that are returned. The default is 1000. The value of limit is not a guarantee that a specific number of messages will be in the response, even if there are more messages available. Consider the case where you have 150 messages and you specify limit=50. It is possible that only 49 messages will be returned. The way to make sure that there are no more messages is to submit a new call using the id filter field with the < operator (described below).
See the message filtering for more information.
The default value is DESCENDING
If the sortOrder is DESCENDING, the newest messages be first in the result. ASCENDING places the oldest messages on top of the response.
Response
Contains the requested array of messages