Project
Usage and Consumptions
View SMS usage and consumption history for the project
Endpoint
GET /api/project/consumptionsQuery parameters
| Field | Type | Required | Description |
|---|---|---|---|
page | integer | No | Page number, minimum 1 (default: 1) |
per_page | integer | No | Results per page, minimum 1 (default: 10) |
from | date | No | Filter records on/after this date (YYYY-MM-DD) |
to | date | No | Filter records on/before this date (YYYY-MM-DD) |
Records are returned newest first.
This endpoint reports subscription quota consumption only. Messages paid for with payment_type: "wallet" are charged against the company wallet and do not appear here — use List Messages or the dashboard's wallet transactions for those.
Example
curl "https://sms.lamah.com/api/project/consumptions?from=2024-01-01&to=2024-01-31" \
-H "Authorization: Bearer YOUR_API_TOKEN"Response
The response is wrapped in a data key containing a Laravel paginator object:
{
"data": {
"current_page": 1,
"data": [
{
"consumption": 5,
"type": "SMS",
"request_id": "b9e8a1f2-4c60-4b0b-9f51-0c4f2f6c9e7a",
"allocation_index": 0,
"created_at": "2024-01-15T10:30:00Z",
"updated_at": "2024-01-15T10:30:00Z"
}
],
"first_page_url": "https://sms.lamah.com/api/project/consumptions?page=1",
"from": 1,
"last_page": 25,
"last_page_url": "https://sms.lamah.com/api/project/consumptions?page=25",
"links": [
{ "url": null, "label": "« Previous", "active": false },
{ "url": "https://sms.lamah.com/api/project/consumptions?page=1", "label": "1", "active": true },
{ "url": "https://sms.lamah.com/api/project/consumptions?page=2", "label": "Next »", "active": false }
],
"next_page_url": "https://sms.lamah.com/api/project/consumptions?page=2",
"path": "https://sms.lamah.com/api/project/consumptions",
"per_page": 10,
"prev_page_url": null,
"to": 10,
"total": 250
}
}Top-level response fields
| Field | Type | Description |
|---|---|---|
data | object | Laravel paginator object |
Pagination fields
| Field | Type | Description |
|---|---|---|
current_page | integer | Current page number |
data | array | Consumption records on the current page |
first_page_url | string | URL of the first page |
from | integer|null | Index of the first record on the current page |
last_page | integer | Total number of pages |
last_page_url | string | URL of the last page |
links | array | Laravel pagination navigation links |
next_page_url | string|null | URL of the next page |
path | string | Base URL for this paginated resource |
per_page | integer | Results per page |
prev_page_url | string|null | URL of the previous page |
to | integer|null | Index of the last record on the current page |
total | integer | Total number of consumption records |
Consumption record fields
| Field | Type | Description |
|---|---|---|
consumption | integer | Units consumed (SMS parts, or 1 per OTP) |
type | string | Feature type: SMS or OTP |
request_id | string|null | The send request this consumption was recorded against |
allocation_index | integer|null | Position when a single send is split across multiple subscriptions |
created_at | string | ISO 8601 timestamp when consumption was recorded |
updated_at | string | ISO 8601 timestamp when record was last updated |
One send can produce several records when its quota is drawn from more than one active subscription. Group by request_id to reassemble the total charged for a single send.
Error responses
422 Unprocessable Entity — Validation failed
{
"message": "The from field must be a valid date.",
"errors": {
"from": ["The from field must be a valid date."]
}
}401 Unauthorized
{ "message": "Invalid or missing token." }{ "message": "Unauthorized IP address." }Use this to build usage reports or billing dashboards for your users. Timestamps are returned in UTC.