> ## Documentation Index
> Fetch the complete documentation index at: https://docs.drin.run/llms.txt
> Use this file to discover all available pages before exploring further.

# Retrieve metrics

> GET /v1/metrics — event totals and a daily series for a project over a date range.

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](/webhooks). Test-mode sends are excluded.

## Query parameters

<ParamField query="from" type="string">
  Inclusive start of the range, ISO-8601 (e.g. `2026-05-01` or a full date-time). Defaults to 30 days before `to`.
</ParamField>

<ParamField query="to" type="string">
  End of the range, ISO-8601. Defaults to now.
</ParamField>

## Request

<CodeGroup>
  ```bash cURL theme={null}
  curl "https://api.drin.run/v1/metrics?from=2026-05-01&to=2026-05-31" \
    -H "Authorization: Bearer $DRIN_API_KEY"
  ```

  ```typescript Node.js theme={null}
  import { DrinClient } from "@drin00/sdk";

  const drin = new DrinClient({ apiKey: process.env.DRIN_API_KEY });

  const m = await drin.metrics.get({
    from: "2026-05-01",
    to: "2026-05-31",
  });

  const sent = m.totals.delivery ?? 0;
  const bounced = m.totals.bounce ?? 0;
  const bounceRate = sent ? bounced / sent : 0;
  ```
</CodeGroup>

## Response

<ResponseField name="range" type="object">
  The resolved `{ from, to }` bounds as ISO timestamps — echoes the defaults applied when you omit a param.
</ResponseField>

<ResponseField name="totals" type="object">
  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`.
</ResponseField>

<ResponseField name="daily" type="array">
  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.
</ResponseField>

```json 200 OK theme={null}
{
  "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 } }
  ]
}
```

## 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](/deliverability).

<Warning>
  **Invalid range.** A non-parseable `from` or `to`, or a `from` later than `to`, returns `422 validation_error`.
</Warning>
