OpenRCS API reference · v1 ← Back to console Swagger UI
Delivery data

Per-day counters

GET /stats x-api-key

Returns per-day stats. When `event` is omitted, the response returns aggregate totals under `events.all` instead of splitting by event name. `event` accepts a single name or a comma-separated list (e.g. `event=SENT,FAILED,DELIVERED`), returning one counter series per requested name in a single call. Supported `event` values are `SENT`, `FAILED`, `DELIVERED`, `READ`, `UNSUBSCRIBE`, `SUGGESTION_RESPONSE`, and `USER_MESSAGE`. Counters are retained for 1 year (365 days) and then automatically deleted (each row expires at its `expires_at` timestamp).

Parameters

NameInTypeRequiredDescription
from query string yes Inclusive start date (UTC, YYYY-MM-DD).
to query string yes Inclusive end date (UTC, YYYY-MM-DD). The range must not exceed 31 days.
event query string no Optionally select one or more event names, either a single value or a comma-separated list (e.g. `SENT,FAILED,DELIVERED`): `SENT`, `FAILED`, `DELIVERED`, `READ`, `UNSUBSCRIBE`, `SUGGESTION_RESPONSE`, or `USER_MESSAGE`. Each requested name gets its own counter series in the response. Values are trimmed; duplicates are ignored. At most 20 distinct names per request (400 otherwise).
tracking query string no Optionally scope counters to a client tracking id.

Responses

StatusDescription
200 Zero-filled per-day counters.
400 Missing or invalid dates, a range over 31 days, an unsafe event name, or a `user_id` query parameter (not accepted — counters are always scoped to the caller).
401 Missing or invalid API key.
500 Unexpected runtime failure.

200 example

{
  "from": "2026-05-01",
  "to": "2026-05-03",
  "tracking": "campaign-123",
  "events": {
    "SENT": {
      "total": 42,
      "by_date": [
        {
          "date": "2026-05-01",
          "count": 10
        },
        {
          "date": "2026-05-02",
          "count": 0
        },
        {
          "date": "2026-05-03",
          "count": 32
        }
      ]
    },
    "FAILED": {
      "total": 2,
      "by_date": [
        {
          "date": "2026-05-01",
          "count": 1
        },
        {
          "date": "2026-05-02",
          "count": 0
        },
        {
          "date": "2026-05-03",
          "count": 1
        }
      ]
    }
  }
}