Skip to Content
Pouch
Stats

Read stats

GET
/v1/stats

Auth: Bearer key.

Authorization

bearer
headerAuthorizationBearer <token>

An API key in the Authorization header.

Query Parameters

window?string

A window ending now: 24h, 7d, 30d or 90d. Defaults to 30d. Leave out with since and until.

Value in"24h""7d""30d""90d"
since?unknown

Start of a window, ISO 8601, in place of window. Inclusive.

until?unknown

End of a window, ISO 8601. Exclusive. Defaults to now.

bucket?string

UTC hours or UTC days. Defaults to hour for a window of a day or less, day otherwise.

Value in"hour""day"
mode?string

Which mail to count: live (the default for a live key), test or all. A test key counts test mail only.

Value in"live""test""all"
domain?string

Only this domain id.

key?string

Only messages sent with this key id.

status?string

Only messages with one of these statuses, comma-separated: queued, sent, delivered, deferred, bounced, complained, failed.

include?string

Comma-separated expansions to add: previous_buckets (the previous window's buckets, aligned with buckets by index); latency (p50, p95 and p99 of time in the queue, at the provider and end to end); domains (counts, queue p95, last send and bucket totals per domain); keys (counts and bucket totals per key); reasons (the receiving servers' words for bounces and complaints, most common first); queue (what's queued right now: due, backing off, held, in progress and silent, with the oldest of each); inbound (mail received, in total and per bucket. Not for test keys); domain_days (each domain's daily rollup: delivery-time quantiles over the 7 days before and sends by UTC hour over the 28 days before).

fields?string

Comma-separated top-level keys to return in place of the defaults. window always comes back. Valid: window, mode, counts, previous_counts, attempts, buckets, previous_buckets, latency, domains, keys, reasons, queue, inbound, domain_days.

Response Body

Messages accepted in the window, against the window before it, in UTC buckets. A domain-scoped key counts its domains.

application/json
  1. response
window?

What was counted: messages accepted from since until until, against previous_since until previous_until. bucket is hour or day, in UTC; the first bucket starts at the hour or day since falls in.

mode?string

Which mail was counted.

Value in"live""test""all"
counts?

Messages accepted in the window, by the status they have now. abandoned is the part of sent the provider never reported on. With status, only those statuses count.

previous_counts?

The same for the window before.

attempts?

Attempts per message that reached the provider, this window and the one before. Null with none.

buckets?array<>

The counts per bucket, oldest first, empty buckets included.

previous_buckets?array<>

With include=previous_buckets. The window before, aligned with buckets by index.

latency?

With include=latency. Accepted to handed over, handed over to delivered and accepted to delivered, in milliseconds. Read from hourly histograms, so within 2.2% of the exact value. Null quantiles with no samples.

domains?array<>

With include=domains. Every domain with mail in this window or the one before, busiest first. buckets holds totals aligned with buckets.

keys?array<>

With include=keys. Every key that sent in the window, busiest first; key_id is null for mail sent without one.

reasons?array<>

With include=reasons. The receiving servers' words for bounces and complaints on this window's messages, verbatim, most common first, at most 20.

queue?

With include=queue. The queue right now, whatever the window. held is what GET /v1/emails?held=true lists. silent was handed over between an hour and a day ago with no word back.

inbound?

With include=inbound. Mail received in the window, with totals aligned with buckets. A test key gets key_not_scoped.

domain_days?array<>

With include=domain_days. One row per domain per UTC day in the window: delivery_ms holds min, p10, p25, p50, p75, p90, p99 and max of sent to delivered over the 7 days before computed_at; hourly_volume holds sends by UTC hour of day over the 28 days before. Live mail only.

Example Request
curl -X GET 'https://pouch.example.com/v1/stats'
Example Response
{  "window": {    "since": "string",    "until": "string",    "previous_since": "string",    "previous_until": "string",    "bucket": "hour"  },  "mode": "live",  "counts": {    "total": 0,    "queued": 0,    "sent": 0,    "deferred": 0,    "delivered": 0,    "bounced": 0,    "complained": 0,    "failed": 0,    "abandoned": 0  },  "previous_counts": {    "total": 0,    "queued": 0,    "sent": 0,    "deferred": 0,    "delivered": 0,    "bounced": 0,    "complained": 0,    "failed": 0,    "abandoned": 0  },  "attempts": {    "per_send": 0,    "previous_per_send": 0  },  "buckets": [    {      "start": "string",      "total": 0,      "queued": 0,      "sent": 0,      "deferred": 0,      "delivered": 0,      "bounced": 0,      "complained": 0,      "failed": 0,      "abandoned": 0    }  ],  "previous_buckets": [    {      "start": "string",      "total": 0,      "queued": 0,      "sent": 0,      "deferred": 0,      "delivered": 0,      "bounced": 0,      "complained": 0,      "failed": 0,      "abandoned": 0    }  ],  "latency": {    "queue": {      "p50_ms": 0,      "p95_ms": 0,      "p99_ms": 0,      "count": 0    },    "provider": {      "p50_ms": 0,      "p95_ms": 0,      "p99_ms": 0,      "count": 0    },    "end_to_end": {      "p50_ms": 0,      "p95_ms": 0,      "p99_ms": 0,      "count": 0    }  },  "domains": [    {      "domain_id": "string",      "name": "string",      "counts": {        "total": 0,        "queued": 0,        "sent": 0,        "deferred": 0,        "delivered": 0,        "bounced": 0,        "complained": 0,        "failed": 0,        "abandoned": 0      },      "previous_total": 0,      "queue_p95_ms": 0,      "last_sent_at": "string",      "buckets": [        {          "start": "string",          "total": 0        }      ]    }  ],  "keys": [    {      "key_id": "string",      "total": 0,      "buckets": [        {          "start": "string",          "total": 0        }      ]    }  ],  "reasons": [    {      "reason": "string",      "count": 0    }  ],  "queue": {    "queued": 0,    "due": 0,    "backing_off": 0,    "held": 0,    "in_progress": 0,    "silent": 0,    "oldest_queued_at": "string",    "oldest_due_at": "string",    "oldest_held_at": "string",    "held_by_domain": [      {        "domain_id": "string",        "count": 0,        "oldest_queued_at": "string"      }    ],    "organization_held": true,    "organization_fails": true  },  "inbound": {    "total": 0,    "buckets": [      {        "start": "string",        "total": 0      }    ]  },  "domain_days": [    {      "domain_id": "string",      "day": "string",      "computed_at": "string",      "delivered_count": 0,      "delivery_ms": {},      "hourly_volume": [        0      ]    }  ]}