<Intro>

<EndpointHeader />

<Description>

Returns the total number of messages your numbers received over the period.

The total counts by the time the carrier received each message.

The response carries a count and nothing else. A received message has one state, so there are no delivery rates to derive and no latency to report; the send statistics endpoints cover those for messages you send.

The maximum window is 365 days; a longer range returns 422. Set `timezone` to resolve the period against your local calendar instead of UTC.

</Description>

</Intro>

<Parameters in="query">

<Parameter name="from" type="string">

<Description>

Inclusive start of the window, either a calendar day (YYYY-MM-DD) or an RFC 3339 instant rounded down to the hour. The form you use selects the grain the total is resolved at. Interpreted in `timezone`, or in UTC when `timezone` is omitted. Must use the same form as `to`. A numeric UTC offset (for example `+05:45`) is rejected when `timezone` is set; pass a calendar day or a `Z` instant instead. Defaults to 30 days before `to` for day windows, or 168 hours before `to` for hour windows.

</Description>

</Parameter>

<Parameter name="to" type="string">

<Description>

Inclusive end of the window, in the same form as `from`. Defaults to today, or the current hour for an hour window. A day window may not exceed 365 days and an hour window 720 hours.

</Description>

</Parameter>

<Parameter name="timezone" type="string">

<Description>

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.

</Description>

</Parameter>

<Parameter name="compare" type="string">

<Description>

Set to `previous_period` to also include the received-message count for the immediately preceding window of equal length, plus the change between the two, so you can show "+X% vs last period" without a second request.

</Description>

<Description>

Possible values: `previous_period`

</Description>

</Parameter>

</Parameters>

<Payload kind="response">

<Field name="period" type="object" required>

<Description>

The window the server actually computed against. The summary serves two window grains: calendar days (bounds are YYYY-MM-DD) and hours (bounds are RFC 3339 instants on the hour). The grain of `from` and `to` mirrors the grain of the request's bounds.

</Description>

<FieldChildren kind="response">

<Field name="from" type="string" prefix="period." required>

<Description>

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.

</Description>

</Field>

<Field name="to" type="string" prefix="period." required>

<Description>

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.

</Description>

</Field>

<Field name="data_as_of" type="nullable string" prefix="period.">

<Description>

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.

</Description>

</Field>

</FieldChildren>

</Field>

<Field name="received" type="integer" required>

<Description>

Distinct messages received in the period, counted by the time the carrier received them.

</Description>

</Field>

<Field name="comparison" type="object">

<FieldChildren kind="response">

<Field name="period" type="object" prefix="comparison." required>

<Description>

The preceding window these comparison figures cover -- the equal-length window ending immediately before the requested start (the prior day for day windows, the prior hour for hour windows).

</Description>

<FieldChildren kind="response">

<Field name="from" type="string" prefix="comparison.period." required>

<Description>

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.

</Description>

</Field>

<Field name="to" type="string" prefix="comparison.period." required>

<Description>

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.

</Description>

</Field>

<Field name="data_as_of" type="nullable string" prefix="comparison.period.">

<Description>

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.

</Description>

</Field>

</FieldChildren>

</Field>

<Field name="received" type="integer" prefix="comparison." required>

<Description>

Distinct messages received in the preceding period.

</Description>

</Field>

<Field name="delta" type="object" prefix="comparison." required>

<FieldChildren kind="response">

<Field name="received_pct_change" type="nullable number" prefix="comparison.delta." required>

<Description>

Relative change in received messages versus the previous period, as a signed fraction. Null when the previous period received none.

</Description>

</Field>

</FieldChildren>

</Field>

</FieldChildren>

</Field>

</Payload>