GET and cost zero credits. Authentication is the same as every other scanner call (Authorization: Bearer <psk_*> or <JWT>).
The TypeScript SDK exposes each one as a typed method — see the SDK reference.
GET /v1/scanner/credits/balance
Authoritative current balance plus lifetime totals.
| Field | Notes |
|---|---|
balance | Current spendable credits. |
grantedTotal | Lifetime sum of grant-reason rows in the ledger. |
consumedTotal | Lifetime sum of consume rows minus refund rows (net of auto-refunds on 4xx/5xx). |
X-Credits-Remaining header, and the SDK tracks it automatically.
GET /v1/scanner/credits/activity
Day-bucketed billable scan counts sourced directly from the credit ledger. Use this for usage charts and billing reconciliation — it never undercounts because the ledger is written synchronously inside the credits middleware.
| Param | Type | Notes |
|---|---|---|
from | string | ISO-8601 timestamp. Optional — defaults to start of all-time. |
to | string | ISO-8601 timestamp. Optional — defaults to now. |
day row reports net activity: a refunded validation error is subtracted from scans and credits so the count matches what the partner actually paid for.
GET /v1/scanner/credits/ledger
Per-row ledger of every grant, consume, refund, and adjustment. Paginated, with optional scan-result join.
| Param | Type | Notes |
|---|---|---|
from | string | ISO-8601 timestamp. Optional. |
to | string | ISO-8601 timestamp. Optional. |
limit | integer | 1–500. Default 100. |
page | integer | 1-based. Default 1. (Legacy ?offset=N also accepted.) |
expand | string | Comma-separated list. Currently only scan is supported — joins consume rows to their merchant_scans row via request_id. |
| Field | Notes |
|---|---|
delta | Signed integer. Negative for consume, positive for grant/refund. |
reason | grant | consume | refund | adjustment. |
source | For consumes: "request:<uuid>". For grants: invoice id, pack id, or free-form. For refunds: "refund:<uuid>" referencing the original consume’s request_id. |
metadata.endpoint | Which API call caused the consume (e.g. POST /v1/scanner/scan). |
metadata.key_id | Which scanner key was used. |
metadata.status_code (refunds) | The HTTP status that triggered the refund. |
metadata.reason (refunds) | "client_error" (4xx) or "server_error" (5xx). |
scan (with expand=scan) | Joined merchant_scans summary. Present only on consume rows whose request_id matches a scan. |
Audit-trail use case
expand=scan answers “what did I get for this charge?” without a second call. Pre-fix consumes (before the request_id join shipped on 2026-05-02) won’t have the scan field — the row will just show source as before.
GET /v1/scanner/usage
Aggregated request counts and credit consumption, grouped by endpoint or day. Aggregation runs server-side (no row caps).
| Param | Type | Notes |
|---|---|---|
group_by | string | endpoint (default) or day. |
from | string | ISO-8601. Optional. |
to | string | ISO-8601. Optional. |
/credits/activity — it sources from the ledger and is never affected by best-effort telemetry. /usage is the right call when you also want read traffic + per-endpoint latency breakdowns.