Balance operations
Balance operations
Inspect wallet mutation records against operator adapter.
Path
GET /api/operator/balance-operations
Required scope: balance_operations:read
Query params
All query parameters are optional.
| Parameter | Type | Requirement | Values/default |
|---|---|---|---|
status | string | Optional | One of the operation statuses below. |
direction | string | Optional | One of the direction values below. |
type | string | Optional | trade, resolution, polyflight_purchase, or polyflight_ticket. |
product | string | Optional | opinion (default), polyflight, or explicitly labelled all. Polyflight/all additionally require polyflight:read unless scope is *. |
market | string | Optional | Convenience filter: positive numeric market ID or exact market slug. |
market_id | positive integer | Optional | Exact market ID; takes precedence over numeric market. |
market_slug | string | Optional | Exact market slug; takes precedence over a slug in market. |
external_user_id | string | Optional | Exact operator-side user ID. |
order_id | positive integer | Optional | Exact Mini App order ID. |
redemption_item_id | positive integer | Optional | Exact Mini App redemption item ID. |
created_from | datetime | Optional | Inclusive creation-time lower bound. |
created_to | datetime | Optional | Inclusive creation-time upper bound. |
sort | string | Optional | created_at_desc (default), updated_at_desc, or next_retry_at_asc. |
page | positive integer | Optional | Default 1. |
page_size | positive integer | Optional | Default 50, maximum 100. |
Direction values:
debitcreditdebit_reversalcredit_reversal
Status values:
plannedsentsucceededfailedunknownretryingmanual_review
Filtered summary
Every response includes a summary computed across all rows matching the same authenticated-operator and query-filter predicates as items and pagination.total. Summary values are not limited to the current page and are not implicitly restricted to succeeded; use status when a status-specific report is required.
| Field | JSON type | Definition |
|---|---|---|
credit_external_amount_minor_total | integer or integer string | Sum of non-negative operation amounts for credit and debit_reversal. |
debit_external_amount_minor_total | integer or integer string | Sum of non-negative operation amounts for debit and credit_reversal. |
volume_external_amount_minor_total | integer or integer string | Credits total plus debits total. |
currency_code | string | Authenticated operator's configured currency code. |
The response also returns product_scope and includes_multiple_products. Summary amounts follow the explicit product filter; the default remains Opinion-only so Polyflight money is never silently mixed into existing Opinion views.
For product=opinion, the three summary totals are JSON numbers. For product=polyflight or product=all, they are exact decimal integer strings. Preserve the returned type and do not parse integer strings through floating-point arithmetic.
created_from and created_to remain inclusive for the summary, count, and rows. Dashboard date-only filters expand to 00:00:00.000Z and 23:59:59.999Z UTC before calling this endpoint.
Response highlights
The envelope is { product_scope, includes_multiple_products, summary, items, pagination }. Pagination contains page, page_size, total, and total_pages (at least 1).
external_amount_minorcurrency_codeidempotency_keyremote_referencerequest_jsonresponse_jsonbalance_after_minorproductoperation_typepolyflight_purchase_request_idandpolyflight_ticket_id, when applicableoriginal_operation_id, when applicablefailure_reasonattempt_countnext_retry_at- nested
operator_user - nested
market, nullable for Polyflight
balance_after_minor is nullable and is extracted from wallet response balanceMinor or balance_minor when present.
operation_type is derived from source links: order_id means trade; redemption_item_id means resolution; Polyflight purchase/ticket links mean polyflight_purchase / polyflight_ticket; an unlinked historical/internal row returns unknown.
Each item also includes numeric id, nullable order_id / redemption_item_id, direction, status, created_at, and updated_at. operator_user contains id, external_user_id, and nullable display_name; a non-null market contains id, slug, and title. Optional source links, remote reference, payloads, failure reason, balance-after, and retry timestamp may be null. The legacy generic list returns external_amount_minor as a JSON number; it is not the integer-string contract of the dedicated Polyflight operations endpoint.
Amounts are nonnegative operation magnitudes, not signed cash flow. A debit or credit reversal reduces the user's balance; a credit or debit reversal increases it. Only succeeded confirms an applied operation. With no status filter, summary totals include planned, failed, and unknown work and must not be described as cash received/paid. Distinct successful operation IDs are distinct wallet movements, even when their source order is the same.
For resolved-market warnings and redacted evidence, use Cash-flow triage, which additionally requires trades:read and redemptions:read. Neither this list nor triage permits operator-side financial confirmation or replay. Preserve the original operation and idempotency key when reconciling an unknown result; do not create a new-key payment.
Invalid enums return INVALID_STATUS, INVALID_DIRECTION, INVALID_TYPE, INVALID_PRODUCT, or INVALID_SORT. Invalid ID/date filters return the corresponding INVALID_* code. A market ID and market slug supplied together are combined, not alternatives.
