URL | Verbs | Fields | List | Error Codes
Use this endpoint to retrieve previously sent or received messages. This is a read-only endpoint.
https://app.mojotxt.com/api/v1/{phone_number}/messageLog/{verb}
| Verb | Description |
|---|---|
| list | Retrieve a list of incoming/outgoing messages. |
| Field | Type | Notes |
|---|---|---|
| LogID | Integer | A unique identifier for this message. |
| Direction | String | "I" if the message is incoming (received from the remote phone) or "O" if the message is outgoing (sent to the remote phone). |
| PhoneNumber | String | The phone number of the person who sent/received the message in international format. |
| FirstName | String | The first name of the person who sent/received the message. |
| LastName | String | The last name of the person who sent/received the message. |
| Timestamp | UNIX Timestamp (Integer) | The time when the message was sent/received. |
| URLClickTimestamp | UNIX Timestamp (Integer) | If the message contained a MojoTxt-provided URL, this field shows when it was clicked. (Unclicked URLs will have a NULL value.) |
| Body | String | The contents of the message body. |
| DeliveryStatus | String | The status of a sent message. Will be one of the following:
|
| ErrorMessage | String | If the message is in "failed", "error" or "undelivered" status, this field contains a human-readable description of the error (if the carrier provided one). |
| Credits | Number | The number of MojoTxt credits used to send/receive this message. Can be a fraction. |
| Type | String | Either "SMS" or "MMS". |
| Media | String | If message is an MMS, a URL to the message's media attachment. |
| PhoneID | Integer | The id of the subscriber who sent/received the message. |
| ListMessageID | Integer | The MessageID of the message this was sent for, if any. |
| KeywordID | Integer | The keyword this message is connected to, if any. |
| ListID | Integer | The list this message is connected to, if any. |
| ResponderID | Integer | The auto-responder this message is connected to, if any. |
| Status | String | An internal MojoTxt status code. Use DeliveryStatus to follow delivery. |
| InboxStatus | String | For a message in your inbox: "U" (unread) or "R" (read). |
| ErrorCode | Integer | The carrier's numeric error code, if it provided one. |
| URL | String | The link attached to this message, if any. |
https://app.mojotxt.com/api/v1/{phone_number}/messageLog/list
Parameters can be sent in the URL querystring or as POST variables.
| Parameter | Options | Description |
|---|---|---|
| Sort | LogID, Timestamp | Sort the list by a field. |
| SortDirection | ASC, DESC | Sort Ascending or Descending |
| StartTime | UNIX Timestamp (Integer) or ISO date | Show messages from this time onward. An ISO date without a time zone is read as UTC. StartDate is accepted as another name for this parameter. |
| EndTime | UNIX Timestamp (Integer) or ISO date | Show messages up to this time. (Can be used in conjunction with StartTime to specify a range.) EndDate is accepted as another name for this parameter. |
| MessageID | Integer | Show logs for a particular message. (Useful to retrieve the delivery information or link click status for a particular outgoing message.) |
| PhoneID | Integer | Show logs for a particular subscriber. |
| Direction | String (either "O" or "I") | Show only Incoming or Outgoing messages. (By default, both are shown.) The words "in", "inbound", "out" and "outbound" also work. |
| Limit | Integer (1-500), Default: 100 | The maximum number of records to list per page. |
| Page | Integer | The page of records to return. |
The following request would show all incoming messages received after 12:16 PM Eastern on March 5, 2023.
GET https://app.mojotxt.com/api/v1/+15555550100/messageLog/list?StartTime=1678036608&Direction=I
{
"result": "success",
"timestamp": 1793491200,
"request": {
"StartTime": "1678036608",
"Direction": "I",
"object": "messageLog",
"verb": "list",
"phone": "+15555550100"
},
"record_count": 3,
"records": [
{
"LogID": 1911307,
"Direction": "I",
"PhoneNumber": "+15555550101",
"FirstName": null,
"LastName": null,
"Timestamp": 1679528862,
"URLClickTimestamp": null,
"Body": "help",
"DeliveryStatus": null,
"ErrorMessage": null,
"Credits": 0,
"Type": "SMS",
"Media": null,
"PhoneID": 6024,
"ListMessageID": null,
"KeywordID": null,
"ListID": null,
"ResponderID": null,
"Status": "S",
"InboxStatus": "R",
"ErrorCode": null,
"URL": null
},
{
"LogID": 1911305,
"Direction": "I",
"PhoneNumber": "+15555550102",
"FirstName": "Jane",
"LastName": "Example",
"Timestamp": 1679528847,
"URLClickTimestamp": null,
"Body": "This is an incoming message.",
"DeliveryStatus": null,
"ErrorMessage": null,
"Credits": 0,
"Type": "SMS",
"Media": null,
"PhoneID": 6025,
"ListMessageID": null,
"KeywordID": null,
"ListID": null,
"ResponderID": null,
"Status": "S",
"InboxStatus": "R",
"ErrorCode": null,
"URL": null
},
{
"LogID": 1911303,
"Direction": "I",
"PhoneNumber": "+15555550103",
"FirstName": "Sam",
"LastName": "Sample",
"Timestamp": 1679528824,
"URLClickTimestamp": null,
"Body": "A family photo :)",
"DeliveryStatus": null,
"ErrorMessage": null,
"Credits": 1,
"Type": "MMS",
"Media": "https://example.com/media/photo.jpg",
"PhoneID": 6026,
"ListMessageID": null,
"KeywordID": null,
"ListID": null,
"ResponderID": null,
"Status": "S",
"InboxStatus": "R",
"ErrorCode": null,
"URL": null
}
]
}
| Error Code | Endpoint | Description | Notes |
|---|---|---|---|
| 1000-1099 | API Core | (Multiple) | See API Error Codes |