{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/immix/json-schema/immix-account-balances-list-account-balances-response-schema.json",
  "title": "ListAccountBalancesResponse",
  "x-generated": "2026-11-10",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/immix-account-balances-api-openapi.yml#/components/schemas/accountBalances_ListAccountBalancesResponse",
  "type": "object",
  "properties": {
    "nextCursor": {
      "type": [
        "string",
        "null"
      ],
      "description": "Pass as `cursor` for the next page. Null on the last page."
    },
    "prevCursor": {
      "type": [
        "string",
        "null"
      ],
      "description": "Pass as `cursor` for the previous page. Null on the first page."
    },
    "total": {
      "type": [
        "integer",
        "null"
      ],
      "description": "Exact count matching the filter. Null unless `include=total`."
    },
    "globalSequence": {
      "$ref": "#/$defs/GlobalSequenceValue"
    },
    "asOfSeqTsNs": {
      "type": [
        "string",
        "null"
      ],
      "pattern": "^[0-9]+$",
      "description": "The sequencer timestamp (epoch-ns) the data is complete through; also sent as X-Immix-As-Of-Seq-Ts. Null when unknown."
    },
    "items": {
      "type": "array",
      "items": {
        "$ref": "#/$defs/AccountBalanceRow"
      }
    },
    "unscaled": {
      "type": "boolean",
      "description": "Never present since 0.3.1: a balance states its own scale, so no item is ever served raw. Kept, deprecated, so a client generated from 0.3.0 still compiles.",
      "deprecated": true
    }
  },
  "required": [
    "nextCursor",
    "prevCursor",
    "total",
    "globalSequence",
    "asOfSeqTsNs",
    "items"
  ],
  "$defs": {
    "AccountBalanceRow": {
      "type": "object",
      "properties": {
        "accountId": {
          "type": "integer",
          "description": "The account this reading belongs to."
        },
        "assetId": {
          "type": "integer",
          "description": "The asset the amounts are stated in."
        },
        "credentialId": {
          "type": "integer",
          "description": "The credential the reading was taken through — the account's own."
        },
        "total": {
          "type": "string",
          "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
          "maxLength": 64,
          "description": "The venue's stated total holding in this asset. money (a Decimal on the wire: a scaled integer with its own scale), served as an exact decimal string at the value's own scale — every fractional digit that scale states, trailing zeros included; never raw"
        },
        "available": {
          "type": "string",
          "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
          "maxLength": 64,
          "description": "What the venue would let move now — a withdrawal or transfer amount, never what is usable as margin: collateral eligibility and haircuts are the venue's own gates. money (a Decimal on the wire: a scaled integer with its own scale), served as an exact decimal string at the value's own scale — every fractional digit that scale states, trailing zeros included; never raw"
        },
        "held": {
          "type": "string",
          "pattern": "^-?[0-9]+(\\.[0-9]+)?$",
          "maxLength": 64,
          "description": "What the venue itself has locked — order margin, pending withdrawals, venue-side freezes. total is available plus held only where the venue's own model is additive. money (a Decimal on the wire: a scaled integer with its own scale), served as an exact decimal string at the value's own scale — every fractional digit that scale states, trailing zeros included; never raw"
        },
        "venueTsNs": {
          "type": [
            "string",
            "null"
          ],
          "pattern": "^-?[0-9]+$",
          "description": "The venue's own clock for this reading; 0 = the venue stated none, and the platform's time of the reading is the clock to read. int64 as a decimal JSON string"
        },
        "venueRevision": {
          "type": [
            "string",
            "null"
          ],
          "pattern": "^-?[0-9]+$",
          "description": "The venue's own sequence or revision number where it has one; 0 = none. A revision bump republishes the reading even when the amounts are unchanged. int64 as a decimal JSON string"
        },
        "observedAtNs": {
          "type": "string",
          "pattern": "^[0-9]+$",
          "description": "The platform time of this reading — epoch nanoseconds as a decimal string, never null. A changed reading and a restatement on the connector's heartbeat both move it, so a row whose `observedAtNs` stops advancing is an account the venue has stopped reporting. Judge freshness from it, not from `venueTsNs`, the venue's own clock."
        },
        "unscaled": {
          "type": "boolean",
          "description": "Never present since 0.3.1: each amount carries its own scale on the wire, so this row's amounts are exact decimals whether or not this member holds the asset — nothing about it needs distrusting. Kept, deprecated, so a client generated from 0.3.0 still compiles.",
          "deprecated": true
        }
      },
      "required": [
        "accountId",
        "assetId",
        "credentialId",
        "total",
        "available",
        "held",
        "observedAtNs"
      ],
      "description": "One account's latest balance in one asset as the API serves it: the `AccountBalance` reading plus `observedAtNs`, the platform time of the reading (the deprecated `unscaled` is never present: a balance states its own scale). `total`, `available` and `held` are the venue's partition of the holding: `available` is what the venue would let move now, `held` what it has locked, `total` the whole. Zero is a reading: every amount is a decimal, never null. Rows carry no version — a reading supersedes the last — so there is no `ETag` and no entity route.",
      "title": "AccountBalanceRow"
    },
    "GlobalSequenceValue": {
      "type": "string",
      "pattern": "^[0-9]+$",
      "description": "The position as a decimal string — the last change this member had applied, orders, balance readings and algo instances included.",
      "title": "GlobalSequenceValue"
    }
  }
}