Business API Stats
List logs
List logs for everyone or a contact for a business API user. Optional query parameters: limit, contact, job_id and state.
HTTP Request
GET https://api.moya.app/v1/stats/logs
Parameters
Name | Type | Required | Description |
---|---|---|---|
start | Float | No | The start date, formatted as a Unix timestamp. If not given, defaults to 30 days ago. |
end | Float | No | The end date, formatted as a Unix timestamp |
contact | String | No | Specify the JID of a contact to show |
state | String | No | A log state. Options are delivered_to_server , delivered_to_user , delivery_failed , read , received , reception_failed_http , sending_failed , sent . |
job_id | String | No | A log job ID |
limit | Integer | No | Limit the number of logs to show. If not given, defaults to 100. |
Example requests
Example 1: Retrieve logs with limit 10
curl --location --request GET 'https://api.moya.app/v1/stats/logs?limit=10' \
--header 'Authorization: Bearer YourSecretToken'
Example 1: Successful Response (Status : 200)
[
{
"log_time": 1642879855.0,
"contact": "27603014226",
"state": "delivered_to_server",
"job_id": "00000000-0000-0000-0000-000000000000"
}
]
Example 2: Retrieve logs with contact and state filter
curl --location --request GET 'https://api.moya.app/v1/stats/logs?contact=2711111111&state=delivery_failed' \
--header 'Authorization: Bearer YourSecretToken'
Example 2: Successful Response (Status : 200)
[
{
"log_time": 1642879855.0,
"contact": "2711111111",
"state": "delivered_to_server",
"job_id": "00000000-0000-0000-0000-000000000000"
}
]
Example 3: Retrieve logs (No Result)
curl --location --request GET 'https://api.moya.app/v1/stats/logs?limit=10' \
--header 'Authorization: Bearer YourSecretToken'
Example 3: No Content Response (Status : 204)
STATUS: 204
List jobs
List jobs over a time period.
Example request
curl --location --request GET 'https://api.moya.app/v1/stats/jobs?start=1641855600&end=1656108000' \
--header 'Authorization: Bearer YourSecretToken'
HTTP Request
GET https://api.moya.app/v1/stats/jobs
Parameters
Name | Type | Required | Description |
---|---|---|---|
start | Float | No | The start date, formatted as a Unix timestamp. If not given, defaults to 30 days ago. |
end | Float | No | The end date, formatted as a Unix timestamp |
Response
Every successful request is responded to with a json (200 OK
) or an empty HTTP response (204 No Content
).
Example requests
Example 1: Retrieve jobs with date range
curl --location --request GET 'https://api.moya.app/v1/stats/jobs?start=1642201200&end=1656108000' \
--header 'Authorization: Bearer YourSecretToken'
Example 1: Successful Response
[
{
"job_id": "00000000-0000-0000-0000-000000000001",
"state": "delivery_failed",
"payload_type": "",
"count": 1
}
]
Example 2: Retrieve jobs with date range (No Result)
curl --location --request GET 'https://api.moya.app/v1/stats/jobs?start=1642201200&end=1656108000' \
--header 'Authorization: Bearer YourSecretToken'
Example 2: No Content Response (Status : 204)
STATUS: 204