billing

Usage the ledger recorded and Stripe never heard about

Every priced usage_events row with stripe_synced_at IS NULL, across the estate: how many, how much, how old, whose, and how much of it has stopped retrying. This is the read that did not exist on 2026-09-18, when twelve staging events ($181.70) were retried into a dead-letter queue with no consumer and nothing anywhere said so. One D1 read; no vendor is called and no query, report or customer name appears in it.

get/v1/admin/billing/unsynced

Request

  • Base URL: https://api.hyperresearch.ai
  • URL: https://api.hyperresearch.ai/v1/admin/billing/unsynced
  • Auth: API key in cookie hr_session

Response

What has not reached Stripe

availableboolean required

False when migration 0040 has not been applied to this deployment yet. Every figure below is then zero and means nothing — "we could not look", never "there is nothing".

as_ofstring required
eventsinteger required
amount_centsinteger required
oldest_tsstring nullable required
exhaustedinteger required

Rows the re-drive sweep has given up on. Each has a billing_failures row with code redrive_exhausted; a re-drive resets them.

alert_threshold_centsinteger required
alertingboolean required
complimentary_eventsinteger required

Comped rows (0041) still awaiting their local settlement, kept OUT of events/amount_cents and out of the alert: nobody is owed that money. Non-zero here for more than a minute means the settlement path is broken, which is worth looking at.

complimentary_centsinteger required
needs_reconcile_eventsinteger required

Rows whose money cannot be decided in code and are waiting on you (0042): either Stripe refused the reused Idempotency-Key, or the row was handed to Stripe longer ago than its identifier is de-duplicated for. Counted INSIDE events/amount_cents — "we do not know whether Stripe took this" is unsynced money — and split out here because it is the part that will not clear on its own. Resolve with POST /v1/admin/billing/redrive carrying a reconcile verdict.

needs_reconcile_centsinteger required

Example response

{
  "needs_reconcile": [
    {
      "reason": "idempotency_error"
    }
  ]
}

Changes

No recorded changes to this operation across all 1 revision of this API.