Skip to main content

Get Transactional SMS Statistics

Retrieve daily transactional SMS counters and totals for the API key's workspace. Statistics are kept permanently, even after the 90-day message logs expire. This endpoint reads stored daily counters, not the message log or billing ledger.


Endpoint​

GET https://api.campaignlark.com/v1/sms/statistics

Query Parameters​

ParameterTypeRequiredDefaultDescription
fromstringoptionalSee belowInclusive first UTC day, as YYYY-MM-DD or RFC3339. Timestamps are normalised to their UTC calendar day.
tostringoptionalSee belowInclusive last UTC day, as YYYY-MM-DD or RFC3339. Timestamps are normalised to their UTC calendar day.

When both parameters are omitted, the range is the last 30 UTC calendar days, including today. If only one bound is supplied, the other end is unbounded. from must not be after to; validation compares the supplied instants before they are normalised to UTC days.

There is no pagination, status filter, or number/reference search on statistics. These counters are workspace-wide for the selected days.


Sample Request​

GET https://api.campaignlark.com/v1/sms/statistics?from=2026-03-12&to=2026-03-13
Authorization: Bearer YOUR_API_KEY

Response​

Success — 200 OK​

{
"data": {
"daily": [
{
"date": "2026-03-12T00:00:00Z",
"sent": 100,
"delivered": 95,
"failed": 3,
"parts": 110,
"charge": "1.37500"
},
{
"date": "2026-03-13T00:00:00Z",
"sent": 50,
"delivered": 48,
"failed": 1,
"parts": 50,
"charge": "0.62500"
}
],
"totals": {
"date": "0001-01-01T00:00:00Z",
"sent": 150,
"delivered": 143,
"failed": 4,
"parts": 160,
"charge": "2.00000"
}
}
}

Statistics Fields​

FieldTypeDescription
dailyarrayStored daily rows, ordered by date ascending. Days without a stored row are omitted, not filled with zeros.
daily[].datestringUTC day at midnight, formatted as RFC3339.
daily[].sentintegerMessages accepted by the provider on that day.
daily[].deliveredintegerDelivery events recorded for that day.
daily[].failedintegerFinal failure events recorded for that day, including failures before provider acceptance.
daily[].partsintegerParts recorded when messages were accepted by the provider.
daily[].chargestringCharge recorded with sent messages, represented as an exact decimal string.
totalsobjectSums of the returned rows, with the same fields. totals.charge is formatted to five decimal places.
totals.datestringCurrently the zero-time placeholder 0001-01-01T00:00:00Z; it is not a range boundary.

Counts are grouped by each event's UTC day, not by the day the message was queued. A delivery may therefore fall on a different day from its send. sent, delivered, and failed are not mutually exclusive buckets for a fixed set of messages.

Charges are stored using Decimal128 and returned as strings; avoid binary floating-point arithmetic when adding them. Daily charges are not calculated from the billing ledger at read time. For an empty range, daily is [], totals are zero, totals.charge is "0.00000", and totals.date retains the zero-time placeholder.


Errors​

StatusMessageCause
400Please provide from/to dates as YYYY-MM-DD or RFC3339 timestamps.A date cannot be parsed.
400The from date must be before the to date. Adjust the date range and try again.from is later than to.
400We couldn't load SMS statistics. Please try again shortly.Daily statistics could not be read.
400We couldn't read SMS charges. Please contact support for assistance.A stored charge could not be parsed.

The authentication, rate-limit, and error-envelope rules also apply.