Developers can fetch all sent and received messages from their CRM Messaging account using the Message History API.
This API allows you to retrieve message logs including sender, receiver, message body, delivery status, channel, credits consumed and other metadata.
Endpoint
GET
https://app.crm-messaging.cloud/index.php/Api/messageHistory
Headers
| Key | Value |
|---|---|
| Authorization | Bearer API_TOKEN |
| Accept | application/json |
API_TOKEN can be found inside your Developer Console in CRM Messaging.
Query Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
page | integer | No | Page number for pagination. Default 1. |
per_page | integer | No | Number of records per page. Default 50. Max 500. |
Example cURL Request
curl --location --request GET 'https://app.crm-messaging.cloud/index.php/Api/messageHistory?page=1&per_page=50' \
--header 'Authorization: Bearer API_TOKEN' \
--header 'Accept: application/json'
Response Fields
Each message record returns:
| Field | Description |
|---|---|
| id | Unique record ID |
| msgId | Provider message ID |
| to | Recipient number |
| from | Sender number / Sender ID |
| message | Message text (decrypted) |
| channel | sms or whatsapp |
| deliveryStatus | Delivery state (e.g. SENT, DELIVERED, FAILED, READ) |
| direction | OUTGOING or INCOMING |
| creditsConsumed | SMS credits deducted |
| errorCode | Error code if failed |
| date | Timestamp in ISO-8601 format |
Sample JSON Response
{
"status": "success",
"data": {
"page": 1,
"per_page": 50,
"total": 1243,
"messages": [
{
"id": 78542,
"msgId": "MM-abc123xyz",
"to": "+15551234567",
"from": "CRMMSG",
"message": "Your verification code is 659144.",
"channel": "sms",
"deliveryStatus": "DELIVERED",
"direction": "OUTGOING",
"creditsConsumed": 1,
"errorCode": null,
"date": "2025-11-30T14:12:45+05:30"
}
]
}
}
Error Codes
| HTTP Code | Description |
|---|---|
| 200 | Success |
| 401 | Unauthorized — invalid or missing API token |
| 405 | Method Not Allowed |
| 499 | Token Required |
| 500 | Server error |
Notes
- History includes both SMS and WhatsApp if used.
- Messages are sorted in reverse chronological order (latest first).
- Message text is automatically decrypted if encryption was applied.
- Pagination is recommended for large datasets.