Skip to content
SarvexDocs
Esc
↑↓navigate↵open⌘Jpreview

Monthly rollup, one entry per currency

Causes sorted by lost_revenue_minor descending within each currency (R14 — money order is the point of this feature), plus totals, unknown-revenue count, and the delta against the prior month’s total. Served entirely from the precomputed rollup (R12) — never aggregated from raw entries at read time. Gated at the analytics tier (Concierge/Scale) — the worker writes for every tier regardless, so an upgrading merchant’s backlog is already there.

currency is optional. Given, the response is a one-element list scoped to that currency. Omitted, the response holds one element per currency the merchant actually has a rollup for that month — read directly from the ledger’s own data, not derived from store configuration, so the caller never has to enumerate stores/ currencies itself and call this endpoint once per currency. Currencies are never summed together either way (R9): each element is independently computed, exactly as the single-currency form already returns it.

GET/ledger/summary
Authorization
AuthorizationBearer token (JWT) · headerrequired

JWT issued by the external IdP via the OAuth 2.0 authorization-code flow (Kinde in production; a simulator in test). The client obtains it and sends it as a Bearer token on every authenticated call. Sarvex's services verify it — issuer, audience, signature (IdP JWKS), expiry — and read identity and tenant from its claims. Sarvex does not issue or revoke these tokens. merchant_id/store_id are read from the verified claims (and the merchant→store mapping), never from the URL. The operator scope is required for /operator/*. Operators acting on a specific merchant pass the X-Operate-As header, which is recorded in the audit log.

Query parameters
monthstring

yyyy-MM. Defaults to the current UTC month.

currencystring

Restrict to one currency's rollup. Omit to get every currency the merchant has data for that month (R9 — never summed across currencies).

Responses
200

One rollup per currency (or the single requested currency).

dataledger_summary[]required

One element per currency (or the single requested currency) — never summed across currencies (R9).

Show properties
Array of ledger_summary
monthstring
currencystring
causesledger_cause_breakdown[]

Sorted by lost_revenue_minor descending (R14).

Show properties
Array of ledger_cause_breakdown
causeledger_cause

Closed classification — see internal/planes/control/ledger.Cause.

Allowed:payment_handlerprofile_mismatchsync_freshnessescalation_dropoffplatform_errortimeoutbuyer_abandonedunclassified
countinteger
lost_revenue_minorinteger

Amount in minor units (cents).

total_countinteger
total_lost_revenue_minorinteger
entries_with_unknown_revenueinteger
prior_month_delta_minorinteger

total_lost_revenue_minor minus the prior month's total for the same currency (0 if neither month has data).

403

Authenticated but not permitted (e.g. non-operator on an operator route).

errorobjectrequired
Show properties
codestringrequired
messagestringrequired
detailsobject | null
422

Request body failed validation.

errorobjectrequired
Show properties
codestringrequired
messagestringrequired
detailsobject | null
Try it
Server
Authorization
Parameters
Request
curl -X GET "https://api.sarvex.example.com/v1/ledger/summary" \
  -H "Authorization: Bearer YOUR_TOKEN"
Response
{
  "data": [
    {
      "month": "2026-08",
      "currency": "USD",
      "causes": [
        {
          "cause": "payment_handler",
          "count": 0,
          "lost_revenue_minor": 0
        }
      ],
      "total_count": 0,
      "total_lost_revenue_minor": 0,
      "entries_with_unknown_revenue": 0,
      "prior_month_delta_minor": 0
    }
  ]
}