SMS stats by country
GET
/v1/sms/stats/countries
const stats = await bird.sms.stats.byCountry({
from: "2026-05-01",
to: "2026-05-31",
sort: "delivery_rate",
});
for (const row of stats.data ?? []) {
console.log(row.country, row.delivery);
}stats = client.sms.stats.by_country(from_="2026-05-01", to="2026-05-31", sort="delivery_rate")
for row in stats.data or []:
print(row.country, row.delivery)stats, err := client.Sms.Stats.ByCountry(context.Background(), bird.SmsStatsByCountryParams{
From: time.Now().AddDate(0, -1, 0),
To: time.Now(),
Sort: "delivery_rate", // worst delivery first is Sort plus a read of the tail
})
if err != nil {
log.Fatal(err)
}
for _, row := range *stats.Data {
fmt.Println(*row.Country, *row.Delivery.Accepted, *row.Delivery.DeliveryRate)
}$byCountry = $bird->sms->stats->byCountry([
'from' => '2026-05-01',
'to' => '2026-05-31',
'sort' => 'delivery_rate',
]);
foreach ($byCountry->getData() ?? [] as $row) {
echo $row->getCountry(), ' ', $row->getDelivery()?->getDeliveryRate(), PHP_EOL;
}bird sms stats by-countrycurl -X GET "https://us1.platform.bird.com/v1/sms/stats/countries" \
-H "Authorization: Bearer $TOKEN" \
--url-query "sort=accepted" \
--url-query "limit=50" \
--url-query "include_trend=false" \
--url-query "trend_grain=daily"Returns aggregate delivery and latency stats grouped by destination country for the requested period. Rows are ranked by the sort metric (default accepted) descending and capped at the requested limit (default 50, hard maximum 200). Use this to compare sending performance across the countries you send to.
Rows are attributed to send time, not event time: a delivery confirmed during the period for a message accepted earlier counts against the earlier period, not this one. A recent period therefore under-reports delivered while its delivery reports are still arriving, and its counts only ever grow toward the truth.
The maximum window is 365 days; requesting a longer range returns 422.
Parametri di query
from
string
Start date (inclusive) in YYYY-MM-DD, interpreted as a calendar day in timezone (a UTC day when timezone is omitted). Defaults to 30 days before to when omitted; with include_trend=true and trend_grain=hourly the default tightens to keep the window within the 720-hour trend cap.
to
string
End date (inclusive) in YYYY-MM-DD, interpreted as a calendar day in timezone (a UTC day when timezone is omitted). Defaults to today in that timezone when omitted. Window may not exceed 365 days.
timezone
string
IANA timezone identifier (for example Asia/Kathmandu) to report in; defaults to UTC. Day and hour boundaries and the default window when from and to are omitted both follow it, so a calendar-day from or to names a local day. A from or to carrying its own UTC offset is rejected while this is set: pass a calendar day or a Z instant.
sort
string
Metric to rank rows by, applied descending. Any lifecycle count or derived rate in the response may be used; rows whose rate is undefined (zero denominator) sort last. Defaults to accepted.
Possible values: accepted, sent, delivered, undelivered, failed, rejected, expired, delivery_rate, failure_rate
limit
integer
Maximum number of country rows to return, ranked by the sort field descending.
include_trend
boolean
When true, each row also carries a trend array: a short per-bucket lifecycle-count series for that row over the window. Returned only when limit is 50 or fewer and the window is at most 90 days (trend_grain=daily) or 720 hours (trend_grain=hourly); a larger request returns 422.
trend_grain
string
Bucket grain for the trend series. Has no effect unless include_trend=true.
Possible values: daily, hourly
Payload di risposta
period
object
obbligatorio
The date range the response covers (echoed back from the request), plus data_as_of, the freshness boundary the data is current to.
Mostra attributi secondari
period.from
string
obbligatorio
Inclusive start of the window the response covers -- a calendar day (YYYY-MM-DD) for day windows, or an hour boundary (RFC 3339) for hour windows.
period.to
string
obbligatorio
Inclusive end of the window the response covers -- a calendar day (YYYY-MM-DD) for day windows, or an hour boundary (RFC 3339) for hour windows.
period.data_as_of
nullable string
The instant the statistics in this response are current to: events recorded up to roughly this time are reflected, while more recent events may not be yet. Statistics are served from a rolling aggregation that refreshes every few seconds, so a response is near-real-time but not live; use this field to label data freshness (for example "as of 14:03") rather than assuming the numbers are to-the-second. Null when the freshness boundary is not being reported.
data
array of object
obbligatorio
Country breakdown rows, ranked by the sort metric (default accepted) descending. Empty when no messages were sent in the period.
Mostra attributi secondari
data.country
string
obbligatorio
The destination country this row aggregates, as an ISO 3166-1 alpha-2 code.
data.delivery
object
obbligatorio
Mostra attributi secondari
data.delivery.accepted
integer
obbligatorio
Distinct messages accepted for sending after admission checks. This is the denominator for delivery_rate and failure_rate.
data.delivery.sent
integer
obbligatorio
Distinct messages handed off to the carrier for delivery.
data.delivery.delivered
integer
obbligatorio
Distinct messages the carrier confirmed as delivered to the handset.
data.delivery.undelivered
integer
obbligatorio
Distinct messages the carrier reported as not delivered.
data.delivery.failed
integer
obbligatorio
Distinct messages that failed during sending.
data.delivery.rejected
integer
obbligatorio
Distinct messages rejected before any send attempt, for example by sending policy or a message-generation failure.
data.delivery.expired
integer
obbligatorio
Distinct messages that could not be delivered within their validity window and expired.
data.delivery.delivery_rate
nullable number
obbligatorio
Share of accepted messages that were delivered, computed as delivered / accepted. Null when no messages were accepted in scope.
data.delivery.failure_rate
nullable number
obbligatorio
Share of accepted messages that ultimately failed, computed as (undelivered + failed + expired) / accepted. Null when no messages were accepted in scope.
data.latency
object
obbligatorio
Mostra attributi secondari
data.latency.processing
object
p50, p95, and p99 latency percentiles in milliseconds for one latency family over the scope. Percentiles are approximate (computed from a high-volume aggregation pipeline). All three are null together when no qualifying event contributed a latency measurement in scope.
Mostra attributi secondari
data.latency.processing.p50_ms
nullable integer
obbligatorio
Median (50th percentile) latency in milliseconds. Null when no qualifying event contributed a measurement.
data.latency.processing.p95_ms
nullable integer
obbligatorio
95th percentile latency in milliseconds. Null when no qualifying event contributed a measurement.
data.latency.processing.p99_ms
nullable integer
obbligatorio
99th percentile latency in milliseconds. Null when no qualifying event contributed a measurement.
data.latency.delivery
object
p50, p95, and p99 latency percentiles in milliseconds for one latency family over the scope. Percentiles are approximate (computed from a high-volume aggregation pipeline). All three are null together when no qualifying event contributed a latency measurement in scope.
Mostra attributi secondari
data.latency.delivery.p50_ms
nullable integer
obbligatorio
Median (50th percentile) latency in milliseconds. Null when no qualifying event contributed a measurement.
data.latency.delivery.p95_ms
nullable integer
obbligatorio
95th percentile latency in milliseconds. Null when no qualifying event contributed a measurement.
data.latency.delivery.p99_ms
nullable integer
obbligatorio
99th percentile latency in milliseconds. Null when no qualifying event contributed a measurement.
data.latency.total
object
p50, p95, and p99 latency percentiles in milliseconds for one latency family over the scope. Percentiles are approximate (computed from a high-volume aggregation pipeline). All three are null together when no qualifying event contributed a latency measurement in scope.
Mostra attributi secondari
data.latency.total.p50_ms
nullable integer
obbligatorio
Median (50th percentile) latency in milliseconds. Null when no qualifying event contributed a measurement.
data.latency.total.p95_ms
nullable integer
obbligatorio
95th percentile latency in milliseconds. Null when no qualifying event contributed a measurement.
data.latency.total.p99_ms
nullable integer
obbligatorio
99th percentile latency in milliseconds. Null when no qualifying event contributed a measurement.
data.trend
array of object
Per-bucket lifecycle-count series for this country over the window, bucketed by trend_grain. Sparse -- only buckets with activity are present, not zero-filled, unlike the daily/hourly series. Present only when include_trend=true.
Mostra attributi secondari
data.trend.bucket
string
obbligatorio
The day (YYYY-MM-DD) or hour (RFC 3339, on the hour) this point covers, matching the period's grain.
data.trend.delivery
object
obbligatorio
Mostra attributi secondari
data.trend.delivery.accepted
integer
obbligatorio
Distinct messages accepted for sending after admission checks.
data.trend.delivery.sent
integer
obbligatorio
Distinct messages handed off to the carrier for delivery.
data.trend.delivery.delivered
integer
obbligatorio
Distinct messages the carrier confirmed as delivered to the handset.
data.trend.delivery.undelivered
integer
obbligatorio
Distinct messages the carrier reported as not delivered.
data.trend.delivery.failed
integer
obbligatorio
Distinct messages that failed during sending.
data.trend.delivery.rejected
integer
obbligatorio
Distinct messages rejected before any send attempt, for example by sending policy or a message-generation failure.
data.trend.delivery.expired
integer
obbligatorio
Distinct messages that could not be delivered within their validity window and expired.
total
integer
obbligatorio
Total number of distinct destination countries with activity in the period, regardless of limit. When it exceeds the number of rows returned, the ranking was capped; raise limit (up to 200) or narrow the window to see more.