Appearance
Reports API
The Reports API allows you to retrieve information about message delivery status and device usage.
Get Device Balance
Get the message balance information for a device.
Endpoint
GET /reports/balance/{device}Path Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| device | string | Yes | The mobile number of the device |
Example Request
bash
curl -X GET \
https://{subdomain}.whatsgate.net/api/reports/balance/123456789 \
-H 'Access-Token: {api_token}'Example Response
json
{
"success": true,
"remaining": 1000,
"successful_count": 500,
"pending": 50,
"failed": 10
}Error Response
json
{
"success": false,
"message": "Device not found"
}Get Failed Numbers
Get a list of phone numbers where message sending failed.
Endpoint
GET /reports/failed_numbersQuery Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
| device | string | No | Filter by device mobile number |
| from | string (date) | No | Filter by start date (format: YYYY-MM-DD) |
| to | string (date) | No | Filter by end date (format: YYYY-MM-DD) |
Example Request
bash
curl -X GET \
'https://{subdomain}.whatsgate.net/api/reports/failed_numbers?device=123456789&from=2023-01-01&to=2023-01-31' \
-H 'Access-Token: {api_token}'Example Response
json
{
"success": true,
"data": [
{
"number": "987654321",
"date": "2023-01-01T12:00:00Z"
},
{
"number": "987654322",
"date": "2023-01-02T14:30:00Z"
}
]
}Error Response
json
{
"success": false,
"message": "The selected device is invalid."
}Error Handling
If there's an error with your request, you'll receive a response with a success field set to false and a message field describing the error.
Common error messages include:
- "Device not found"
- "The selected device is invalid."
- "The to date must be a date after from."
