Docs
API · metrics

Retrieve metrics

Aggregate email event counts for a project — totals across a range plus a per-day breakdown. The raw material for delivery, bounce, complaint, open, and click rates.

GET/v1/metrics

Metrics are scoped to the project resolved from your key (or the X-Drin-Product header for account-wide keys). Counts come from the same event stream you can subscribe to over webhooks. Test-mode sends are excluded.

01 Query parameters

fromstringOptional
Inclusive start of the range, ISO-8601 (e.g. 2026-05-01 or a full date-time). Defaults to 30 days before to.
tostringOptional
End of the range, ISO-8601. Defaults to now.

02 Request

curl "https://api.drin.run/v1/metrics?from=2026-05-01&to=2026-05-31" \
  -H "Authorization: Bearer $DRIN_API_KEY"

03 Response

rangeobjectOptional
The resolved { from, to } bounds as ISO timestamps — echoes the defaults applied when you omit a param.
totalsobjectOptional
Event counts over the whole range, keyed by event type (delivery, bounce, complaint, open, click, …). A type with zero events may be absent rather than 0.
dailyarrayOptional
One entry per day with events, each { date, counts } where date is YYYY-MM-DD (UTC) and counts is the same per-type map for that day.
200 OK
{
  "range": {
    "from": "2026-05-01T00:00:00.000Z",
    "to": "2026-05-31T00:00:00.000Z"
  },
  "totals": {
    "delivery": 14820,
    "bounce": 38,
    "complaint": 2,
    "open": 9104,
    "click": 2317
  },
  "daily": [
    { "date": "2026-05-18", "counts": { "delivery": 612, "open": 401 } },
    { "date": "2026-05-19", "counts": { "delivery": 588, "bounce": 3 } }
  ]
}

04 Computing rates

Rates are derived client-side from totals. Bounce rate is bounce / delivery; complaint rate is complaint / delivery. Keep bounce under 4% and complaints under 0.1% to stay in good standing — see Deliverability.

Invalid rangeA non-parseable from or to, or a from later than to, returns 422 validation_error.