@0xmonaco/types 1.0.73 → 1.0.74-develop.367860f

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (60) hide show
  1. package/dist/api/index.d.ts +0 -7
  2. package/dist/applications/index.d.ts +14 -15
  3. package/dist/applications/index.js +2 -2
  4. package/dist/applications/requests.d.ts +70 -15
  5. package/dist/applications/requests.js +2 -3
  6. package/dist/applications/responses.d.ts +35 -39
  7. package/dist/applications/responses.js +1 -1
  8. package/dist/buildercodes/index.d.ts +3 -4
  9. package/dist/buildercodes/responses.d.ts +12 -6
  10. package/dist/buildercodes/responses.js +26 -7
  11. package/dist/copy-trading/index.d.ts +7 -7
  12. package/dist/delegated-agents/index.d.ts +15 -5
  13. package/dist/fees/responses.js +2 -2
  14. package/dist/managed-markets/index.d.ts +21 -2
  15. package/dist/margin-accounts/index.d.ts +185 -21
  16. package/dist/market/index.d.ts +76 -6
  17. package/dist/pitpass/index.d.ts +31 -11
  18. package/dist/pitpass/index.js +1 -1
  19. package/dist/pitpass/responses.d.ts +67 -0
  20. package/dist/pitpass/responses.js +92 -8
  21. package/dist/portfolio/index.d.ts +36 -14
  22. package/dist/positions/index.d.ts +81 -14
  23. package/dist/profile/index.d.ts +114 -44
  24. package/dist/sdk/index.d.ts +12 -4
  25. package/dist/trading/index.d.ts +1 -1
  26. package/dist/trading/orders.d.ts +6 -32
  27. package/dist/trading/responses.d.ts +9 -14
  28. package/dist/validation/applications.d.ts +51 -0
  29. package/dist/validation/applications.js +45 -0
  30. package/dist/validation/index.d.ts +2 -0
  31. package/dist/validation/index.js +2 -0
  32. package/dist/validation/managed-markets.d.ts +17 -0
  33. package/dist/validation/managed-markets.js +17 -0
  34. package/dist/validation/margin-accounts.d.ts +44 -3
  35. package/dist/validation/margin-accounts.js +57 -6
  36. package/dist/validation/market.d.ts +45 -0
  37. package/dist/validation/market.js +43 -0
  38. package/dist/validation/positions.d.ts +5 -3
  39. package/dist/validation/positions.js +12 -5
  40. package/dist/validation/profile.d.ts +19 -2
  41. package/dist/validation/profile.js +36 -4
  42. package/dist/validation/trading.d.ts +2 -2
  43. package/dist/validation/vault.d.ts +14 -0
  44. package/dist/validation/vault.js +14 -0
  45. package/dist/websocket/base.d.ts +56 -6
  46. package/dist/websocket/client.d.ts +8 -3
  47. package/dist/websocket/events/index.d.ts +1 -0
  48. package/dist/websocket/events/index.js +1 -0
  49. package/dist/websocket/events/liquidation-events.d.ts +3 -3
  50. package/dist/websocket/events/market-stats-events.d.ts +33 -3
  51. package/dist/websocket/events/market-stats-events.js +3 -2
  52. package/dist/websocket/events/orders-events.d.ts +36 -3
  53. package/dist/websocket/events/position-events.d.ts +33 -15
  54. package/dist/websocket/events/position-valuation-events.d.ts +60 -0
  55. package/dist/websocket/events/position-valuation-events.js +15 -0
  56. package/dist/wire/operations.d.ts +1 -1
  57. package/dist/wire/operations.js +7 -0
  58. package/dist/wire/schema.d.ts +1595 -352
  59. package/dist/withdrawals/index.d.ts +27 -6
  60. package/package.json +2 -2
@@ -297,7 +297,9 @@ export interface paths {
297
297
  * address — and a per-order mode always overrides it. The write is sequenced
298
298
  * through the matching engine; on success the next order from the wallet
299
299
  * family already resolves the new mode. Delegated-agent sessions cannot
300
- * change it.
300
+ * change it. It spends the per-account settings-write rate limit (about one
301
+ * write per second, burst 10) that the copy trading lead trader and follow
302
+ * writes share.
301
303
  */
302
304
  put: operations["set_self_trade_prevention_default"];
303
305
  post?: never;
@@ -442,8 +444,8 @@ export interface paths {
442
444
  * List application balances
443
445
  * @description List application balances.
444
446
  *
445
- * Returns a paginated list of all user balances for this application.
446
- * Requires backend authentication via secret key.
447
+ * Returns a paginated list of the balances of the application's users.
448
+ * Public: the application is selected by `client_id`.
447
449
  */
448
450
  get: operations["list_application_balances"];
449
451
  put?: never;
@@ -488,9 +490,9 @@ export interface paths {
488
490
  * List application movements
489
491
  * @description List application movements.
490
492
  *
491
- * Returns a paginated list of all ledger movements (deposits, withdrawals,
492
- * trades, etc.) for this application. Requires backend authentication via
493
- * secret key.
493
+ * Returns a paginated list of the ledger movements (deposits, withdrawals,
494
+ * trades, etc.) of the application's users. Public: the application is
495
+ * selected by `client_id`.
494
496
  */
495
497
  get: operations["list_application_movements"];
496
498
  put?: never;
@@ -512,8 +514,8 @@ export interface paths {
512
514
  * List application orders
513
515
  * @description List application orders.
514
516
  *
515
- * Returns a paginated list of all orders for this application. Requires
516
- * backend authentication via secret key.
517
+ * Returns a paginated list of all orders placed by the application's users.
518
+ * Public: the application is selected by `client_id`.
517
519
  */
518
520
  get: operations["list_application_orders"];
519
521
  put?: never;
@@ -536,8 +538,8 @@ export interface paths {
536
538
  * @description Get application stats.
537
539
  *
538
540
  * Returns aggregate volume and fee stats for this application. Stats are
539
- * scoped to trades where the application's users were the taker. Requires
540
- * backend authentication via secret key.
541
+ * scoped to trades where the application's users were the taker. Public:
542
+ * the application is selected by `client_id`.
541
543
  */
542
544
  get: operations["get_application_stats"];
543
545
  put?: never;
@@ -559,8 +561,8 @@ export interface paths {
559
561
  * List application users
560
562
  * @description List application users.
561
563
  *
562
- * Returns a paginated list of all users for this application. Requires
563
- * backend authentication via secret key.
564
+ * Returns a paginated list of the application's users. Public: the
565
+ * application is selected by `client_id`.
564
566
  */
565
567
  get: operations["list_application_users"];
566
568
  put?: never;
@@ -730,11 +732,13 @@ export interface paths {
730
732
  * application's behalf do not count. Setting the fee it already has is a
731
733
  * no-op that succeeds and does not use up a change.
732
734
  *
733
- * The fee can be set while builder fees are switched off
734
- * (`builderFeeEnabled` false): it is stored and nothing is charged until they
735
- * are switched on. Once charged, a new fee applies to orders placed after the
736
- * change within a few seconds; resting orders keep the fee they were placed
737
- * with.
735
+ * The fee can be set while the revenue share or builder fees are switched
736
+ * on, and is refused (**HTTP 403** / **PERMISSION_DENIED**) while both are
737
+ * off. With builder fees off (`builderFeeEnabled` false) it is stored and
738
+ * nothing is charged until they are switched on. A newly stored fee reaches order requests within a few
739
+ * seconds. Sequencer ordering is authoritative for matching-engine policy and
740
+ * enrollment state: an order processed before one of those sequenced changes
741
+ * uses the earlier state, and a later order uses the new state.
738
742
  *
739
743
  * A refused change is **HTTP 409** / **FAILED_PRECONDITION** when the
740
744
  * application is not enrolled with a payout address or has no changes left
@@ -787,8 +791,7 @@ export interface paths {
787
791
  *
788
792
  * The application is taken from the authenticated session; there is no
789
793
  * application id in the request. The caller must be the application's
790
- * configured payout wallet. This method is gated by `buildercodes_enabled`
791
- * like the rest of the service.
794
+ * configured payout wallet.
792
795
  */
793
796
  get: operations["get_buildercodes_config"];
794
797
  put?: never;
@@ -909,13 +912,13 @@ export interface paths {
909
912
  *
910
913
  * Delegated-agent sessions are refused: a delegated grant conveys only
911
914
  * order-management authority, and this claim converts reserved balance into a
912
- * tradeable one. The refusal happens before the feature check, so a delegated
913
- * caller is refused whether or not BuilderCodes is enabled.
915
+ * tradeable one. No program switch gates the claim: a balance already
916
+ * credited stays claimable whether or not the revenue share is on.
914
917
  *
915
918
  * Transport contracts differ, and this comment is emitted into the generated
916
919
  * gRPC SDK where HTTP statuses do not exist. An insufficient payout balance
917
920
  * is **HTTP 409** on REST and **FAILED_PRECONDITION** on gRPC; a refused
918
- * caller (delegated session, or BuilderCodes disabled) is **HTTP 403** on
921
+ * caller (delegated session) is **HTTP 403** on
919
922
  * REST and **PERMISSION_DENIED** on gRPC.
920
923
  *
921
924
  * A claim can also fail as **HTTP 503** / **UNAVAILABLE** when the matching
@@ -940,6 +943,11 @@ export interface paths {
940
943
  * retry with backoff, and an overload positively wants one. Only an UNTAGGED
941
944
  * availability failure — matching-engine transport, timeout and fail-closed
942
945
  * paths — carries the unknown outcome.
946
+ *
947
+ * A claim spends the per-user movement budget withdrawals and collateral
948
+ * transfers share. Over budget it is refused with **HTTP 429** /
949
+ * **RESOURCE_EXHAUSTED** before it reaches the sequencer, so it committed
950
+ * nothing and is safe to retry after the interval in `details.retryAfter`.
943
951
  */
944
952
  post: operations["claim_buildercode_rewards"];
945
953
  delete?: never;
@@ -975,7 +983,9 @@ export interface paths {
975
983
  * `leader` handle that names a different leader is refused. `copyExisting`
976
984
  * copies the leader's open positions into the new copy account at creation
977
985
  * (see PreviewFollow for what that costs); it applies only to a create, and
978
- * an edit that sets it is refused.
986
+ * an edit that sets it is refused. A create and an edit each spend the
987
+ * per-account settings-write rate limit (about one write per second, burst
988
+ * 10) that UpsertLeadTrader and the self-trade-prevention default share.
979
989
  */
980
990
  post: operations["upsert_follow"];
981
991
  delete?: never;
@@ -1146,9 +1156,7 @@ export interface paths {
1146
1156
  * There is no margin reduction: a follow exits by being stopped. Follow
1147
1157
  * writes need a master account session (not a delegated agent or a
1148
1158
  * sub-account). 404 unless the follow is yours; 409 while it is stopping
1149
- * or once it is stopped, and when copy trading is not available on the
1150
- * platform at all (the platform then runs copy trading exits only). It
1151
- * spends the per-user movement budget withdrawals and collateral transfers
1159
+ * or once it is stopped. It spends the per-user movement budget withdrawals and collateral transfers
1152
1160
  * share. It is not idempotent: a retry after a timeout whose first attempt
1153
1161
  * landed adds the amount twice, so read the follow before retrying.
1154
1162
  */
@@ -1173,8 +1181,11 @@ export interface paths {
1173
1181
  * @description Stop a follow.
1174
1182
  *
1175
1183
  * Stops mirroring the leader. Stopping one of your own follows only; the
1176
- * follow is identified by its id. An exit is never gated beyond ownership,
1177
- * except that a delegated agent session cannot stop a follow.
1184
+ * follow is identified by its id. An exit is never refused for the state
1185
+ * of the account or the platform. Only three things apply: ownership, the
1186
+ * refusal of a delegated agent session, and a per-account rate limit of
1187
+ * its own (about one stop per second, burst 20), which closes and follow
1188
+ * edits never spend.
1178
1189
  */
1179
1190
  post: operations["stop_follow"];
1180
1191
  delete?: never;
@@ -1232,7 +1243,9 @@ export interface paths {
1232
1243
  * TraderCode handle. The profile is replaced as sent: an omitted `bio` or
1233
1244
  * `minAllocation` clears it and an omitted `status` means ACTIVE; an
1234
1245
  * omitted `shareBps` keeps the current share (the platform default on a
1235
- * registration). A follower with a live follow cannot register.
1246
+ * registration). A follower with a live follow cannot register. It spends
1247
+ * the per-account settings-write rate limit (about one write per second,
1248
+ * burst 10) that UpsertFollow and the self-trade-prevention default share.
1236
1249
  */
1237
1250
  put: operations["upsert_lead_trader"];
1238
1251
  post?: never;
@@ -1360,7 +1373,10 @@ export interface paths {
1360
1373
  *
1361
1374
  * Master accounts only. Creates (or updates, keyed on `agent_address`) a
1362
1375
  * delegation linking the calling owner to an agent wallet, together with the
1363
- * policy that constrains what the agent may do on the owner's behalf.
1376
+ * policy that constrains what the agent may do on the owner's behalf. An
1377
+ * owner holds at most 10 active, unexpired agents; a new one past that is
1378
+ * rejected until one is revoked or expires. Binding an agent to one margin
1379
+ * account (`allowed_margin_account_ids`) makes it that sub-account's key.
1364
1380
  */
1365
1381
  post: operations["upsert_delegated_agent"];
1366
1382
  delete?: never;
@@ -1412,7 +1428,8 @@ export interface paths {
1412
1428
  * `ListDelegatedAgentOwners`) and a freshly generated session public key.
1413
1429
  * The new session acts as the owner but records the agent's address for
1414
1430
  * policy enforcement. Requires an active delegation for the (owner, agent)
1415
- * pair. Session expiry is bounded by the delegation expiry, if set. Every
1431
+ * pair, and, when the delegation has an IP allowlist, a caller address
1432
+ * inside it. Session expiry is bounded by the delegation expiry. Every
1416
1433
  * authenticated request and periodic WebSocket session revalidation requires
1417
1434
  * the backing delegation to remain active and unexpired.
1418
1435
  */
@@ -1696,6 +1713,29 @@ export interface paths {
1696
1713
  patch?: never;
1697
1714
  trace?: never;
1698
1715
  };
1716
+ "/api/v1/margin/accounts/{marginAccountId}/pnl": {
1717
+ parameters: {
1718
+ query?: never;
1719
+ header?: never;
1720
+ path?: never;
1721
+ cookie?: never;
1722
+ };
1723
+ /**
1724
+ * @description One margin account's own PnL: realized (settled on the account plus
1725
+ * still held in its open risk buckets) and unrealized (its positions
1726
+ * repriced at the latest risk marks). Transfers between the caller's
1727
+ * accounts are flows, not PnL, so the figures of the caller's accounts sum
1728
+ * to the owner-wide figure.
1729
+ */
1730
+ get: operations["get_margin_account_pnl"];
1731
+ put?: never;
1732
+ post?: never;
1733
+ delete?: never;
1734
+ options?: never;
1735
+ head?: never;
1736
+ patch?: never;
1737
+ trace?: never;
1738
+ };
1699
1739
  "/api/v1/margin/accounts/{marginAccountId}/simulate-order-risk": {
1700
1740
  parameters: {
1701
1741
  query?: never;
@@ -1728,6 +1768,30 @@ export interface paths {
1728
1768
  patch?: never;
1729
1769
  trace?: never;
1730
1770
  };
1771
+ "/api/v1/margin/collateral/transfer": {
1772
+ parameters: {
1773
+ query?: never;
1774
+ header?: never;
1775
+ path?: never;
1776
+ cookie?: never;
1777
+ };
1778
+ get?: never;
1779
+ put?: never;
1780
+ /**
1781
+ * @description Move collateral between the spot wallet, the caller's margin accounts and
1782
+ * their risk buckets. `from` and `to` each name the wallet or a margin
1783
+ * account (optionally one of its risk buckets). Supported moves: wallet to
1784
+ * the default margin account and back, margin account to margin account,
1785
+ * and margin account to one of its own risk buckets. The older transfer
1786
+ * routes keep working unchanged.
1787
+ */
1788
+ post: operations["transfer_collateral"];
1789
+ delete?: never;
1790
+ options?: never;
1791
+ head?: never;
1792
+ patch?: never;
1793
+ trace?: never;
1794
+ };
1731
1795
  "/api/v1/margin/parent-margin-account": {
1732
1796
  parameters: {
1733
1797
  query?: never;
@@ -1849,6 +1913,101 @@ export interface paths {
1849
1913
  patch?: never;
1850
1914
  trace?: never;
1851
1915
  };
1916
+ "/api/v1/margin/sub-accounts": {
1917
+ parameters: {
1918
+ query?: never;
1919
+ header?: never;
1920
+ path?: never;
1921
+ cookie?: never;
1922
+ };
1923
+ get?: never;
1924
+ put?: never;
1925
+ /**
1926
+ * @description Open a sub-account: another margin account of the caller, keyed by
1927
+ * `subaccount_key`, with its own collateral and its own risk buckets. The
1928
+ * default margin account (key `default`) is the only one deposits and
1929
+ * withdrawals touch; fund a sub-account with `TransferCollateral`.
1930
+ * Re-creating the key of a closed sub-account re-opens the same account.
1931
+ * Keys starting with `copy:` are reserved. An owner may hold a limited
1932
+ * number of open sub-accounts, set by their weighted 14-day volume tier
1933
+ * (10 at the first tier, up to 50) or an admin override; a create past it
1934
+ * is refused. Copy-trading sub-accounts do not count.
1935
+ */
1936
+ post: operations["create_sub_account"];
1937
+ delete?: never;
1938
+ options?: never;
1939
+ head?: never;
1940
+ patch?: never;
1941
+ trace?: never;
1942
+ };
1943
+ "/api/v1/margin/sub-accounts/{marginAccountId}/close": {
1944
+ parameters: {
1945
+ query?: never;
1946
+ header?: never;
1947
+ path?: never;
1948
+ cookie?: never;
1949
+ };
1950
+ get?: never;
1951
+ put?: never;
1952
+ /**
1953
+ * @description Close a sub-account. Refused unless it is flat: no position and no order,
1954
+ * conditional order or TWAP. Its flat, solvent risk buckets close in the
1955
+ * same step, and all of its remaining collateral moves to the default
1956
+ * margin account. A risk bucket in liquidation or bad debt refuses the
1957
+ * close, and nothing moves.
1958
+ */
1959
+ post: operations["close_sub_account"];
1960
+ delete?: never;
1961
+ options?: never;
1962
+ head?: never;
1963
+ patch?: never;
1964
+ trace?: never;
1965
+ };
1966
+ "/api/v1/margin/sub-accounts/{marginAccountId}/collateral/transfer-in": {
1967
+ parameters: {
1968
+ query?: never;
1969
+ header?: never;
1970
+ path?: never;
1971
+ cookie?: never;
1972
+ };
1973
+ get?: never;
1974
+ put?: never;
1975
+ /**
1976
+ * @description Move collateral from the caller's default margin account to one of their
1977
+ * sub-accounts, in one sequenced step. The same move as `TransferCollateral`
1978
+ * from the default account to the sub-account. The path names an open
1979
+ * sub-account of the caller; the default margin account itself is refused
1980
+ * (fund it with the parent-margin-account routes).
1981
+ */
1982
+ post: operations["transfer_collateral_to_sub_account"];
1983
+ delete?: never;
1984
+ options?: never;
1985
+ head?: never;
1986
+ patch?: never;
1987
+ trace?: never;
1988
+ };
1989
+ "/api/v1/margin/sub-accounts/{marginAccountId}/collateral/transfer-out": {
1990
+ parameters: {
1991
+ query?: never;
1992
+ header?: never;
1993
+ path?: never;
1994
+ cookie?: never;
1995
+ };
1996
+ get?: never;
1997
+ put?: never;
1998
+ /**
1999
+ * @description Move collateral from one of the caller's sub-accounts back to their
2000
+ * default margin account, in one sequenced step. The mirror of
2001
+ * `TransferCollateralToSubAccount`; the amount must fit the sub-account's
2002
+ * free collateral.
2003
+ */
2004
+ post: operations["transfer_collateral_from_sub_account"];
2005
+ delete?: never;
2006
+ options?: never;
2007
+ head?: never;
2008
+ patch?: never;
2009
+ trace?: never;
2010
+ };
1852
2011
  "/api/v1/market/funding/history": {
1853
2012
  parameters: {
1854
2013
  query?: never;
@@ -2643,12 +2802,14 @@ export interface paths {
2643
2802
  * Get your referral position
2644
2803
  * @description Read your own referral position (self-scoped).
2645
2804
  *
2646
- * Return the authenticated caller's referral position: their direct (L1)
2647
- * referrer, the total rewards they have earned, and their most recent reward
2648
- * rows. Self-scoped — identity comes only from the session, never a path id,
2805
+ * Return the authenticated caller's referral position: their referral chain
2806
+ * upward (L1, L2 and onward — who referred them, who referred that wallet, and
2807
+ * so on, as many levels as PitPass currently rewards), the total rewards they
2808
+ * have earned, and their most recent reward rows.
2809
+ * Self-scoped — identity comes only from the session, never a path id,
2649
2810
  * so a caller can only ever read their own chain. Every other user is
2650
2811
  * identified by their public wallet address, never an internal id. An empty
2651
- * `referrer` means the caller was not referred.
2812
+ * `referrer` and `upline` mean the caller was not referred.
2652
2813
  */
2653
2814
  get: operations["get_my_referral_position"];
2654
2815
  put?: never;
@@ -2670,10 +2831,12 @@ export interface paths {
2670
2831
  * Get your referral downline and earnings
2671
2832
  * @description Read your own downline earnings (self-scoped).
2672
2833
  *
2673
- * Return who the authenticated caller earns from and how much: an
2674
- * earnings-by-source breakdown aggregated from the caller's reward rows across
2675
- * all three reward levels (L1/L2/L3), their L1 direct-referee roster (including
2676
- * referees who have not traded yet), and a per-level earnings summary.
2834
+ * Return who the authenticated caller earns from and how much: one page of
2835
+ * the earnings-by-source breakdown across every reward level, their L1
2836
+ * direct-referee roster (including referees who have not traded yet), and a
2837
+ * per-level earnings summary that always covers every level and source,
2838
+ * whatever page is requested. `earnings_by_source` is paged (`page_size`,
2839
+ * `page_token`); a request without them gets the first page, not every row.
2677
2840
  * Self-scoped — identity comes only from the session, never a path id. Every
2678
2841
  * source and referee is identified by their public wallet address, never an
2679
2842
  * internal id.
@@ -2687,6 +2850,41 @@ export interface paths {
2687
2850
  patch?: never;
2688
2851
  trace?: never;
2689
2852
  };
2853
+ "/api/v1/pitpass/referrals/me/tree": {
2854
+ parameters: {
2855
+ query?: never;
2856
+ header?: never;
2857
+ path?: never;
2858
+ cookie?: never;
2859
+ };
2860
+ /**
2861
+ * Get one level of your referral tree
2862
+ * @description Read one level of your own referral tree (self-scoped).
2863
+ *
2864
+ * Return the wallets directly referred by `parent` — the authenticated caller
2865
+ * when `parent` is omitted, otherwise one of the caller's own referees above
2866
+ * the deepest rewarded level — one page at a time, newest first. Each node carries its level
2867
+ * relative to the caller, its parent, how many wallets it has referred (so the
2868
+ * client knows whether it can be expanded), and what the caller has earned
2869
+ * from that wallet's own trades. Expanding a node is another call with
2870
+ * `parent` set to that node's wallet; the tree stops at the deepest level that
2871
+ * pays referral rewards, which an admin configures (at most 10).
2872
+ *
2873
+ * Self-scoped — identity comes only from the session. A `parent` that is not
2874
+ * the caller or a referee the caller can expand returns 404, the same
2875
+ * as a wallet that does not exist, so the endpoint cannot be used to read
2876
+ * anyone else's tree. Every node is identified by its public wallet address,
2877
+ * never an internal id.
2878
+ */
2879
+ get: operations["get_my_referral_tree"];
2880
+ put?: never;
2881
+ post?: never;
2882
+ delete?: never;
2883
+ options?: never;
2884
+ head?: never;
2885
+ patch?: never;
2886
+ trace?: never;
2887
+ };
2690
2888
  "/api/v1/pitpass/rewards/balance": {
2691
2889
  parameters: {
2692
2890
  query?: never;
@@ -2729,7 +2927,8 @@ export interface paths {
2729
2927
  * trading balance under the authenticated application, making it tradeable
2730
2928
  * immediately. Ledger-only (one shared vault + one backend ledger) — no
2731
2929
  * on-chain transaction and no gas. Fails with 402 when the rewards balance is
2732
- * insufficient.
2930
+ * insufficient. It spends the per-user movement budget withdrawals and
2931
+ * collateral transfers share.
2733
2932
  */
2734
2933
  post: operations["transfer_rewards"];
2735
2934
  delete?: never;
@@ -2769,7 +2968,13 @@ export interface paths {
2769
2968
  * Submits a MARKET reduce-only close for every open position owned by the
2770
2969
  * caller, optionally filtered to a single trading pair. Best-effort and
2771
2970
  * partial: each position closes independently and per-position failures are
2772
- * reported in `results` rather than aborting the batch.
2971
+ * reported in `results` rather than aborting the batch. Each close draws
2972
+ * one item from the risk-reduction rate limit (an empty call draws one).
2973
+ * The first 100 are charged before anything is sent: over budget, the
2974
+ * whole call is refused with 429 and nothing is closed. Past 100 open
2975
+ * positions the rest are charged 100 at a time as the call reaches them,
2976
+ * and those the budget does not cover are not sent: they come back in
2977
+ * `results` with `RATE_LIMIT_EXCEEDED`, to be retried.
2773
2978
  */
2774
2979
  post: operations["batch_close_all_positions"];
2775
2980
  delete?: never;
@@ -3285,28 +3490,16 @@ export interface components {
3285
3490
  * @example master
3286
3491
  */
3287
3492
  accountType?: string | null;
3288
- /**
3289
- * @description Whether the user is allowed to withdraw
3290
- * @example true
3291
- */
3292
- canWithdraw?: boolean | null;
3293
3493
  /**
3294
3494
  * @description Account creation timestamp (ISO 8601)
3295
3495
  * @example 2023-11-13T10:30:00Z
3296
3496
  */
3297
3497
  createdAt?: string | null;
3298
- /** @description Email address */
3299
- email?: string | null;
3300
3498
  /**
3301
3499
  * @description Whether the user account is active
3302
3500
  * @example true
3303
3501
  */
3304
3502
  isActive?: boolean | null;
3305
- /**
3306
- * @description Whether the user is banned
3307
- * @example false
3308
- */
3309
- isBanned?: boolean | null;
3310
3503
  /**
3311
3504
  * Format: uuid
3312
3505
  * @description Master account ID (for sub-accounts)
@@ -3741,7 +3934,7 @@ export interface components {
3741
3934
  */
3742
3935
  strategyKey?: string | null;
3743
3936
  /**
3744
- * @description Risk bucket mode for margin orders. Defaults to ISOLATED. Values: ISOLATED, CROSS.
3937
+ * @description Risk bucket mode for margin orders. Defaults to ISOLATED. Values: ISOLATED, CROSS. On an isolated-only market (TradingPairData.isolated_only) a CROSS order that is not reduce-only is rejected with HTTP 400 / gRPC INVALID_ARGUMENT carrying the structured error code CROSS_MARGIN_NOT_ALLOWED.
3745
3938
  * @example CROSS
3746
3939
  * @enum {string|null}
3747
3940
  */
@@ -3944,7 +4137,7 @@ export interface components {
3944
4137
  amount?: string | null;
3945
4138
  /**
3946
4139
  * Format: int32
3947
- * @description Realized whole-basis-point rate for this credit after the Monaco-floor clamp, computed from the credited amount divided by the gross protocol take and truncated down. This can be lower than the configured BuilderCodes budget.
4140
+ * @description Basis-point rate applied to this credit. For `BUILDER_FEE`, this is the normalized builder-fee rate charged to the taker. For `REVENUE_SHARE`, it is the realized whole-basis-point rate after the Monaco-floor clamp and can be lower than the configured BuilderCodes budget.
3948
4141
  * @example 1000
3949
4142
  */
3950
4143
  appliedBps?: number | null;
@@ -3954,7 +4147,7 @@ export interface components {
3954
4147
  */
3955
4148
  createdAt?: string | null;
3956
4149
  /**
3957
- * @description Payout category for this credit. `REVENUE_SHARE` is active; `BUILDER_FEE` is reserved and is not currently emitted.
4150
+ * @description Payout category for this credit: `REVENUE_SHARE` for Monaco revenue sharing or `BUILDER_FEE` for an ordinary builder fee charged to the taker.
3958
4151
  * @example REVENUE_SHARE
3959
4152
  * @enum {string|null}
3960
4153
  */
@@ -4271,6 +4464,16 @@ export interface components {
4271
4464
  message?: string | null;
4272
4465
  submittedQuantity?: string | null;
4273
4466
  };
4467
+ CloseSubAccountRequest: {
4468
+ marginAccountId?: string | null;
4469
+ };
4470
+ CloseSubAccountResponse: {
4471
+ marginAccountId?: string | null;
4472
+ /** @description The default margin account that received the remaining collateral. */
4473
+ defaultMarginAccountId?: string | null;
4474
+ /** @description Collateral moved to the default margin account. */
4475
+ amount?: string | null;
4476
+ };
4274
4477
  ClosedTrade: {
4275
4478
  /**
4276
4479
  * Format: uuid
@@ -4299,6 +4502,17 @@ export interface components {
4299
4502
  /** @description Execution time (RFC 3339) */
4300
4503
  closedAt?: string | null;
4301
4504
  };
4505
+ /**
4506
+ * @description One side of a `TransferCollateral`: the spot wallet, or a margin account
4507
+ * and optionally one of its risk buckets.
4508
+ */
4509
+ CollateralTransferEndpoint: {
4510
+ /** @description The spot wallet. Set exactly one of `wallet` and `margin_account_id`. */
4511
+ wallet?: boolean | null;
4512
+ marginAccountId?: string | null;
4513
+ /** @description A risk bucket of `margin_account_id`. */
4514
+ riskBucketId?: string | null;
4515
+ };
4302
4516
  ConditionalOrder: {
4303
4517
  conditionalOrderId?: string | null;
4304
4518
  /** Format: uuid */
@@ -4521,7 +4735,7 @@ export interface components {
4521
4735
  */
4522
4736
  strategyKey?: string | null;
4523
4737
  /**
4524
- * @description Risk bucket mode for margin orders. Defaults to ISOLATED. Values: ISOLATED, CROSS.
4738
+ * @description Risk bucket mode for margin orders. Defaults to ISOLATED. Values: ISOLATED, CROSS. On an isolated-only market (TradingPairData.isolated_only) a CROSS order that is not reduce-only is rejected with HTTP 400 / gRPC INVALID_ARGUMENT carrying the structured error code CROSS_MARGIN_NOT_ALLOWED.
4525
4739
  * @example CROSS
4526
4740
  * @enum {string|null}
4527
4741
  */
@@ -4598,6 +4812,23 @@ export interface components {
4598
4812
  */
4599
4813
  trailingStopOrderId?: string | null;
4600
4814
  };
4815
+ CreateSubAccountRequest: {
4816
+ /**
4817
+ * @description Sub-account key: up to 64 letters, digits, `_`, `-`, `.` or `:`. Keys
4818
+ * starting with `copy:` are reserved, and `default` names the default
4819
+ * margin account.
4820
+ */
4821
+ subaccountKey?: string | null;
4822
+ /** @description Optional display label. */
4823
+ label?: string | null;
4824
+ };
4825
+ CreateSubAccountResponse: {
4826
+ marginAccountId?: string | null;
4827
+ subaccountKey?: string | null;
4828
+ /** @description Values: ACTIVE. */
4829
+ marginAccountState?: string | null;
4830
+ label?: string | null;
4831
+ };
4601
4832
  CreateTwapOrderRequest: {
4602
4833
  /**
4603
4834
  * Format: uuid
@@ -4670,7 +4901,7 @@ export interface components {
4670
4901
  */
4671
4902
  riskBucketId?: string | null;
4672
4903
  /**
4673
- * @description Risk bucket mode for margin TWAP orders. Defaults to ISOLATED. Values: ISOLATED, CROSS.
4904
+ * @description Risk bucket mode for margin TWAP orders. Defaults to ISOLATED. Values: ISOLATED, CROSS. On an isolated-only market (TradingPairData.isolated_only) a CROSS order that is not reduce-only is rejected with HTTP 400 / gRPC INVALID_ARGUMENT carrying the structured error code CROSS_MARGIN_NOT_ALLOWED.
4674
4905
  * @example CROSS
4675
4906
  * @enum {string|null}
4676
4907
  */
@@ -4811,6 +5042,8 @@ export interface components {
4811
5042
  * @description Legacy field; no concurrent open-order cap is enforced. New or updated policies leave it unset.
4812
5043
  */
4813
5044
  maxOpenOrders?: number | null;
5045
+ /** @description IP addresses and CIDR ranges the agent may create its delegated session from, normalized. Empty allows any address. */
5046
+ ipAllowlist?: string[] | null;
4814
5047
  };
4815
5048
  DelegatedAgentOwner: {
4816
5049
  /**
@@ -5144,12 +5377,13 @@ export interface components {
5144
5377
  * margin account yet.
5145
5378
  *
5146
5379
  * This is NOT trading headroom for existing cross exposure. It is bounded
5147
- * by allocation (principal not earmarked by risk buckets) as well as by
5380
+ * by allocation (net deposits plus settled realized PnL not allocated to
5381
+ * risk buckets) as well as by
5148
5382
  * margin requirements, and an unrealized gain does not raise it: a
5149
5383
  * mark-to-market gain is initial margin against existing cross exposure but
5150
5384
  * may not fund an exit. `MarginAccountSummary.free_collateral` credits that
5151
5385
  * gain in full and remains the trading-margin headroom for existing cross
5152
- * exposure — but a NEW isolated or first-use position allocates principal
5386
+ * exposure — but a NEW isolated or first-use position allocates collateral
5153
5387
  * through the same gate this field measures, so size those from this field.
5154
5388
  *
5155
5389
  * Note the two `margin_*` fields answer opposite questions:
@@ -5231,12 +5465,6 @@ export interface components {
5231
5465
  * @example 5
5232
5466
  */
5233
5467
  total?: number | null;
5234
- /**
5235
- * Format: uint32
5236
- * @description Current page number
5237
- * @example 1
5238
- */
5239
- page?: number | null;
5240
5468
  /**
5241
5469
  * Format: uint32
5242
5470
  * @description Items per page
@@ -5249,6 +5477,12 @@ export interface components {
5249
5477
  * @example 1
5250
5478
  */
5251
5479
  totalPages?: number | null;
5480
+ /**
5481
+ * @description Cursor for the next page, minted from the last row of an over-fetched
5482
+ * page. The whole set is already in memory, so over-fetching is free and an
5483
+ * empty token is the definitive end of the walk.
5484
+ */
5485
+ nextPageToken?: string | null;
5252
5486
  };
5253
5487
  GetBuildercodePayoutSummaryResponse: {
5254
5488
  /**
@@ -5283,7 +5517,7 @@ export interface components {
5283
5517
  * @example 0x0000000000000000000000000000000000000001
5284
5518
  */
5285
5519
  payoutAddress?: string | null;
5286
- /** @description Current BuilderCodes feature-flag state. Successful responses are true because this endpoint is gated by the flag. */
5520
+ /** @description Whether the BuilderCodes revenue share is switched on. While false no new share accrues; balances already credited stay readable and claimable. */
5287
5521
  buildercodesEnabled?: boolean | null;
5288
5522
  /**
5289
5523
  * Format: uint32
@@ -5434,20 +5668,31 @@ export interface components {
5434
5668
  };
5435
5669
  GetMarginAccountMovementsResponse: {
5436
5670
  movements?: components["schemas"]["MarginAccountMovement"][] | null;
5437
- /**
5438
- * Format: uint32
5439
- * @description Matching movements. Exact up to 10,000 pages of the requested page size (page_size x 10,000 rows) and saturates there, so a caller with more movements than the listing can page through reads the cap, not its lifetime total.
5440
- * @example 150
5441
- */
5442
- total?: number | null;
5443
- /** Format: uint32 */
5444
- page?: number | null;
5445
5671
  /** Format: uint32 */
5446
5672
  pageSize?: number | null;
5673
+ /**
5674
+ * @description Cursor for the next page, minted from the last row of an over-fetched
5675
+ * page: this listing is one SQL statement with one global ORDER BY, so a
5676
+ * page shorter than `pageSize` proves the walk is exhausted and this is
5677
+ * empty. A non-empty token always has at least one further row behind it.
5678
+ */
5679
+ nextPageToken?: string | null;
5680
+ };
5681
+ GetMarginAccountPnlResponse: {
5682
+ marginAccountId?: string | null;
5683
+ /**
5684
+ * @description Decimal string: settled on the account plus still held in its open risk
5685
+ * buckets.
5686
+ */
5687
+ realizedPnl?: string | null;
5688
+ /**
5689
+ * @description Decimal string: the account's open positions repriced at the latest risk
5690
+ * marks.
5691
+ */
5692
+ unrealizedPnl?: string | null;
5447
5693
  };
5448
5694
  GetMarginAccountSummaryResponse: {
5449
5695
  marginAccountId?: string | null;
5450
- accountState?: string | null;
5451
5696
  equity?: string | null;
5452
5697
  initialMarginRequired?: string | null;
5453
5698
  maintenanceMarginRequired?: string | null;
@@ -5456,23 +5701,26 @@ export interface components {
5456
5701
  * @description The largest amount a transfer-out of this scope will actually accept.
5457
5702
  *
5458
5703
  * NOT a clamped `free_collateral`. Free collateral is equity headroom, and
5459
- * equity includes realized PnL, accrued funding and mark-to-market gains
5460
- * that are not principal a transfer can move — so the two can differ
5461
- * without limit. An unrealized gain never counts toward this figure.
5704
+ * equity includes mark-to-market gains that a transfer cannot move — so
5705
+ * the two can differ without limit. An unrealized gain never counts toward
5706
+ * this figure.
5707
+ *
5708
+ * For a risk bucket this is the bucket's allocated collateral plus its
5709
+ * realized PnL, less what its positions and resting orders require (the
5710
+ * bucket's allocation may go negative, which is how realized profit leaves
5711
+ * a live bucket); for a parent margin account, net deposits plus settled
5712
+ * realized PnL that no risk bucket has allocated.
5462
5713
  *
5463
- * For a risk bucket this is capped by the bucket's allocated collateral;
5464
- * for a parent margin account, by deposited collateral that no risk bucket
5465
- * has earmarked.
5714
+ * This is the largest accepted transfer-out, and every smaller amount is
5715
+ * accepted too. It is zero on a risk bucket that is not `NORMAL` (under
5716
+ * liquidation or frozen as bad debt), whose allocation cannot be released,
5717
+ * and on a risk bucket whose realized loss has used up its allocation: that
5718
+ * bucket cannot be released at all, and the parent margin account is
5719
+ * charged at most its allocation, the loss past it being the insurance
5720
+ * fund's.
5466
5721
  *
5467
- * This is the largest accepted transfer-out, NOT a promise that every
5468
- * smaller one is accepted. Acceptance is not monotone in the amount: a risk
5469
- * bucket whose realized loss exceeds its remaining value accepts the full
5470
- * close-out reported here — which settles that loss to the parent margin
5471
- * account — while refusing a partial withdrawal that would leave the bucket
5472
- * holding less collateral than the loss it has already taken. For such a
5473
- * bucket the accepted amounts are everything up to its equity, plus this
5474
- * figure itself, with a gap in between. Size a transfer directly from this
5475
- * field rather than shaving a margin off it.
5722
+ * Printed truncated toward zero at the quote asset's precision, so the
5723
+ * printed amount itself is always accepted.
5476
5724
  */
5477
5725
  withdrawableCollateral?: string | null;
5478
5726
  totalPositionNotional?: string | null;
@@ -5507,6 +5755,16 @@ export interface components {
5507
5755
  copyFollowId?: string | null;
5508
5756
  /** @description On a copy risk bucket row, the followed leader's custom TraderCode handle, when they still hold one */
5509
5757
  copyLeaderHandle?: string | null;
5758
+ /**
5759
+ * @description The risk bucket's lifecycle state. Present only for risk-bucket rows;
5760
+ * a parent margin account has no lifecycle of its own. Values: NORMAL,
5761
+ * PENDING_LIQUIDATION, LIQUIDATING, BAD_DEBT, CLOSED.
5762
+ */
5763
+ riskBucketState?: string | null;
5764
+ /** @description See `MarginAccountSummary.subaccount_key`. */
5765
+ subaccountKey?: string | null;
5766
+ /** @description See `MarginAccountSummary.margin_account_state`. */
5767
+ marginAccountState?: string | null;
5510
5768
  };
5511
5769
  GetMarkPriceResponse: {
5512
5770
  /** Format: uuid */
@@ -5634,16 +5892,10 @@ export interface components {
5634
5892
  movements?: components["schemas"]["LedgerMovement"][] | null;
5635
5893
  /**
5636
5894
  * Format: uint32
5637
- * @description Matching movements. Exact up to 10,000 pages of the requested page size (page_size x 10,000 rows) and saturates there, so a user with more matching movements than the listing can page through reads the cap, not their lifetime total.
5895
+ * @description Number of movements matching the filter, bounded by the server ceiling — a lower bound when totalCapped is true.
5638
5896
  * @example 150
5639
5897
  */
5640
5898
  total?: number | null;
5641
- /**
5642
- * Format: uint32
5643
- * @description Current page number
5644
- * @example 1
5645
- */
5646
- page?: number | null;
5647
5899
  /**
5648
5900
  * Format: uint32
5649
5901
  * @description Items per page
@@ -5652,15 +5904,28 @@ export interface components {
5652
5904
  pageSize?: number | null;
5653
5905
  /**
5654
5906
  * Format: uint32
5655
- * @description Number of pages at the requested page size. Exact up to 10,000 and saturates there, the last page this listing can reach.
5907
+ * @description Number of pages at this pageSize, bounded by the server ceiling — a lower bound when totalCapped is true.
5656
5908
  * @example 8
5657
5909
  */
5658
5910
  totalPages?: number | null;
5911
+ /**
5912
+ * @description Cursor for the next page, minted from the last row of an over-fetched
5913
+ * page. Each arm of the union is cut at the same over-fetched depth and the
5914
+ * outer query orders the merged rows, so a page shorter than `pageSize`
5915
+ * means both arms are exhausted and this is empty — a non-empty token always
5916
+ * has at least one further row behind it.
5917
+ */
5918
+ nextPageToken?: string | null;
5919
+ /**
5920
+ * @description True when more than the server ceiling of movements matched, so the count stopped at the ceiling and total/totalPages are a lower bound. False when total is exact, including exactly the ceiling.
5921
+ * @example false
5922
+ */
5923
+ totalCapped?: boolean | null;
5659
5924
  };
5660
5925
  GetMyFeeTierResponse: {
5661
5926
  /**
5662
5927
  * Format: int32
5663
- * @description Caller's resolved tier (1–6) from their wallet's stored weighted 14-day volume
5928
+ * @description Caller's resolved tier (1–6) from the higher of their wallet's weighted 14-day volume and any volume floor set on the wallet. A floor that is set or changed counts once it applies to the wallet's fills, usually within a minute, and likewise for an account the wallet opens in a new application; a removed or expired floor stops counting at once
5664
5929
  * @example 2
5665
5930
  */
5666
5931
  currentTierLevel?: number | null;
@@ -5680,7 +5945,7 @@ export interface components {
5680
5945
  */
5681
5946
  perpVolume14d?: string | null;
5682
5947
  /**
5683
- * @description Additional weighted volume needed to reach the next tier; omitted at tier 6
5948
+ * @description Additional weighted volume needed to reach the next tier, counted from the volume the current tier resolved from; omitted at tier 6
5684
5949
  * @example 17500000
5685
5950
  */
5686
5951
  volumeToNextTier?: string | null;
@@ -5694,16 +5959,18 @@ export interface components {
5694
5959
  feeSchedule?: components["schemas"]["FeeTierScheduleRow"][] | null;
5695
5960
  };
5696
5961
  GetMyReferralDownlineResponse: {
5697
- /** @description One row per (source trader, level, token) the caller earns from, across all three reward levels. Comes straight from the caller's reward rows — no tree walk. */
5962
+ /** @description One page of rows, one per (source account, level, token) the caller earns from, across every reward level, ordered by each source account's own total, largest first. A wallet that traded through several applications has one account per application: its rows within a page are merged into one row at the position of its first (largest) part, so a merged row can sit below a smaller one, and the wallet can appear again on a later page. Paged by `pageSize` / `pageToken`; follow `nextPageToken` for the rest. Comes from the caller's maintained reward totals — no tree walk. */
5698
5963
  earningsBySource?: components["schemas"]["ReferralEarningsSource"][] | null;
5699
- /** @description The caller's direct (L1) referees, newest first, including referees who have not traded yet (0 earned). Bounded to the most recent 500 EFFECTIVE referees (after per-wallet dedupe and the winning-edge filter). The earnings views (`earnings_by_source` and the summary) are unbounded and count every level, so a caller past the roster cap still sees their full earnings; only this roster listing is capped. */
5964
+ /** @description The caller's direct (L1) referees, newest first, including referees who have not traded yet (0 earned). Bounded to the most recent 500 EFFECTIVE referees (after per-wallet dedupe and the winning-edge filter). The summary counts every level and source and `earnings_by_source` pages through every row, so a caller past the roster cap still sees their full earnings; only this roster listing is capped. */
5700
5965
  directReferees?: components["schemas"]["ReferralDirectReferee"][] | null;
5701
- /** @description Total earned broken down by level (L1/L2/L3). */
5966
+ /** @description Total earned broken down by level. Covers every level and source regardless of the `earnings_by_source` page. */
5702
5967
  summary?: components["schemas"]["ReferralEarningsSummary"] | null;
5968
+ /** @description Cursor for the next `earningsBySource` page; empty when there are no more rows. */
5969
+ nextPageToken?: string | null;
5703
5970
  };
5704
5971
  GetMyReferralPositionResponse: {
5705
5972
  /**
5706
- * @description Public wallet address of the caller's direct (L1) referrer — who referred them. Empty when the caller was not referred. Never exposes L2/L3 upline or any internal id.
5973
+ * @description Public wallet address of the caller's direct (L1) referrer — who referred them. Empty when the caller was not referred. The same wallet as the first `upline` entry; never an internal id.
5707
5974
  * @example 0x0000000000000000000000000000000000000002
5708
5975
  */
5709
5976
  referrer?: string | null;
@@ -5719,6 +5986,21 @@ export interface components {
5719
5986
  referrerDisplay?: string | null;
5720
5987
  /** @description The caller's most recent reward rows, newest first. Bounded server-side — not the full history. */
5721
5988
  rewards?: components["schemas"]["ReferralRewardEntry"][] | null;
5989
+ /** @description The caller's referral chain upward, nearest first: L1 (who referred the caller), then L2 (who referred them), and so on. At most as many entries as PitPass currently rewards levels (at most 10); shorter when the chain ends, empty when the caller was not referred. These are the wallets the caller's own trades pay referral rewards to. */
5990
+ upline?: components["schemas"]["ReferralUplineEntry"][] | null;
5991
+ };
5992
+ GetMyReferralTreeResponse: {
5993
+ /** @description Wallet address whose referees `nodes` lists — the caller's own wallet when the request omitted `parent`. */
5994
+ parent?: string | null;
5995
+ /**
5996
+ * Format: int32
5997
+ * @description Depth of `parent` below the caller: 0 for the caller, otherwise the level of the referee being expanded. Every node is one level deeper.
5998
+ */
5999
+ parentLevel?: number | null;
6000
+ /** @description The wallets `parent` referred, newest first. A wallet that signed up under several referrers (one per app) appears only under the referrer the reward engine pays. */
6001
+ nodes?: components["schemas"]["ReferralTreeNode"][] | null;
6002
+ /** @description Cursor for the next page; empty when there are no more. */
6003
+ nextPageToken?: string | null;
5722
6004
  };
5723
6005
  /** @description Latest public open interest for a trading pair. */
5724
6006
  GetOpenInterestResponse: {
@@ -5763,7 +6045,7 @@ export interface components {
5763
6045
  */
5764
6046
  tradingPairId?: string | null;
5765
6047
  /**
5766
- * @description What kind of order this row is: LIMIT or MARKET for a book order, TWAP for a TWAP parent, CONDITIONAL for a price-triggered order. TWAP and CONDITIONAL appear only in responses — they name a row's kind and cannot be placed through the create-order request, which still takes LIMIT, MARKET or IOC. A row of either kind carries its kind-specific fields in `twap` or `conditional`; the fields shared by every kind (id, side, quantity, status, timestamps) are populated in place as usual.
6048
+ * @description Order type: LIMIT or MARKET
5767
6049
  * @example LIMIT
5768
6050
  */
5769
6051
  orderType?: string | null;
@@ -5773,7 +6055,7 @@ export interface components {
5773
6055
  */
5774
6056
  side?: string | null;
5775
6057
  /**
5776
- * @description Limit price (null for market orders). For a TWAP parent this is its optional parent-level limit price, and for a conditional order the limit price its triggered order will carry (null when it triggers as a market order).
6058
+ * @description Limit price (null for market orders)
5777
6059
  * @example 35000.00
5778
6060
  */
5779
6061
  price?: string | null;
@@ -5956,7 +6238,7 @@ export interface components {
5956
6238
  */
5957
6239
  batchId?: string | null;
5958
6240
  /**
5959
- * @description Stable terminal cause for a cancelled order: USER_REQUESTED, REPLACED, LIQUIDATION, INSUFFICIENT_MARGIN, REDUCE_ONLY_EXHAUSTED, POSITION_CLOSED, OCO_SIBLING_TRIGGERED, or SYSTEM
6241
+ * @description Stable terminal cause for a cancelled order: USER_REQUESTED, REPLACED, LIQUIDATION, INSUFFICIENT_MARGIN, REDUCE_ONLY_EXHAUSTED, POSITION_CLOSED, OCO_SIBLING_TRIGGERED, SELF_TRADE_PREVENTION, AUTO_DELEVERAGING, PRICE_BAND, SLIPPAGE_TOLERANCE, or SYSTEM. AUTO_DELEVERAGING means auto-deleveraging closed the position your risk bucket held and this resting order was cancelled with it; you were deleveraged as a counterparty, not liquidated. PRICE_BAND means the exchange's protective price band stopped the order and its remainder was cancelled; SLIPPAGE_TOLERANCE means your own slippageToleranceBps did.
5960
6242
  * @example REDUCE_ONLY_EXHAUSTED
5961
6243
  */
5962
6244
  terminalReason?: string | null;
@@ -5965,10 +6247,6 @@ export interface components {
5965
6247
  * @example false
5966
6248
  */
5967
6249
  postOnly?: boolean | null;
5968
- /** @description Present only when orderType is TWAP: the full TWAP parent, identical to what GET /api/v1/orders/twap/{twapOrderId} returns — schedule, slice counters, progress, and terminal reason. The row's shared fields mirror it: quantity is the parent's total quantity, filledQuantity its executed quantity, and status maps its state onto the order statuses. */
5969
- twap?: components["schemas"]["TwapOrder"] | null;
5970
- /** @description Present only when orderType is CONDITIONAL: the full conditional order, identical to what the conditional-order endpoints return — trigger price and direction, condition type, linked group, and the order it triggers into. The row's shared fields mirror it, with status mapping its state onto the order statuses. */
5971
- conditional?: components["schemas"]["ConditionalOrder"] | null;
5972
6250
  /**
5973
6251
  * Format: int64
5974
6252
  * @description Opaque, compare-only revision counter for this order's state: the sequencer step that wrote it. A strictly higher value is strictly newer state for that order. The SAME counter is carried on every order WebSocket event and on the `orders` snapshot frame, so a reconnecting client reconciles on `(id, version)` — take the REST row when `snapshot.version >= local.version`, else keep local state. Note `>=`, not `>`: on the stream, equal versions mean the SAME STEP rather than identical state, because one step emits several events for one order (an `OrderPlaced` and then its fills) and a batch shares one step across every item. A REST row is that step's FINAL state, so it wins a tie. Between two REST reads the comparison is simpler — equal there does mean identical state. Do not read anything else into the number: it is not a count of updates, consecutive values are not expected (it is drawn from a global sequence shared by every order, so per-order values are sparse and gaps are normal), and it is not comparable across different orders. Absent means unknown: an order last written before this field existed. Fall back to a full field comparison for those rather than treating absent as version zero — and note that a comparison against an absent value is false in both directions, so an order held locally without one is never refreshed by the merge above; take the REST row unconditionally for those. Reconciling on this counter does NOT on its own close a reconnect gap: an order that filled or was cancelled while the socket was down appears in neither the resting snapshot nor the stream, so recover fills from `listUserTrades` (ordered by execution time) and resolve anything your local state believes is resting that the snapshot no longer lists with a targeted `getOrder`. Unlike `updatedAt`, this value is identical on every REST endpoint that serves the same order state, and never advances without a state change.
@@ -6141,6 +6419,18 @@ export interface components {
6141
6419
  total?: components["schemas"]["PortfolioMarginTotal"];
6142
6420
  positions?: components["schemas"]["PortfolioMarginPositionCounts"];
6143
6421
  riskBuckets?: components["schemas"]["PortfolioRiskBucket"][] | null;
6422
+ /**
6423
+ * @description The margin account `total`, `positions` and `risk_buckets` describe;
6424
+ * absent when the caller has no margin account yet.
6425
+ */
6426
+ marginAccountId?: string | null;
6427
+ /**
6428
+ * @description With `include_accounts`: every open margin account of the caller, the
6429
+ * default one first, then sub-accounts by key.
6430
+ */
6431
+ accounts?: components["schemas"]["PortfolioMarginAccount"][] | null;
6432
+ /** @description With `include_accounts`: the sum of `accounts`' totals. */
6433
+ ownerTotal?: components["schemas"]["PortfolioMarginTotal"] | null;
6144
6434
  };
6145
6435
  GetPortfolioPerformanceResponse: {
6146
6436
  window?: components["schemas"]["PortfolioSeriesWindow"];
@@ -6394,10 +6684,15 @@ export interface components {
6394
6684
  cumFees?: string | null;
6395
6685
  /**
6396
6686
  * Format: int64
6397
- * @description Opaque, non-negative producer-owned version for this position row. Compare only within the same position; higher is newer. 0 is the unranked legacy sentinel and never participates in ordering: treat it exactly as an absent version and fall back to a full field comparison rather than ranking it as oldest. It advances on sequenced position mutations (open, add, reduce, close, funding, margin transfer, liquidation, ADL) and is shared by the persisted read, the WebSocket positions snapshot and a RANKED live position_update frame. Ranked live frames include fills that leave a position open, direct isolated-position margin adds/reductions, and copy-position margin adds; the copy add refreshes its isolated child and copy-cross siblings at the same version. Cross-risk-bucket ALLOCATE/RELEASE and copy follow/stop refreshes use margin_added/margin_reduced but omit the version because those commands write no position rows. Funding omits it because it re-reads live state after sequencing; terminal frames omit it because they report size 0 and sometimes LIQUIDATED while the stored row keeps its size and records CLOSED. Wallet IN/OUT and plain isolated allocation send no position frame. Transfer frames use captured post-command state and are released only after durable acknowledgement. mark_price, unrealized_pnl, liquidation_price, leverage, maintenance_margin_required and initial_margin_required are UNVERSIONED valuation fields, re-derived per payload rather than served from the versioned row: the version does not advance for them (five move with the oracle mark; leverage does not, being opening notional over posted margin, but the live surfaces derive it while the persisted row serves its stored column, so it can still disagree at an unchanged version) (a valuation-only oracle tick persists nothing; a state-transitioning one, a breach or recovery, persists the account's snapshot and restamps the positions it changed), so the merge rule is per field group — on an equal version skip the versioned fields but still take all six from the newer payload, because discarding a whole payload on an equal version freezes displayed PnL and can leave a stale margin requirement on screen. isolated_margin is the one exception among the versioned fields: the WebSocket positions snapshot overlays it from an independent live matching-engine read rather than the versioned row, so take it from the newest payload on an equal version too or a consumer can retain stale backing. The version advances exactly when the row's versioned content changed at that sequence, a change undone within one persistence batch included; a position a command left unchanged keeps its version, so a RANKED live frame for an untouched sibling of a filled position can carry a higher version than the persisted row while describing identical content — rank it as newer, and nothing changes. A response served from live matching-engine state reports 0 (unranked): the engine holds the state but not the version.
6687
+ * @description Opaque, non-negative producer-owned version for this position row. Compare only within the same position; higher is newer. 0 is the unranked legacy sentinel and never participates in ordering: treat it exactly as an absent version and fall back to a full field comparison rather than ranking it as oldest. It advances on sequenced position mutations (open, add, reduce, close, funding, margin transfer, liquidation, ADL) and is shared by the persisted read, the WebSocket positions snapshot and a RANKED live position_update frame. Ranked live frames include fills, non-zero funding settlements, terminal closes/liquidations/ADL, direct isolated-position margin adds/reductions, and copy-position margin adds; each uses captured post-command state, and terminal frames retain the stored size and exact CLOSED/LIQUIDATED classification. After restart, a terminal frame rebuilt from legacy reduction history omits the version when that history lacks the margin fields needed to reconstruct complete lifetime allocated margin. Cross-risk-bucket ALLOCATE/RELEASE and copy follow/stop refreshes use margin_added/margin_reduced but omit the version because those commands write no position rows. Wallet IN/OUT and plain isolated allocation send no position frame. Transfer and funding frames use captured post-command state and are released only after durable acknowledgement. mark_price, unrealized_pnl, liquidation_price, leverage, maintenance_margin_required and initial_margin_required are UNVERSIONED valuation fields, re-derived per payload rather than served from the versioned row: the version does not advance for them (five move with the oracle mark; leverage does not, being opening notional over posted margin, but the live surfaces derive it while the persisted row serves its stored column, so it can still disagree at an unchanged version) (a valuation-only oracle tick persists nothing; a state-transitioning one, a breach or recovery, persists the account's snapshot and restamps the positions it changed), so the merge rule is per field group — on an equal version skip the versioned fields but still take all six from the newer payload, because discarding a whole payload on an equal version freezes displayed PnL and can leave a stale margin requirement on screen. isolated_margin is the one exception among the versioned fields: the WebSocket positions snapshot overlays it from an independent live matching-engine read rather than the versioned row, so take it from the newest payload on an equal version too or a consumer can retain stale backing. The version advances exactly when the row's versioned content changed at that sequence, a change undone within one persistence batch included; a position a command left unchanged keeps its version, so a RANKED live frame for an untouched sibling of a filled position can carry a higher version than the persisted row while describing identical content — rank it as newer, and nothing changes. A response served from live matching-engine state reports 0 (unranked): the engine holds the state but not the version.
6398
6688
  * @example 918342
6399
6689
  */
6400
6690
  version?: number | null;
6691
+ /**
6692
+ * @description RFC 3339 instant at which this position opened. Same contract as
6693
+ * `Position.opened_at` above.
6694
+ */
6695
+ openedAt?: string | null;
6401
6696
  };
6402
6697
  GetPositionRiskResponse: {
6403
6698
  positionId?: string | null;
@@ -6601,18 +6896,36 @@ export interface components {
6601
6896
  /** @description Recent trades for a trading pair. */
6602
6897
  GetTradesResponse: {
6603
6898
  trades?: components["schemas"]["PublicTrade"][] | null;
6604
- /**
6605
- * Format: uint32
6606
- * @description Current page number
6607
- * @example 1
6608
- */
6609
- page?: number | null;
6610
6899
  /**
6611
6900
  * Format: uint32
6612
6901
  * @description Maximum number of trades returned
6613
6902
  * @example 25
6614
6903
  */
6615
6904
  pageSize?: number | null;
6905
+ /**
6906
+ * @description Cursor for the next page, under **proven** semantics: the read over-fetches
6907
+ * one row past `page_size`, so an empty token means the walk is finished and
6908
+ * a non-empty token means a further trade was actually seen. Unlike
6909
+ * `ListUserTradesResponse.next_page_token` (AIP-158 "maybe more"), a client
6910
+ * can stop here on the empty token without a confirming extra request — this
6911
+ * listing reads one table, so there is no hot/archive interleave that could
6912
+ * hide rows behind a short page.
6913
+ *
6914
+ * That one table is the hot `trades` table, so a walk reaches the end of the
6915
+ * archiver's retention window rather than the end of the pair's history. This
6916
+ * is the endpoint's long-standing scope, unchanged by the cursor.
6917
+ *
6918
+ * There is no public walk over a pair's ARCHIVED history, and this endpoint is
6919
+ * not a partial one — do not point market-data consumers at the user trade
6920
+ * listings to continue it. `GetUserTrades` / `ListUserTrades` do merge the
6921
+ * archive, but they are authenticated and user-scoped (`auth.user_id` is the
6922
+ * read's first mandatory filter), so they return only trades where the caller
6923
+ * was maker or taker. Following them to extend a public pair tape would
6924
+ * silently drop every fill between two other parties. An individual archived
6925
+ * trade does stay publicly reachable by id: `GetTradeById` falls back to the
6926
+ * archive table on a hot miss.
6927
+ */
6928
+ nextPageToken?: string | null;
6616
6929
  };
6617
6930
  /** @description Single trading pair details. */
6618
6931
  GetTradingPairResponse: {
@@ -7003,29 +7316,50 @@ export interface components {
7003
7316
  */
7004
7317
  balanceId?: string | null;
7005
7318
  };
7319
+ /** @description What the caller has earned at one referral level. */
7320
+ LevelEarnings: {
7321
+ /**
7322
+ * Format: int32
7323
+ * @description Referral level: 1 for direct referees, 2 for their referees, and so on (at most 10).
7324
+ * @example 1
7325
+ */
7326
+ level?: number | null;
7327
+ /**
7328
+ * @description All-time credited earnings at this level, in the reward token's RAW atomic units.
7329
+ * @example 900000
7330
+ */
7331
+ earned?: string | null;
7332
+ };
7006
7333
  ListAllFundingHistoryResponse: {
7007
7334
  records?: components["schemas"]["FundingRecord"][] | null;
7008
- /** Format: uint32 */
7335
+ /**
7336
+ * Format: uint32
7337
+ * @description Settlements matching the filter, bounded by the server count ceiling — see
7338
+ * `totalCapped`. A lower bound when `totalCapped` is true.
7339
+ */
7009
7340
  total?: number | null;
7010
7341
  /** Format: uint32 */
7011
- page?: number | null;
7012
- /** Format: uint32 */
7013
7342
  pageSize?: number | null;
7343
+ /**
7344
+ * @description Cursor for the next page, minted from the last row of an over-fetched
7345
+ * page: this listing is one ordered read, so a page shorter than
7346
+ * `pageSize` proves the walk is exhausted and this is empty.
7347
+ */
7348
+ nextPageToken?: string | null;
7349
+ /**
7350
+ * @description True when MORE than the server ceiling matched, so the count stopped at
7351
+ * the ceiling and `total` is a lower bound.
7352
+ */
7353
+ totalCapped?: boolean | null;
7014
7354
  };
7015
7355
  ListAppBalancesResponse: {
7016
7356
  balances?: components["schemas"]["ApplicationBalance"][] | null;
7017
7357
  /**
7018
7358
  * Format: uint32
7019
- * @description Total matching balances
7359
+ * @description Number of balances matching the filter, bounded by the server ceiling — a lower bound when totalCapped is true.
7020
7360
  * @example 50
7021
7361
  */
7022
7362
  total?: number | null;
7023
- /**
7024
- * Format: uint32
7025
- * @description Current page number
7026
- * @example 1
7027
- */
7028
- page?: number | null;
7029
7363
  /**
7030
7364
  * Format: uint32
7031
7365
  * @description Items per page
@@ -7034,25 +7368,24 @@ export interface components {
7034
7368
  pageSize?: number | null;
7035
7369
  /**
7036
7370
  * Format: uint32
7037
- * @description Total number of pages
7371
+ * @description Number of pages at this pageSize, bounded by the server ceiling — a lower bound when totalCapped is true.
7038
7372
  * @example 3
7039
7373
  */
7040
7374
  totalPages?: number | null;
7041
- };
7042
- ListAppMovementsResponse: {
7043
- movements?: components["schemas"]["ApplicationMovement"][] | null;
7044
7375
  /**
7045
- * Format: uint32
7046
- * @description Matching movements. Exact up to 10,000 pages of the requested page size (page_size x 10,000 rows) and saturates there, so an application with more matching movements than the listing can page through reads the cap, not its lifetime total.
7047
- * @example 150
7376
+ * @description Cursor for the next page, minted from the last row of an over-fetched
7377
+ * page: this listing is one ordered read, so a page shorter than
7378
+ * `pageSize` proves the walk is exhausted and this is empty.
7048
7379
  */
7049
- total?: number | null;
7380
+ nextPageToken?: string | null;
7050
7381
  /**
7051
- * Format: uint32
7052
- * @description Current page number
7053
- * @example 1
7382
+ * @description True when more than the server ceiling of balances matched, so the count stopped at the ceiling and total/totalPages are a lower bound.
7383
+ * @example false
7054
7384
  */
7055
- page?: number | null;
7385
+ totalCapped?: boolean | null;
7386
+ };
7387
+ ListAppMovementsResponse: {
7388
+ movements?: components["schemas"]["ApplicationMovement"][] | null;
7056
7389
  /**
7057
7390
  * Format: uint32
7058
7391
  * @description Items per page
@@ -7060,26 +7393,14 @@ export interface components {
7060
7393
  */
7061
7394
  pageSize?: number | null;
7062
7395
  /**
7063
- * Format: uint32
7064
- * @description Number of pages at the requested page size. Exact up to 10,000 and saturates there, the last page this listing can reach.
7065
- * @example 8
7396
+ * @description Cursor for the next page, minted from the last row of an over-fetched
7397
+ * page: this listing is one ordered read, so a page shorter than
7398
+ * `pageSize` proves the walk is exhausted and this is empty.
7066
7399
  */
7067
- totalPages?: number | null;
7400
+ nextPageToken?: string | null;
7068
7401
  };
7069
7402
  ListAppOrdersResponse: {
7070
7403
  orders?: components["schemas"]["ApplicationOrder"][] | null;
7071
- /**
7072
- * Format: uint32
7073
- * @description Matching orders. Exact up to 10,000 pages of the requested page size (page_size x 10,000 rows) and saturates there, so an application with more matching orders than the listing can page through reads the cap, not its lifetime total.
7074
- * @example 150
7075
- */
7076
- total?: number | null;
7077
- /**
7078
- * Format: uint32
7079
- * @description Current page number
7080
- * @example 1
7081
- */
7082
- page?: number | null;
7083
7404
  /**
7084
7405
  * Format: uint32
7085
7406
  * @description Items per page
@@ -7087,26 +7408,20 @@ export interface components {
7087
7408
  */
7088
7409
  pageSize?: number | null;
7089
7410
  /**
7090
- * Format: uint32
7091
- * @description Number of pages at the requested page size. Exact up to 10,000 and saturates there, the last page this listing can reach.
7092
- * @example 8
7411
+ * @description Cursor for the next page, minted from the last row of an over-fetched
7412
+ * page: this listing is one ordered read, so a page shorter than
7413
+ * `pageSize` proves the walk is exhausted and this is empty.
7093
7414
  */
7094
- totalPages?: number | null;
7415
+ nextPageToken?: string | null;
7095
7416
  };
7096
7417
  ListAppUsersResponse: {
7097
7418
  users?: components["schemas"]["AppUser"][] | null;
7098
7419
  /**
7099
7420
  * Format: uint32
7100
- * @description Total number of users
7421
+ * @description Number of users matching the filter, bounded by the server ceiling — a lower bound when totalCapped is true.
7101
7422
  * @example 50
7102
7423
  */
7103
7424
  total?: number | null;
7104
- /**
7105
- * Format: uint32
7106
- * @description Current page number
7107
- * @example 1
7108
- */
7109
- page?: number | null;
7110
7425
  /**
7111
7426
  * Format: uint32
7112
7427
  * @description Items per page
@@ -7115,10 +7430,21 @@ export interface components {
7115
7430
  pageSize?: number | null;
7116
7431
  /**
7117
7432
  * Format: uint32
7118
- * @description Total number of pages
7433
+ * @description Number of pages at this pageSize, bounded by the server ceiling — a lower bound when totalCapped is true.
7119
7434
  * @example 3
7120
7435
  */
7121
7436
  totalPages?: number | null;
7437
+ /**
7438
+ * @description Cursor for the next page, minted from the last row of an over-fetched
7439
+ * page: this listing is one ordered read, so a page shorter than
7440
+ * `pageSize` proves the walk is exhausted and this is empty.
7441
+ */
7442
+ nextPageToken?: string | null;
7443
+ /**
7444
+ * @description True when more than the server ceiling of users matched, so the count stopped at the ceiling and total/totalPages are a lower bound.
7445
+ * @example false
7446
+ */
7447
+ totalCapped?: boolean | null;
7122
7448
  };
7123
7449
  ListBuilderFeeChangesResponse: {
7124
7450
  /** @description Builder-fee changes, newest first. */
@@ -7134,11 +7460,6 @@ export interface components {
7134
7460
  * @description Total payout rows for this application.
7135
7461
  */
7136
7462
  total?: number | null;
7137
- /**
7138
- * Format: uint32
7139
- * @description Current page number.
7140
- */
7141
- page?: number | null;
7142
7463
  /**
7143
7464
  * Format: uint32
7144
7465
  * @description Items per page.
@@ -7149,6 +7470,12 @@ export interface components {
7149
7470
  * @description Total number of pages.
7150
7471
  */
7151
7472
  totalPages?: number | null;
7473
+ /**
7474
+ * @description Cursor for the next page, minted from the last row of an over-fetched
7475
+ * page: this listing is one ordered read, so a page shorter than
7476
+ * `page_size` proves the walk is exhausted and this is empty.
7477
+ */
7478
+ nextPageToken?: string | null;
7152
7479
  };
7153
7480
  ListConditionalOrdersResponse: {
7154
7481
  orders?: components["schemas"]["ConditionalOrder"][] | null;
@@ -7185,27 +7512,34 @@ export interface components {
7185
7512
  };
7186
7513
  ListFundingHistoryResponse: {
7187
7514
  records?: components["schemas"]["FundingRecord"][] | null;
7188
- /** Format: uint32 */
7515
+ /**
7516
+ * Format: uint32
7517
+ * @description Settlements matching the filter, bounded by the server count ceiling — see
7518
+ * `totalCapped`. A lower bound when `totalCapped` is true.
7519
+ */
7189
7520
  total?: number | null;
7190
7521
  /** Format: uint32 */
7191
- page?: number | null;
7192
- /** Format: uint32 */
7193
7522
  pageSize?: number | null;
7523
+ /**
7524
+ * @description Cursor for the next page, minted from the last row of an over-fetched
7525
+ * page: this listing is one ordered read, so a page shorter than
7526
+ * `pageSize` proves the walk is exhausted and this is empty.
7527
+ */
7528
+ nextPageToken?: string | null;
7529
+ /**
7530
+ * @description True when MORE than the server ceiling matched, so the count stopped at
7531
+ * the ceiling and `total` is a lower bound.
7532
+ */
7533
+ totalCapped?: boolean | null;
7194
7534
  };
7195
7535
  ListFundingPaymentsResponse: {
7196
7536
  records?: components["schemas"]["FundingPaymentRecord"][] | null;
7197
7537
  /**
7198
7538
  * Format: uint32
7199
- * @description Matching funding payment records. Exact up to 10,000 pages of the requested page size (page_size x 10,000 rows) and saturates there, so a user with more matching payments than the listing can page through reads the cap, not their lifetime total.
7539
+ * @description Number of funding payments matching the filter, bounded by the server ceiling — a lower bound when totalCapped is true.
7200
7540
  * @example 2
7201
7541
  */
7202
7542
  total?: number | null;
7203
- /**
7204
- * Format: uint32
7205
- * @description Current page number
7206
- * @example 1
7207
- */
7208
- page?: number | null;
7209
7543
  /**
7210
7544
  * Format: uint32
7211
7545
  * @description Items per page
@@ -7214,10 +7548,21 @@ export interface components {
7214
7548
  pageSize?: number | null;
7215
7549
  /**
7216
7550
  * Format: uint32
7217
- * @description Number of pages at the requested page size. Exact up to 10,000 and saturates there, the last page this listing can reach.
7551
+ * @description Number of pages at this pageSize, bounded by the server ceiling — a lower bound when totalCapped is true.
7218
7552
  * @example 1
7219
7553
  */
7220
7554
  totalPages?: number | null;
7555
+ /**
7556
+ * @description Cursor for the next page, minted from the last row of an over-fetched
7557
+ * page: this listing is one ordered read, so a page shorter than
7558
+ * `pageSize` proves the walk is exhausted and this is empty.
7559
+ */
7560
+ nextPageToken?: string | null;
7561
+ /**
7562
+ * @description True when more than the server ceiling of payments matched, so the count stopped at the ceiling and total/totalPages are a lower bound.
7563
+ * @example false
7564
+ */
7565
+ totalCapped?: boolean | null;
7221
7566
  };
7222
7567
  ListLeadTraderClosedTradesResponse: {
7223
7568
  closedTrades?: components["schemas"]["ClosedTrade"][] | null;
@@ -7237,22 +7582,37 @@ export interface components {
7237
7582
  ListManagedMarketAssignmentsResponse: {
7238
7583
  /** @description Expected assignments, including phases currently unable to quote. */
7239
7584
  items?: components["schemas"]["ManagedMarketAssignment"][] | null;
7240
- /** Format: uint32 */
7585
+ /**
7586
+ * Format: uint32
7587
+ * @description Exact: a maker's assignment inventory is a small bounded set.
7588
+ */
7241
7589
  total?: number | null;
7242
7590
  /** Format: uint32 */
7243
- page?: number | null;
7244
- /** Format: uint32 */
7245
7591
  pageSize?: number | null;
7246
7592
  inventoryObservedAt?: string | null;
7593
+ /**
7594
+ * @description Cursor for the next page, minted from the last row of an over-fetched
7595
+ * page: this listing is one ordered read, so a page shorter than
7596
+ * `page_size` proves the walk is exhausted and this is empty.
7597
+ */
7598
+ nextPageToken?: string | null;
7247
7599
  };
7248
7600
  ListMarginAccountsResponse: {
7249
7601
  accounts?: components["schemas"]["MarginAccountSummary"][] | null;
7250
- /** Format: uint32 */
7602
+ /**
7603
+ * Format: uint32
7604
+ * @description Exact: a user's margin accounts and risk buckets are a small bounded set,
7605
+ * counted in memory after the repricing pass.
7606
+ */
7251
7607
  total?: number | null;
7252
7608
  /** Format: uint32 */
7253
- page?: number | null;
7254
- /** Format: uint32 */
7255
7609
  pageSize?: number | null;
7610
+ /**
7611
+ * @description Cursor for the next page, minted from the last row of an over-fetched
7612
+ * page. The whole set is already in memory, so over-fetching is free and an
7613
+ * empty token is the definitive end of the walk.
7614
+ */
7615
+ nextPageToken?: string | null;
7256
7616
  };
7257
7617
  ListMyFollowersResponse: {
7258
7618
  followers?: components["schemas"]["Follower"][] | null;
@@ -7307,12 +7667,6 @@ export interface components {
7307
7667
  * @example 3
7308
7668
  */
7309
7669
  total?: number | null;
7310
- /**
7311
- * Format: uint32
7312
- * @description Current page number
7313
- * @example 1
7314
- */
7315
- page?: number | null;
7316
7670
  /**
7317
7671
  * Format: uint32
7318
7672
  * @description Items per page
@@ -7325,32 +7679,47 @@ export interface components {
7325
7679
  * @example 1
7326
7680
  */
7327
7681
  totalPages?: number | null;
7682
+ /**
7683
+ * @description Cursor for the next page, minted from the last row of an over-fetched
7684
+ * page: this listing is one ordered read, so a page shorter than
7685
+ * `page_size` proves the walk is exhausted and this is empty.
7686
+ */
7687
+ nextPageToken?: string | null;
7328
7688
  };
7329
7689
  ListPositionHistoryResponse: {
7330
7690
  events?: components["schemas"]["PositionHistoryEvent"][] | null;
7331
- /**
7332
- * Format: uint32
7333
- * @description Matching position-history events. Exact up to 10,000 pages of the requested page size (page_size x 10,000 rows) and saturates there, so a caller with more history than the listing can page through reads the cap, not its lifetime total.
7334
- * @example 150
7335
- */
7336
- total?: number | null;
7337
- /** Format: uint32 */
7338
- page?: number | null;
7339
7691
  /** Format: uint32 */
7340
7692
  pageSize?: number | null;
7693
+ /**
7694
+ * @description Cursor for the next page, minted from the last row of an over-fetched
7695
+ * page: this listing is one SQL statement with one global ORDER BY, so a
7696
+ * page shorter than `pageSize` proves the walk is exhausted and this is
7697
+ * empty. A non-empty token always has at least one further row behind it.
7698
+ */
7699
+ nextPageToken?: string | null;
7341
7700
  };
7342
7701
  ListPositionsResponse: {
7343
7702
  positions?: components["schemas"]["Position"][] | null;
7344
7703
  /**
7345
7704
  * Format: uint32
7346
- * @description Matching positions. Exact up to 10,000 pages of the requested page size (page_size x 10,000 rows) and saturates there, so a caller with more matching positions than the listing can page through reads the cap, not its lifetime total.
7705
+ * @description Number of positions matching the filter, bounded by the server ceiling — a lower bound when totalCapped is true.
7347
7706
  * @example 150
7348
7707
  */
7349
7708
  total?: number | null;
7350
7709
  /** Format: uint32 */
7351
- page?: number | null;
7352
- /** Format: uint32 */
7353
7710
  pageSize?: number | null;
7711
+ /**
7712
+ * @description Cursor for the next page, minted from the last row of an over-fetched
7713
+ * page: this listing is one SQL statement with one global ORDER BY, so a
7714
+ * page shorter than `pageSize` proves the walk is exhausted and this is
7715
+ * empty. A non-empty token always has at least one further row behind it.
7716
+ */
7717
+ nextPageToken?: string | null;
7718
+ /**
7719
+ * @description True when more than the server ceiling of positions matched, so the count stopped at the ceiling and total is a lower bound. False when total is exact, including exactly the ceiling.
7720
+ * @example false
7721
+ */
7722
+ totalCapped?: boolean | null;
7354
7723
  };
7355
7724
  ListSubAccountsResponse: {
7356
7725
  subAccounts?: components["schemas"]["SubAccount"][] | null;
@@ -7461,7 +7830,6 @@ export interface components {
7461
7830
  MarginAccountSummary: {
7462
7831
  /** @description Parent margin account UUID. */
7463
7832
  marginAccountId?: string | null;
7464
- accountState?: string | null;
7465
7833
  equity?: string | null;
7466
7834
  initialMarginRequired?: string | null;
7467
7835
  maintenanceMarginRequired?: string | null;
@@ -7470,23 +7838,26 @@ export interface components {
7470
7838
  * @description The largest amount a transfer-out of this scope will actually accept.
7471
7839
  *
7472
7840
  * NOT a clamped `free_collateral`. Free collateral is equity headroom, and
7473
- * equity includes realized PnL, accrued funding and mark-to-market gains
7474
- * that are not principal a transfer can move — so the two can differ
7475
- * without limit. An unrealized gain never counts toward this figure.
7841
+ * equity includes mark-to-market gains that a transfer cannot move — so
7842
+ * the two can differ without limit. An unrealized gain never counts toward
7843
+ * this figure.
7476
7844
  *
7477
- * For a risk bucket this is capped by the bucket's allocated collateral;
7478
- * for a parent margin account, by deposited collateral that no risk bucket
7479
- * has earmarked.
7845
+ * For a risk bucket this is the bucket's allocated collateral plus its
7846
+ * realized PnL, less what its positions and resting orders require (the
7847
+ * bucket's allocation may go negative, which is how realized profit leaves
7848
+ * a live bucket); for a parent margin account, net deposits plus settled
7849
+ * realized PnL that no risk bucket has allocated.
7480
7850
  *
7481
- * This is the largest accepted transfer-out, NOT a promise that every
7482
- * smaller one is accepted. Acceptance is not monotone in the amount: a risk
7483
- * bucket whose realized loss exceeds its remaining value accepts the full
7484
- * close-out reported here — which settles that loss to the parent margin
7485
- * account — while refusing a partial withdrawal that would leave the bucket
7486
- * holding less collateral than the loss it has already taken. For such a
7487
- * bucket the accepted amounts are everything up to its equity, plus this
7488
- * figure itself, with a gap in between. Size a transfer directly from this
7489
- * field rather than shaving a margin off it.
7851
+ * This is the largest accepted transfer-out, and every smaller amount is
7852
+ * accepted too. It is zero on a risk bucket that is not `NORMAL` (under
7853
+ * liquidation or frozen as bad debt), whose allocation cannot be released,
7854
+ * and on a risk bucket whose realized loss has used up its allocation: that
7855
+ * bucket cannot be released at all, and the parent margin account is
7856
+ * charged at most its allocation, the loss past it being the insurance
7857
+ * fund's.
7858
+ *
7859
+ * Printed truncated toward zero at the quote asset's precision, so the
7860
+ * printed amount itself is always accepted.
7490
7861
  */
7491
7862
  withdrawableCollateral?: string | null;
7492
7863
  totalPositionNotional?: string | null;
@@ -7542,7 +7913,8 @@ export interface components {
7542
7913
  *
7543
7914
  * Present only on risk-bucket summary rows served from a live risk engine
7544
7915
  * snapshot; absent on parent rows and on persisted-fallback reads, where
7545
- * neither of the gate's terms is reconstructable.
7916
+ * neither of the gate's terms is reconstructable. Printed truncated toward
7917
+ * zero at the quote asset's precision, like `withdrawable_collateral`.
7546
7918
  */
7547
7919
  availableOrderCollateral?: string | null;
7548
7920
  /**
@@ -7552,6 +7924,22 @@ export interface components {
7552
7924
  copyFollowId?: string | null;
7553
7925
  /** @description On a copy risk bucket row, the followed leader's custom TraderCode handle, when they still hold one */
7554
7926
  copyLeaderHandle?: string | null;
7927
+ /**
7928
+ * @description The risk bucket's lifecycle state. Present only for risk-bucket rows;
7929
+ * a parent margin account has no lifecycle of its own. Values: NORMAL,
7930
+ * PENDING_LIQUIDATION, LIQUIDATING, BAD_DEBT, CLOSED.
7931
+ */
7932
+ riskBucketState?: string | null;
7933
+ /**
7934
+ * @description The margin account's sub-account key; `default` is the default margin
7935
+ * account.
7936
+ */
7937
+ subaccountKey?: string | null;
7938
+ /**
7939
+ * @description The margin account's state. Values: ACTIVE, CLOSED (a closed
7940
+ * sub-account).
7941
+ */
7942
+ marginAccountState?: string | null;
7555
7943
  };
7556
7944
  MatchResult: {
7557
7945
  /**
@@ -7872,6 +8260,17 @@ export interface components {
7872
8260
  */
7873
8261
  positions?: string | null;
7874
8262
  };
8263
+ /** @description One of the caller's open margin accounts in the owner rollup. */
8264
+ PortfolioMarginAccount: {
8265
+ marginAccountId?: string | null;
8266
+ /** @description `default` for the default margin account, else the sub-account's key. */
8267
+ subaccountKey?: string | null;
8268
+ /**
8269
+ * @description The account's totals. `withdrawable_collateral` here is the persisted
8270
+ * reconstruction of the engine's bound.
8271
+ */
8272
+ total?: components["schemas"]["PortfolioMarginTotal"] | null;
8273
+ };
7875
8274
  PortfolioMarginPositionCounts: {
7876
8275
  total?: string | null;
7877
8276
  cross?: string | null;
@@ -7889,21 +8288,19 @@ export interface components {
7889
8288
  * the bound the engine enforces on transfers-out and withdrawals, and
7890
8289
  * therefore also the effective ceiling on funding new isolated or
7891
8290
  * first-use order capacity, because allocating collateral to a risk
7892
- * bucket passes through the same principal-gated door.
8291
+ * bucket passes through the same capacity-gated door.
7893
8292
  *
7894
8293
  * NOT a clamped `parent_available_collateral`. That field is
7895
- * `free_collateral`, an equity figure: it credits settled realized PnL,
7896
- * accrued funding, and mark-to-market gains that a transfer-out cannot
7897
- * move, so the two can differ without limit. This bound never credits an
7898
- * unrealized gain. Under the default capacity basis it also excludes
7899
- * non-principal balances such as banked realized PnL:
7900
- * `min(deposited principal - bucket allocations,
7901
- * free_collateral - max(unrealized_pnl, 0))`, floored at zero. Whatever
7902
- * the engine's configured capacity basis, this is the bound its gates
7903
- * actually enforce. It agrees with
7904
- * `MarginAccountSummary.withdrawable_collateral` up to quote-decimal
7905
- * truncation: this surface truncates toward zero at the quote asset's
7906
- * precision, while the margin-accounts surface may carry sub-tick tails.
8294
+ * `free_collateral`, an equity figure: it credits mark-to-market gains
8295
+ * and realized PnL still held in open risk buckets, which a transfer-out
8296
+ * of the parent cannot move, so the two can differ without limit. This bound never credits an
8297
+ * unrealized gain. It counts net deposits plus the account's settled
8298
+ * realized PnL and funding, less what risk buckets have allocated:
8299
+ * `min(net deposits + settled realized PnL - bucket allocations,
8300
+ * free_collateral - max(unrealized_pnl, 0))`, floored at zero. This is the
8301
+ * bound the engine's gates actually enforce. The same figure as
8302
+ * `MarginAccountSummary.withdrawable_collateral`: both surfaces truncate it
8303
+ * toward zero at the quote asset's precision.
7907
8304
  *
7908
8305
  * Size transfers-out, withdrawals, and new isolated/first-use positions
7909
8306
  * from this field; `parent_available_collateral` remains the trading-margin
@@ -7954,17 +8351,16 @@ export interface components {
7954
8351
  * accept — the bound enforced on bucket collateral withdrawals.
7955
8352
  *
7956
8353
  * NOT a clamped `free_collateral`: free collateral is equity headroom and
7957
- * credits realized PnL and mark-to-market gains that a transfer-out cannot
7958
- * move. This bound is capped by the bucket's settled capacity (its
7959
- * allocated collateral, under the default capacity basis), and an
7960
- * unrealized gain never raises it.
8354
+ * credits mark-to-market gains that a transfer-out cannot move. This bound
8355
+ * is the bucket's allocated collateral plus its realized PnL, less funding
8356
+ * paid, unrealized losses and the margin its positions and resting orders
8357
+ * require. Realized profit can leave a live bucket this way (the bucket's
8358
+ * allocation may go negative); an unrealized gain never raises it.
7961
8359
  *
7962
- * This is the largest accepted transfer-out, NOT a promise that every
7963
- * smaller one is accepted: an underwater flat bucket accepts its full
7964
- * close-out while refusing partial withdrawals below it. Agrees with the
7965
- * risk-bucket rows' `MarginAccountSummary.withdrawable_collateral` up to
7966
- * quote-decimal truncation (this surface truncates toward zero; that one
7967
- * may carry sub-tick tails).
8360
+ * This is the largest accepted transfer-out, and every smaller amount is
8361
+ * accepted too. It is zero on a risk bucket that is not `NORMAL` and on one
8362
+ * whose realized loss has used up its allocation. The same figure as the
8363
+ * risk-bucket rows' `MarginAccountSummary.withdrawable_collateral`.
7968
8364
  */
7969
8365
  withdrawableCollateral?: string | null;
7970
8366
  /**
@@ -8211,10 +8607,38 @@ export interface components {
8211
8607
  cumFees?: string | null;
8212
8608
  /**
8213
8609
  * Format: int64
8214
- * @description Opaque, non-negative producer-owned version for this position row. Compare only within the same position; higher is newer. 0 is the unranked legacy sentinel and never participates in ordering: it means the row predates this field or came from a producer that does not stamp it, so treat it exactly as an absent version and fall back to a full field comparison rather than ranking it as oldest. It advances on sequenced position mutations (open, add, reduce, close, funding, margin transfer, liquidation, ADL) and is shared by the persisted read, the WebSocket positions snapshot and a RANKED live position_update frame. Ranked live frames include fills that leave a position open, direct isolated-position margin adds/reductions, and copy-position margin adds; the copy add refreshes its isolated child and copy-cross siblings at the same version. Cross-risk-bucket ALLOCATE/RELEASE and copy follow/stop refreshes use margin_added/margin_reduced but omit the version because those commands write no position rows. Funding omits it because it re-reads live state after sequencing; terminal frames omit it because they report size 0 and sometimes LIQUIDATED while the stored row keeps its size and records CLOSED. Wallet IN/OUT and plain isolated allocation send no position frame. Transfer frames use captured post-command state and are released only after durable acknowledgement. mark_price, unrealized_pnl, liquidation_price, leverage, maintenance_margin_required and initial_margin_required are UNVERSIONED valuation fields, re-derived per payload rather than served from the versioned row: the version does not advance for them (five move with the oracle mark; leverage does not, being opening notional over posted margin, but the live surfaces derive it while the persisted row serves its stored column, so it can still disagree at an unchanged version) (a valuation-only oracle tick persists nothing; a state-transitioning one, a breach or recovery, persists the account's snapshot and restamps the positions it changed), so the merge rule is per field group — on an equal version skip the versioned fields but still take all six from the newer payload, because discarding a whole payload on an equal version freezes displayed PnL and can leave a stale margin requirement on screen. isolated_margin is the one exception among the versioned fields: the WebSocket positions snapshot overlays it from an independent live matching-engine read rather than the versioned row, so take it from the newest payload on an equal version too or a consumer can retain stale backing. The version advances exactly when the row's versioned content changed at that sequence, a change undone within one persistence batch included; a position a command left unchanged keeps its version, so a RANKED live frame for an untouched sibling of a filled position can carry a higher version than the persisted row while describing identical content — rank it as newer, and nothing changes. A response served from live matching-engine state reports 0 (unranked): the engine holds the state but not the version.
8610
+ * @description Opaque, non-negative producer-owned version for this position row. Compare only within the same position; higher is newer. 0 is the unranked legacy sentinel and never participates in ordering: it means the row predates this field or came from a producer that does not stamp it, so treat it exactly as an absent version and fall back to a full field comparison rather than ranking it as oldest. It advances on sequenced position mutations (open, add, reduce, close, funding, margin transfer, liquidation, ADL) and is shared by the persisted read, the WebSocket positions snapshot and a RANKED live position_update frame. Ranked live frames include fills, non-zero funding settlements, terminal closes/liquidations/ADL, direct isolated-position margin adds/reductions, and copy-position margin adds; each uses captured post-command state, and terminal frames retain the stored size and exact CLOSED/LIQUIDATED classification. After restart, a terminal frame rebuilt from legacy reduction history omits the version when that history lacks the margin fields needed to reconstruct complete lifetime allocated margin. Cross-risk-bucket ALLOCATE/RELEASE and copy follow/stop refreshes use margin_added/margin_reduced but omit the version because those commands write no position rows. Wallet IN/OUT and plain isolated allocation send no position frame. Transfer and funding frames use captured post-command state and are released only after durable acknowledgement. mark_price, unrealized_pnl, liquidation_price, leverage, maintenance_margin_required and initial_margin_required are UNVERSIONED valuation fields, re-derived per payload rather than served from the versioned row: the version does not advance for them (five move with the oracle mark; leverage does not, being opening notional over posted margin, but the live surfaces derive it while the persisted row serves its stored column, so it can still disagree at an unchanged version) (a valuation-only oracle tick persists nothing; a state-transitioning one, a breach or recovery, persists the account's snapshot and restamps the positions it changed), so the merge rule is per field group — on an equal version skip the versioned fields but still take all six from the newer payload, because discarding a whole payload on an equal version freezes displayed PnL and can leave a stale margin requirement on screen. isolated_margin is the one exception among the versioned fields: the WebSocket positions snapshot overlays it from an independent live matching-engine read rather than the versioned row, so take it from the newest payload on an equal version too or a consumer can retain stale backing. The version advances exactly when the row's versioned content changed at that sequence, a change undone within one persistence batch included; a position a command left unchanged keeps its version, so a RANKED live frame for an untouched sibling of a filled position can carry a higher version than the persisted row while describing identical content — rank it as newer, and nothing changes. A response served from live matching-engine state reports 0 (unranked): the engine holds the state but not the version.
8215
8611
  * @example 918342
8216
8612
  */
8217
8613
  version?: number | null;
8614
+ /**
8615
+ * @description RFC 3339 instant at which this position OPENED: the fill that took its
8616
+ * exposure from zero to non-zero. Time held is now minus opened_at for an
8617
+ * OPEN position, and updated_at minus opened_at for a terminal one. It never
8618
+ * changes for the life of the position id; a flip closes the position and
8619
+ * opens a new one, with a new id and its own opened_at.
8620
+ *
8621
+ * Served from the matching engine's record of the opening fill while the
8622
+ * engine holds the position, and from the persisted row otherwise. The row
8623
+ * is written from the same fill's durable stamp, which comes from the
8624
+ * sequencer's non-decreasing stamp clock rather than the engine's wall
8625
+ * clock. The two readings normally agree to within one sequencer step, but
8626
+ * while the stamp clock is held ahead of a lagging host clock they differ by
8627
+ * that lead (`matching_engine_stamp_clock_live_lead_ms`), so a position's
8628
+ * value can move by it when the engine restarts and re-reads the row. Clamp
8629
+ * a computed time held at zero.
8630
+ *
8631
+ * Absent when the opening instant is unknown, never filled with the read
8632
+ * instant. Positions opened before this field existed carry the persisted
8633
+ * row's value, which can trail the opening fill by the persistence lag
8634
+ * where the fill could not be recovered.
8635
+ *
8636
+ * Not versioned, and not guaranteed constant at a given `version`: a
8637
+ * one-off operator correction can move it earlier without advancing the
8638
+ * version. Take it from the newest payload rather than skipping it on an
8639
+ * equal version.
8640
+ */
8641
+ openedAt?: string | null;
8218
8642
  };
8219
8643
  PositionHistoryEvent: {
8220
8644
  id?: string | null;
@@ -8524,7 +8948,7 @@ export interface components {
8524
8948
  source?: string | null;
8525
8949
  /**
8526
8950
  * Format: int32
8527
- * @description Referral level the caller earns from this source at: 1 (direct), 2, or 3.
8951
+ * @description Referral level the caller earns from this source at: 1 (direct), 2, and so on (at most 10). Rows at a level deeper than PitPass rewards today are earlier earnings, kept as history.
8528
8952
  * @example 1
8529
8953
  */
8530
8954
  level?: number | null;
@@ -8557,6 +8981,10 @@ export interface components {
8557
8981
  * ever pays in more than one reward token, atomic units across tokens are not
8558
8982
  * additive, so read the per-token `earnings_by_source` rows for a correct
8559
8983
  * breakdown.
8984
+ *
8985
+ * `by_level` covers every level with earnings. `level1_earned`,
8986
+ * `level2_earned` and `level3_earned` are deprecated: they carry levels 1 to 3
8987
+ * for older clients and say nothing about deeper levels.
8560
8988
  */
8561
8989
  ReferralEarningsSummary: {
8562
8990
  /**
@@ -8565,20 +8993,25 @@ export interface components {
8565
8993
  */
8566
8994
  totalEarned?: string | null;
8567
8995
  /**
8568
- * @description Total earned from direct (L1) referees, in RAW atomic units.
8996
+ * @deprecated
8997
+ * @description DEPRECATED: use `byLevel`. Total earned from direct (L1) referees, in RAW atomic units.
8569
8998
  * @example 900000
8570
8999
  */
8571
9000
  level1Earned?: string | null;
8572
9001
  /**
8573
- * @description Total earned from L2 downline, in RAW atomic units.
9002
+ * @deprecated
9003
+ * @description DEPRECATED: use `byLevel`. Total earned from L2 downline, in RAW atomic units.
8574
9004
  * @example 400000
8575
9005
  */
8576
9006
  level2Earned?: string | null;
8577
9007
  /**
8578
- * @description Total earned from L3 downline, in RAW atomic units.
9008
+ * @deprecated
9009
+ * @description DEPRECATED: use `byLevel`. Total earned from L3 downline, in RAW atomic units.
8579
9010
  * @example 100000
8580
9011
  */
8581
9012
  level3Earned?: string | null;
9013
+ /** @description All-time credited earnings per referral level, ascending by level, one entry per level the caller has earned at (levels with nothing earned are omitted). Covers every level, including levels deeper than PitPass rewards today. */
9014
+ byLevel?: components["schemas"]["LevelEarnings"][] | null;
8582
9015
  };
8583
9016
  /** @description A single reward the caller has earned, one row per referred trade × level. */
8584
9017
  ReferralRewardEntry: {
@@ -8589,7 +9022,7 @@ export interface components {
8589
9022
  source?: string | null;
8590
9023
  /**
8591
9024
  * Format: int32
8592
- * @description Referral level this reward was paid at: 1 (direct, 30%), 2 (15%), or 3 (5%).
9025
+ * @description Referral level this reward was paid at: 1 for the direct referrer, 2 for the referrer's referrer, and so on (at most 10).
8593
9026
  * @example 1
8594
9027
  */
8595
9028
  level?: number | null;
@@ -8619,6 +9052,50 @@ export interface components {
8619
9052
  */
8620
9053
  sourceDisplay?: string | null;
8621
9054
  };
9055
+ /** @description One wallet in the caller's referral tree. */
9056
+ ReferralTreeNode: {
9057
+ /**
9058
+ * @description Public wallet address of this referee. Never an internal id.
9059
+ * @example 0x0000000000000000000000000000000000000004
9060
+ */
9061
+ wallet?: string | null;
9062
+ /** @description Human-facing name for this referee: their custom TraderCode handle when they have claimed one, otherwise the wallet address (same as `wallet`). Render this instead of raw hex. */
9063
+ display?: string | null;
9064
+ /**
9065
+ * Format: int32
9066
+ * @description Depth below the caller: 1 (the caller referred this wallet), 2, and so on up to the configured reward depth (at most 10).
9067
+ */
9068
+ level?: number | null;
9069
+ /** @description Wallet address of the referrer of this node — the caller for a level-1 node. */
9070
+ parent?: string | null;
9071
+ /**
9072
+ * Format: date-time
9073
+ * @description RFC 3339 time this wallet signed up under its parent.
9074
+ */
9075
+ referredAt?: string | null;
9076
+ /**
9077
+ * Format: uint32
9078
+ * @description How many wallets this node has referred. Expand the node (request it as `parent`) when this is above 0. Always 0 at the deepest rewarded level, the deepest level shown.
9079
+ */
9080
+ refereeCount?: number | null;
9081
+ /** @description What the caller has earned from this wallet's own trades, across every token, in RAW atomic units. `0` for a wallet that has not traded yet. */
9082
+ totalEarned?: string | null;
9083
+ };
9084
+ /** @description One ancestor in the caller's referral chain. */
9085
+ ReferralUplineEntry: {
9086
+ /**
9087
+ * @description Public wallet address of the ancestor. Never an internal id.
9088
+ * @example 0x0000000000000000000000000000000000000002
9089
+ */
9090
+ wallet?: string | null;
9091
+ /** @description Human-facing name for the ancestor: their custom TraderCode handle when they have claimed one, otherwise the wallet address (same as `wallet`). Render this instead of raw hex. */
9092
+ display?: string | null;
9093
+ /**
9094
+ * Format: int32
9095
+ * @description How far above the caller this ancestor is: 1 (the caller's direct referrer), 2, and so on up to the configured reward depth (at most 10).
9096
+ */
9097
+ level?: number | null;
9098
+ };
8622
9099
  RefreshManagedMarketQuotesRequest: {
8623
9100
  launchId?: string | null;
8624
9101
  ownerId?: string | null;
@@ -8764,11 +9241,14 @@ export interface components {
8764
9241
  */
8765
9242
  maintenanceMarginRatio?: string | null;
8766
9243
  /**
8767
- * @deprecated
8768
- * @description DEPRECATED compatibility alias. This value is a maximum absolute base-asset quantity, not a notional. Use maxPositionSize.
9244
+ * @description The most USD notional a position may hold at this bracket's max leverage: the next bracket's lowerBoundNotional, or the market's position cap on the top bracket. A position is valued at the order's price. Below the top bracket the cap is exclusive, since a notional at the next bound already sits in the next bracket. An order at a given leverage may take its position up to the cap of the highest bracket whose maxLeverage allows that leverage.
9245
+ * @example 100000000
8769
9246
  */
8770
9247
  maxPositionNotional?: string | null;
8771
- /** @description Maximum authoritative absolute position size in base-asset quantity. A market-wide cap, repeated on every tier rather than varying per bracket. */
9248
+ /**
9249
+ * @deprecated
9250
+ * @description DEPRECATED and no longer set: positions are capped in notional per bracket. Use maxPositionNotional.
9251
+ */
8772
9252
  maxPositionSize?: string | null;
8773
9253
  /**
8774
9254
  * Format: uint32
@@ -9278,6 +9758,12 @@ export interface components {
9278
9758
  * @description MARKET only: client slippage tolerance in basis points, 0..1000, the same rule placement enforces — a LIMIT or IOC preview carrying it is rejected. Tightens the previewed walk to the band the real order will run under and never widens it; omit for the placement default.
9279
9759
  */
9280
9760
  slippageToleranceBps?: number | null;
9761
+ /**
9762
+ * @description The margin account the preview runs against: the default margin account
9763
+ * (the default) or any of the caller's open sub-accounts, previewing that
9764
+ * account's own risk buckets.
9765
+ */
9766
+ marginAccountId?: string | null;
9281
9767
  };
9282
9768
  StopFollowResponse: {
9283
9769
  /**
@@ -9676,6 +10162,11 @@ export interface components {
9676
10162
  * @example USDC
9677
10163
  */
9678
10164
  quoteAssetName?: string | null;
10165
+ /**
10166
+ * @description Isolated-only market: cross margin may only reduce a position here. An order from a CROSS risk bucket that is not reduce-only is rejected with the error code CROSS_MARGIN_NOT_ALLOWED; open the position with margin_mode ISOLATED instead
10167
+ * @example false
10168
+ */
10169
+ isolatedOnly?: boolean | null;
9679
10170
  };
9680
10171
  /**
9681
10172
  * @description Trailing stop leg (0XM-2827). Reduce-only MARKET close whose trigger trails
@@ -9744,7 +10235,8 @@ export interface components {
9744
10235
  /**
9745
10236
  * @description The largest amount a further transfer-out will accept after this one.
9746
10237
  * See `MarginAccountSummary.withdrawable_collateral`: this is an
9747
- * allocation-bounded figure, not clamped equity headroom.
10238
+ * allocation-bounded figure, not clamped equity headroom. Truncated toward
10239
+ * zero at the collateral asset's precision.
9748
10240
  */
9749
10241
  newWithdrawableCollateral?: string | null;
9750
10242
  strategyKey?: string | null;
@@ -9753,6 +10245,30 @@ export interface components {
9753
10245
  asset?: string | null;
9754
10246
  amount?: string | null;
9755
10247
  };
10248
+ TransferCollateralFromSubAccountRequest: {
10249
+ /** @description The caller's sub-account the collateral leaves. */
10250
+ marginAccountId?: string | null;
10251
+ amount?: string | null;
10252
+ };
10253
+ TransferCollateralRequest: {
10254
+ /** @description Collateral asset symbol or address. */
10255
+ asset?: string | null;
10256
+ amount?: string | null;
10257
+ /** @description Where the collateral comes from. */
10258
+ from?: components["schemas"]["CollateralTransferEndpoint"] | null;
10259
+ /** @description Where the collateral goes. */
10260
+ to?: components["schemas"]["CollateralTransferEndpoint"] | null;
10261
+ };
10262
+ TransferCollateralResponse: {
10263
+ movementId?: string | null;
10264
+ amount?: string | null;
10265
+ /** @description The source margin account, when the source is one. */
10266
+ fromMarginAccountId?: string | null;
10267
+ /** @description The destination margin account, when the destination is one. */
10268
+ toMarginAccountId?: string | null;
10269
+ /** @description The destination risk bucket, when the destination is one. */
10270
+ toRiskBucketId?: string | null;
10271
+ };
9756
10272
  TransferCollateralToMarginAccountRequest: {
9757
10273
  /** @description Parent margin account UUID that receives collateral. */
9758
10274
  marginAccountId?: string | null;
@@ -9779,7 +10295,8 @@ export interface components {
9779
10295
  /**
9780
10296
  * @description The largest amount a further transfer-out will accept after this one.
9781
10297
  * See `MarginAccountSummary.withdrawable_collateral`: this is an
9782
- * allocation-bounded figure, not clamped equity headroom.
10298
+ * allocation-bounded figure, not clamped equity headroom. Truncated toward
10299
+ * zero at the collateral asset's precision.
9783
10300
  */
9784
10301
  newWithdrawableCollateral?: string | null;
9785
10302
  strategyKey?: string | null;
@@ -9857,6 +10374,18 @@ export interface components {
9857
10374
  * row is stale (close/reopen race).
9858
10375
  */
9859
10376
  applyToPositionMargin?: boolean | null;
10377
+ /**
10378
+ * @description The margin account whose risk bucket is funded: the default margin
10379
+ * account (the default) or any of the caller's open sub-accounts, which
10380
+ * fund their own risk buckets from their own collateral. A copy-trading
10381
+ * sub-account's buckets belong to its follow and are refused.
10382
+ */
10383
+ marginAccountId?: string | null;
10384
+ };
10385
+ TransferCollateralToSubAccountRequest: {
10386
+ /** @description The caller's sub-account that receives the collateral. */
10387
+ marginAccountId?: string | null;
10388
+ amount?: string | null;
9860
10389
  };
9861
10390
  TransferRewardsRequest: {
9862
10391
  /**
@@ -10147,21 +10676,21 @@ export interface components {
10147
10676
  */
10148
10677
  name?: string | null;
10149
10678
  /**
10150
- * @description Optional delegation expiry timestamp (ISO 8601). Ends delegated reads, trading, and session refresh. Omit for no delegation expiry; session expiry still applies.
10679
+ * @description Delegation expiry timestamp (ISO 8601). Ends delegated reads, trading, and session refresh. Omit for the default of 14 days from now; at most 180 days ahead.
10151
10680
  * @example 2026-12-31T23:59:59Z
10152
10681
  */
10153
10682
  expiresAt?: string | null;
10154
10683
  /**
10155
- * @description Required JSON array of actions the agent may perform: CREATE_ORDER, CANCEL_ORDER, REPLACE_ORDER. An empty array permits no actions.
10684
+ * @description Required JSON array of actions the agent may perform: CREATE_ORDER, CANCEL_ORDER, REPLACE_ORDER, READ, MANAGE_RISK_BUCKETS. Every delegated session may read the owner's data; a policy listing only READ, or no action, is a read-only key. MANAGE_RISK_BUCKETS lets the agent move a margin account's free collateral into that account's own risk buckets (POST /api/v1/margin/risk-buckets/collateral/transfer-in), only for an account listed in allowedMarginAccountIds and, if the policy lists markets, only into an isolated risk bucket on a listed market. No action lets an agent move collateral any other way. Any other value is rejected.
10156
10685
  * @example [
10157
10686
  * "CREATE_ORDER",
10158
10687
  * "CANCEL_ORDER"
10159
10688
  * ]
10160
10689
  */
10161
10690
  allowedActions: string[];
10162
- /** @description Required JSON array of trading pair UUIDs. An order is allowed if its market or its margin account is permitted. Send [] for account-only scope; both scopes empty permit no orders. */
10691
+ /** @description Required JSON array of trading pair UUIDs. Each listed scope must match: with markets and margin accounts both listed, an order needs a listed market AND a listed account. Send [] for account-only scope; both scopes empty permit no orders. */
10163
10692
  allowedTradingPairIds: string[];
10164
- /** @description Optional JSON array of additional margin account UUIDs. Omitted, null, or [] adds no account scope; it does not grant access to every account. An order is allowed if its market or its margin account is permitted. */
10693
+ /** @description Optional JSON array of margin account UUIDs the agent is bound to. When listed, an order must be on one of these accounts (and on a listed market, if any are listed). Omitted, null, or [] leaves the account unrestricted; both scopes empty permit no orders. */
10165
10694
  allowedMarginAccountIds?: string[] | null;
10166
10695
  /**
10167
10696
  * @description Optional JSON array of permitted order types (LIMIT, MARKET). Omitted, null, or [] means unrestricted order types.
@@ -10192,6 +10721,13 @@ export interface components {
10192
10721
  * @description Unsupported legacy field. Requests that set maxOpenOrders are rejected; no concurrent open-order cap is enforced. Omit this field.
10193
10722
  */
10194
10723
  maxOpenOrders?: number | null;
10724
+ /**
10725
+ * @description Optional JSON array of up to 20 IP addresses or CIDR ranges the agent may create its delegated session from. Omitted, null, or [] allows any address.
10726
+ * @example [
10727
+ * "203.0.113.0/24"
10728
+ * ]
10729
+ */
10730
+ ipAllowlist?: string[] | null;
10195
10731
  };
10196
10732
  UpsertFollowRequest: {
10197
10733
  /**
@@ -10414,10 +10950,26 @@ export interface operations {
10414
10950
  get_user_balances: {
10415
10951
  parameters: {
10416
10952
  query?: {
10417
- /** @description Page number (1-indexed) */
10418
- page?: number;
10419
- /** @description Items per page (max 100) */
10953
+ /** @description Items per page (max 1000) */
10420
10954
  pageSize?: number;
10955
+ /**
10956
+ * @description Pagination cursor with two states:
10957
+ * - Omitted or empty string (""): start a cursor walk with no prior
10958
+ * position, from the lowest token address.
10959
+ * - Non-empty: an opaque cursor from a previous response's
10960
+ * `nextPageToken`; results resume immediately after that position.
10961
+ *
10962
+ * This listing has no database page to walk: it reads every balance row,
10963
+ * overlays the matching engine's authoritative amounts (which can add rows
10964
+ * the projection has not written yet and drop rows the engine has zeroed),
10965
+ * and pages that in-memory set. The walk therefore seeks by KEY on
10966
+ * `(token, asset_id)` — immutable, present on every row including a
10967
+ * live-only one — rather than by index, so a balance that appears or
10968
+ * vanishes mid-walk no longer shifts the rows behind it across the resume
10969
+ * point and duplicate or skipped rows. `total` and `totalPages` are exact:
10970
+ * the set is bounded by the asset universe, so there is nothing to cap.
10971
+ */
10972
+ pageToken?: string;
10421
10973
  };
10422
10974
  header?: never;
10423
10975
  path?: never;
@@ -10529,10 +11081,28 @@ export interface operations {
10529
11081
  tradingPairId?: string;
10530
11082
  positionId?: string;
10531
11083
  marginAccountId?: string;
10532
- /** @description Page number (1-indexed) */
10533
- page?: number;
10534
- /** @description Items per page (max 100) */
11084
+ /** @description Items per page (max 1000) */
10535
11085
  pageSize?: number;
11086
+ /**
11087
+ * @description Pagination cursor with two states:
11088
+ * - Omitted or empty string (""): start a cursor walk with no prior
11089
+ * position, from the newest payment.
11090
+ * - Non-empty: an opaque cursor from a previous response's
11091
+ * `nextPageToken`; results resume immediately after that position.
11092
+ *
11093
+ * The walk seeks on `(created_at, id)` descending. Not `period_end`, which
11094
+ * the removed page-number mode led its sort with: that column is nullable
11095
+ * and the risk engine leaves it unset when a payment carries no window,
11096
+ * while `created_at` is always stamped (it falls back to the settlement
11097
+ * instant). The `id` tie-break is new — the removed order had none, so a
11098
+ * page boundary inside one funding window could already repeat or drop a
11099
+ * payment.
11100
+ *
11101
+ * `total` and `totalPages` are populated — bounded by the server count
11102
+ * ceiling, see `totalCapped`. Filters must match the request that produced
11103
+ * the token, or the request is rejected 400.
11104
+ */
11105
+ pageToken?: string;
10536
11106
  };
10537
11107
  header?: never;
10538
11108
  path?: never;
@@ -10808,7 +11378,19 @@ export interface operations {
10808
11378
  };
10809
11379
  get_portfolio_margin: {
10810
11380
  parameters: {
10811
- query?: never;
11381
+ query?: {
11382
+ /**
11383
+ * @description One of the caller's margin accounts (the default one or a sub-account) to
11384
+ * describe instead of the default one: `total`, `positions` and
11385
+ * `risk_buckets` are then that account's own.
11386
+ */
11387
+ marginAccountId?: string;
11388
+ /**
11389
+ * @description Also return `accounts`, one row per open margin account of the caller,
11390
+ * and `owner_total`, their sum: the owner rollup across sub-accounts.
11391
+ */
11392
+ includeAccounts?: boolean;
11393
+ };
10812
11394
  header?: never;
10813
11395
  path?: never;
10814
11396
  cookie?: never;
@@ -11028,9 +11610,7 @@ export interface operations {
11028
11610
  get_user_movements: {
11029
11611
  parameters: {
11030
11612
  query?: {
11031
- /** @description Page number (1-indexed) */
11032
- page?: number;
11033
- /** @description Items per page (max 100) */
11613
+ /** @description Items per page (max 1000) */
11034
11614
  pageSize?: number;
11035
11615
  /** @description Transaction type */
11036
11616
  transactionType?: "DEPOSIT" | "WITHDRAWAL" | "TRADE" | "FEE" | "FUNDING" | "LIQUIDATION" | "INTEREST" | "REWARD" | "CHAIN_SYNC";
@@ -11040,6 +11620,19 @@ export interface operations {
11040
11620
  assetId?: string;
11041
11621
  /** @description Sort direction for createdAt */
11042
11622
  orderBy?: "ASC" | "DESC";
11623
+ /**
11624
+ * @description Pagination cursor with two states:
11625
+ * - Omitted or empty string (""): start a cursor walk with no prior
11626
+ * position, from the newest row (or the oldest, when `orderBy` is ASC).
11627
+ * - Non-empty: an opaque cursor from a previous response's
11628
+ * `nextPageToken`; results resume immediately after that position.
11629
+ *
11630
+ * Every walk covers the ledger and funding arms merged. `total` and
11631
+ * `totalPages` are populated — bounded by the server count ceiling, see
11632
+ * `totalCapped`. Filters and `orderBy` must match the request that produced
11633
+ * the token, or the request is rejected 400.
11634
+ */
11635
+ pageToken?: string;
11043
11636
  };
11044
11637
  header?: never;
11045
11638
  path?: never;
@@ -11170,6 +11763,13 @@ export interface operations {
11170
11763
  };
11171
11764
  content?: never;
11172
11765
  };
11766
+ /** @description Settings write rate limit exceeded — the lead trader profile, follow create/edit and self-trade-prevention default share a per-account budget (and the budget the account family shares); retry after the interval in details.retryAfter */
11767
+ 429: {
11768
+ headers: {
11769
+ [name: string]: unknown;
11770
+ };
11771
+ content?: never;
11772
+ };
11173
11773
  /** @description Internal server error */
11174
11774
  500: {
11175
11775
  headers: {
@@ -11499,7 +12099,7 @@ export interface operations {
11499
12099
  * - Omitted or empty string (""): start a cursor walk with no prior
11500
12100
  * position, from the newest row.
11501
12101
  * - Non-empty: an opaque cursor from a previous response's
11502
- * `next_page_token`; results resume immediately after that position.
12102
+ * `nextPageToken`; results resume immediately after that position.
11503
12103
  *
11504
12104
  * Every walk covers full trade history — hot and archived rows merged. The
11505
12105
  * response carries no item count: this listing's table is too large to count
@@ -11554,15 +12154,34 @@ export interface operations {
11554
12154
  };
11555
12155
  list_application_balances: {
11556
12156
  parameters: {
11557
- query?: {
11558
- /** @description Page number (1-indexed) */
11559
- page?: number;
11560
- /** @description Items per page (max 100) */
12157
+ query: {
12158
+ /** @description Items per page (max 1000) */
11561
12159
  pageSize?: number;
11562
12160
  /** @description User identifier (UUID) */
11563
12161
  userId?: string;
11564
12162
  /** @description Asset identifier (UUID) */
11565
12163
  assetId?: string;
12164
+ /**
12165
+ * @description Pagination cursor with two states:
12166
+ * - Omitted or empty string (""): start a cursor walk with no prior
12167
+ * position.
12168
+ * - Non-empty: an opaque cursor from a previous response's
12169
+ * `nextPageToken`; results resume immediately after that position.
12170
+ *
12171
+ * Ordered by balance id ascending. NOT by `updated_at`, which the removed
12172
+ * offset mode sorted on: that column changes on every balance movement, so
12173
+ * a walk over it could repeat or skip rows with no concurrent insert at
12174
+ * all.
12175
+ *
12176
+ * `total` and `totalPages` are populated — bounded by the server count
12177
+ * ceiling, see `totalCapped`.
12178
+ *
12179
+ * Filters must match the request that produced the token, or the request
12180
+ * is rejected 400.
12181
+ */
12182
+ pageToken?: string;
12183
+ /** @description Application client ID */
12184
+ clientId: string;
11566
12185
  };
11567
12186
  header?: never;
11568
12187
  path?: never;
@@ -11579,22 +12198,29 @@ export interface operations {
11579
12198
  "application/json": components["schemas"]["ListAppBalancesResponse"];
11580
12199
  };
11581
12200
  };
11582
- /** @description Bad request */
12201
+ /** @description Bad request (missing client_id, invalid filter or page token) */
11583
12202
  400: {
11584
12203
  headers: {
11585
12204
  [name: string]: unknown;
11586
12205
  };
11587
12206
  content?: never;
11588
12207
  };
11589
- /** @description Unauthorized - Invalid or missing x-server-key */
11590
- 401: {
12208
+ /** @description No active application has this client_id */
12209
+ 404: {
11591
12210
  headers: {
11592
12211
  [name: string]: unknown;
11593
12212
  };
11594
12213
  content?: never;
11595
12214
  };
11596
- /** @description Internal server error */
11597
- 500: {
12215
+ /** @description Public read rate limit exceeded for this client IP; retry after the interval in details.retryAfter */
12216
+ 429: {
12217
+ headers: {
12218
+ [name: string]: unknown;
12219
+ };
12220
+ content?: never;
12221
+ };
12222
+ /** @description Internal server error */
12223
+ 500: {
11598
12224
  headers: {
11599
12225
  [name: string]: unknown;
11600
12226
  };
@@ -11659,10 +12285,8 @@ export interface operations {
11659
12285
  };
11660
12286
  list_application_movements: {
11661
12287
  parameters: {
11662
- query?: {
11663
- /** @description Page number (1-indexed) */
11664
- page?: number;
11665
- /** @description Items per page (max 100) */
12288
+ query: {
12289
+ /** @description Items per page (max 1000) */
11666
12290
  pageSize?: number;
11667
12291
  /** @description User identifier (UUID) */
11668
12292
  userId?: string;
@@ -11672,6 +12296,23 @@ export interface operations {
11672
12296
  entryType?: "CREDIT" | "DEBIT" | "LOCK" | "UNLOCK" | "FEE";
11673
12297
  /** @description Asset identifier (UUID) */
11674
12298
  assetId?: string;
12299
+ /**
12300
+ * @description Pagination cursor with two states:
12301
+ * - Omitted or empty string (""): start a cursor walk with no prior
12302
+ * position, from the newest movement.
12303
+ * - Non-empty: an opaque cursor from a previous response's
12304
+ * `nextPageToken`; results resume immediately after that position.
12305
+ *
12306
+ * The response carries no item count: `user_ledger` is too large to count
12307
+ * behind a filter. A movement with no recorded timestamp is not listed —
12308
+ * the column is nullable, and a NULL has no position in the sort key.
12309
+ *
12310
+ * Filters must match the request that produced the token, or the request
12311
+ * is rejected 400.
12312
+ */
12313
+ pageToken?: string;
12314
+ /** @description Application client ID */
12315
+ clientId: string;
11675
12316
  };
11676
12317
  header?: never;
11677
12318
  path?: never;
@@ -11688,15 +12329,22 @@ export interface operations {
11688
12329
  "application/json": components["schemas"]["ListAppMovementsResponse"];
11689
12330
  };
11690
12331
  };
11691
- /** @description Bad request */
12332
+ /** @description Bad request (missing client_id, invalid filter or page token) */
11692
12333
  400: {
11693
12334
  headers: {
11694
12335
  [name: string]: unknown;
11695
12336
  };
11696
12337
  content?: never;
11697
12338
  };
11698
- /** @description Unauthorized - Invalid or missing x-server-key */
11699
- 401: {
12339
+ /** @description No active application has this client_id */
12340
+ 404: {
12341
+ headers: {
12342
+ [name: string]: unknown;
12343
+ };
12344
+ content?: never;
12345
+ };
12346
+ /** @description Public read rate limit exceeded for this client IP; retry after the interval in details.retryAfter */
12347
+ 429: {
11700
12348
  headers: {
11701
12349
  [name: string]: unknown;
11702
12350
  };
@@ -11713,10 +12361,8 @@ export interface operations {
11713
12361
  };
11714
12362
  list_application_orders: {
11715
12363
  parameters: {
11716
- query?: {
11717
- /** @description Page number (1-indexed) */
11718
- page?: number;
11719
- /** @description Items per page (max 100) */
12364
+ query: {
12365
+ /** @description Items per page (max 1000) */
11720
12366
  pageSize?: number;
11721
12367
  /** @description Order status (single value or comma-separated list) */
11722
12368
  status?: string;
@@ -11728,6 +12374,23 @@ export interface operations {
11728
12374
  side?: "BUY" | "SELL";
11729
12375
  /** @description Order type */
11730
12376
  orderType?: "LIMIT" | "MARKET" | "STOP_LOSS" | "TAKE_PROFIT" | "STOP_LIMIT" | "TRAILING_STOP";
12377
+ /**
12378
+ * @description Pagination cursor with two states:
12379
+ * - Omitted or empty string (""): start a cursor walk with no prior
12380
+ * position.
12381
+ * - Non-empty: an opaque cursor from a previous response's
12382
+ * `nextPageToken`; results resume immediately after that position.
12383
+ *
12384
+ * Every walk covers full order history — hot and archived rows merged.
12385
+ * The response carries no item count: `orders_all` is too large to count
12386
+ * behind a filter.
12387
+ *
12388
+ * Filters must match the request that produced the token, or the request
12389
+ * is rejected 400.
12390
+ */
12391
+ pageToken?: string;
12392
+ /** @description Application client ID */
12393
+ clientId: string;
11731
12394
  };
11732
12395
  header?: never;
11733
12396
  path?: never;
@@ -11744,15 +12407,22 @@ export interface operations {
11744
12407
  "application/json": components["schemas"]["ListAppOrdersResponse"];
11745
12408
  };
11746
12409
  };
11747
- /** @description Bad request */
12410
+ /** @description Bad request (missing client_id, invalid filter or page token) */
11748
12411
  400: {
11749
12412
  headers: {
11750
12413
  [name: string]: unknown;
11751
12414
  };
11752
12415
  content?: never;
11753
12416
  };
11754
- /** @description Unauthorized - Invalid or missing x-server-key */
11755
- 401: {
12417
+ /** @description No active application has this client_id */
12418
+ 404: {
12419
+ headers: {
12420
+ [name: string]: unknown;
12421
+ };
12422
+ content?: never;
12423
+ };
12424
+ /** @description Public read rate limit exceeded for this client IP; retry after the interval in details.retryAfter */
12425
+ 429: {
11756
12426
  headers: {
11757
12427
  [name: string]: unknown;
11758
12428
  };
@@ -11769,8 +12439,10 @@ export interface operations {
11769
12439
  };
11770
12440
  get_application_stats: {
11771
12441
  parameters: {
11772
- query?: {
12442
+ query: {
11773
12443
  since?: string;
12444
+ /** @description Application client ID */
12445
+ clientId: string;
11774
12446
  };
11775
12447
  header?: never;
11776
12448
  path?: never;
@@ -11787,15 +12459,22 @@ export interface operations {
11787
12459
  "application/json": components["schemas"]["GetAppStatsResponse"];
11788
12460
  };
11789
12461
  };
11790
- /** @description Bad request */
12462
+ /** @description Bad request (missing client_id, invalid filter or page token) */
11791
12463
  400: {
11792
12464
  headers: {
11793
12465
  [name: string]: unknown;
11794
12466
  };
11795
12467
  content?: never;
11796
12468
  };
11797
- /** @description Unauthorized - Invalid or missing x-server-key */
11798
- 401: {
12469
+ /** @description No active application has this client_id */
12470
+ 404: {
12471
+ headers: {
12472
+ [name: string]: unknown;
12473
+ };
12474
+ content?: never;
12475
+ };
12476
+ /** @description Public read rate limit exceeded for this client IP; retry after the interval in details.retryAfter */
12477
+ 429: {
11799
12478
  headers: {
11800
12479
  [name: string]: unknown;
11801
12480
  };
@@ -11813,15 +12492,34 @@ export interface operations {
11813
12492
  list_application_users: {
11814
12493
  parameters: {
11815
12494
  query: {
11816
- /** @description Page number (1-indexed) */
11817
- page?: number;
11818
- /** @description Items per page (max 100) */
12495
+ /** @description Items per page (max 1000) */
11819
12496
  pageSize?: number;
11820
12497
  isActive?: boolean;
11821
12498
  /** @description Account type filter */
11822
12499
  accountType?: "master" | "sub";
11823
12500
  /** @description Wallet address */
11824
12501
  address: string;
12502
+ /**
12503
+ * @description Pagination cursor with two states:
12504
+ * - Omitted or empty string (""): start a cursor walk with no prior
12505
+ * position.
12506
+ * - Non-empty: an opaque cursor from a previous response's
12507
+ * `nextPageToken`; results resume immediately after that position.
12508
+ *
12509
+ * Ordered by user id ascending, NOT newest-first: `users.created_at` is
12510
+ * nullable, so it cannot be a total keyset key, and excluding the rows
12511
+ * without one would hide users from the listing an application
12512
+ * reconciles against.
12513
+ *
12514
+ * `total` and `totalPages` are populated — bounded by the server count
12515
+ * ceiling, see `totalCapped`.
12516
+ *
12517
+ * Filters must match the request that produced the token, or the request
12518
+ * is rejected 400.
12519
+ */
12520
+ pageToken?: string;
12521
+ /** @description Application client ID */
12522
+ clientId: string;
11825
12523
  };
11826
12524
  header?: never;
11827
12525
  path?: never;
@@ -11838,15 +12536,22 @@ export interface operations {
11838
12536
  "application/json": components["schemas"]["ListAppUsersResponse"];
11839
12537
  };
11840
12538
  };
11841
- /** @description Bad request */
12539
+ /** @description Bad request (missing client_id, invalid filter or page token) */
11842
12540
  400: {
11843
12541
  headers: {
11844
12542
  [name: string]: unknown;
11845
12543
  };
11846
12544
  content?: never;
11847
12545
  };
11848
- /** @description Unauthorized - Invalid or missing x-server-key */
11849
- 401: {
12546
+ /** @description No active application has this client_id */
12547
+ 404: {
12548
+ headers: {
12549
+ [name: string]: unknown;
12550
+ };
12551
+ content?: never;
12552
+ };
12553
+ /** @description Public read rate limit exceeded for this client IP; retry after the interval in details.retryAfter */
12554
+ 429: {
11850
12555
  headers: {
11851
12556
  [name: string]: unknown;
11852
12557
  };
@@ -12126,7 +12831,7 @@ export interface operations {
12126
12831
  };
12127
12832
  content?: never;
12128
12833
  };
12129
- /** @description Refused: BuilderCodes is disabled, the caller is delegated, or the caller is not this application's payout wallet (gRPC: PERMISSION_DENIED) */
12834
+ /** @description Refused: neither the revenue share nor builder fees are switched on, the caller is delegated, or the caller is not this application's payout wallet (gRPC: PERMISSION_DENIED) */
12130
12835
  403: {
12131
12836
  headers: {
12132
12837
  [name: string]: unknown;
@@ -12196,7 +12901,7 @@ export interface operations {
12196
12901
  };
12197
12902
  content?: never;
12198
12903
  };
12199
- /** @description Refused: BuilderCodes is disabled, the caller is delegated, or the caller is not this application's payout wallet (gRPC: PERMISSION_DENIED) */
12904
+ /** @description Refused: the caller is delegated or is not this application's payout wallet (gRPC: PERMISSION_DENIED) */
12200
12905
  403: {
12201
12906
  headers: {
12202
12907
  [name: string]: unknown;
@@ -12244,7 +12949,7 @@ export interface operations {
12244
12949
  };
12245
12950
  content?: never;
12246
12951
  };
12247
- /** @description Refused: BuilderCodes is disabled, the caller is delegated, or the caller is not this application's payout wallet (gRPC: PERMISSION_DENIED) */
12952
+ /** @description Refused: the caller is delegated or is not this application's payout wallet (gRPC: PERMISSION_DENIED) */
12248
12953
  403: {
12249
12954
  headers: {
12250
12955
  [name: string]: unknown;
@@ -12270,11 +12975,49 @@ export interface operations {
12270
12975
  list_buildercode_payouts: {
12271
12976
  parameters: {
12272
12977
  query?: {
12273
- /** @description Page number (1-indexed) */
12274
- page?: number;
12275
- /** @description Items per page (max 100) */
12978
+ /** @description Items per page (max 1000) */
12276
12979
  pageSize?: number;
12277
- /** @description Only return BuilderCodes payouts of this payout kind: REVENUE_SHARE (the frontend's share of Monaco's fee) or BUILDER_FEE (reserved and not currently emitted). Omit for every kind. */
12980
+ /**
12981
+ * @description Pagination cursor with two states:
12982
+ * - Omitted or empty string (""): start a cursor walk with no prior
12983
+ * position, from the newest credit.
12984
+ * - Non-empty: an opaque cursor from a previous response's
12985
+ * `next_page_token`; results resume immediately after that position.
12986
+ *
12987
+ * The walk seeks on `(created_at, id)` descending, served by
12988
+ * `idx_buildercode_payouts_application_created_id`, whose leading key is the
12989
+ * caller's own application and whose remaining keys are this seek's, both
12990
+ * descending. Both key columns are NOT NULL and fixed for a credit's
12991
+ * lifetime. (Spelled without the column list on purpose: the read contract
12992
+ * test asserts this request message never mentions a caller-selected
12993
+ * identity.)
12994
+ *
12995
+ * This REPLACES the removed mode's `(sequence, sequence_ordinal, created_at,
12996
+ * id)` order, whose two leading columns are nullable — no backfill exists
12997
+ * for credits written before they did — and a nullable leading key cannot be
12998
+ * a total cursor key: the NULL rows sort together at one end, and a seek
12999
+ * through them would need a COALESCE no index covers.
13000
+ *
13001
+ * ORDERING CHANGE, not just a pagination change. The new key is total and
13002
+ * stable — a page can neither skip nor duplicate a credit — but it is NOT
13003
+ * chronological inside one persistor batch. `created_at` defaults to `NOW()`,
13004
+ * which is transaction-start time, so every credit one batch writes shares an
13005
+ * identical timestamp; the `id` tie-break defaults to `gen_random_uuid()`,
13006
+ * which the persistor leaves alone. So within a batch the order is arbitrary
13007
+ * and a LATER fill can be listed ahead of an earlier one. The removed order
13008
+ * led with `sequence` and `sequence_ordinal` precisely because those carry
13009
+ * the engine's fill order, and one entry routinely holds several credits (a
13010
+ * taker sweeping N makers, or a flattened `BatchCreateOrders`). Preserving
13011
+ * fill chronology would need those columns backfilled first, which is not
13012
+ * possible for credits written before they existed. Across batches the order
13013
+ * is still newest-first.
13014
+ *
13015
+ * `total` and `total_pages` are populated and exact, and count the rows the
13016
+ * `kind` filter selects. Filters must match the request that produced the
13017
+ * token, or the request is rejected 400.
13018
+ */
13019
+ pageToken?: string;
13020
+ /** @description Only return BuilderCodes payouts of this payout kind: REVENUE_SHARE (the frontend's share of Monaco's fee) or BUILDER_FEE (ordinary builder fees charged to takers and credited to enrolled applications). Omit for every kind. */
12278
13021
  kind?: "REVENUE_SHARE" | "BUILDER_FEE";
12279
13022
  };
12280
13023
  header?: never;
@@ -12306,7 +13049,7 @@ export interface operations {
12306
13049
  };
12307
13050
  content?: never;
12308
13051
  };
12309
- /** @description Refused: BuilderCodes is disabled, the caller is delegated, or the caller is not this application's payout wallet (gRPC: PERMISSION_DENIED) */
13052
+ /** @description Refused: the caller is delegated or is not this application's payout wallet (gRPC: PERMISSION_DENIED) */
12310
13053
  403: {
12311
13054
  headers: {
12312
13055
  [name: string]: unknown;
@@ -12354,7 +13097,7 @@ export interface operations {
12354
13097
  };
12355
13098
  content?: never;
12356
13099
  };
12357
- /** @description Refused: BuilderCodes is disabled, the caller is delegated, or the caller is not this application's payout wallet (gRPC: PERMISSION_DENIED) */
13100
+ /** @description Refused: the caller is delegated or is not this application's payout wallet (gRPC: PERMISSION_DENIED) */
12358
13101
  403: {
12359
13102
  headers: {
12360
13103
  [name: string]: unknown;
@@ -12402,7 +13145,7 @@ export interface operations {
12402
13145
  };
12403
13146
  content?: never;
12404
13147
  };
12405
- /** @description Refused: BuilderCodes is disabled or the caller is delegated (gRPC: PERMISSION_DENIED) */
13148
+ /** @description Refused: the caller is delegated (gRPC: PERMISSION_DENIED) */
12406
13149
  403: {
12407
13150
  headers: {
12408
13151
  [name: string]: unknown;
@@ -12454,7 +13197,7 @@ export interface operations {
12454
13197
  };
12455
13198
  content?: never;
12456
13199
  };
12457
- /** @description Refused: BuilderCodes is not enabled, or the caller is a delegated-agent session (gRPC: PERMISSION_DENIED) */
13200
+ /** @description Refused: the caller is a delegated-agent session (gRPC: PERMISSION_DENIED) */
12458
13201
  403: {
12459
13202
  headers: {
12460
13203
  [name: string]: unknown;
@@ -12468,6 +13211,13 @@ export interface operations {
12468
13211
  };
12469
13212
  content?: never;
12470
13213
  };
13214
+ /** @description Movement rate limit exceeded — withdrawals, collateral transfers and reward transfers share a per-user budget; refused before the claim reaches the sequencer, so nothing committed; retry after the interval in details.retryAfter (gRPC: RESOURCE_EXHAUSTED) */
13215
+ 429: {
13216
+ headers: {
13217
+ [name: string]: unknown;
13218
+ };
13219
+ content?: never;
13220
+ };
12471
13221
  /** @description Internal server error */
12472
13222
  500: {
12473
13223
  headers: {
@@ -12597,6 +13347,13 @@ export interface operations {
12597
13347
  };
12598
13348
  content?: never;
12599
13349
  };
13350
+ /** @description Settings write rate limit exceeded — the lead trader profile, follow create/edit and self-trade-prevention default share a per-account budget; retry after the interval in details.retryAfter */
13351
+ 429: {
13352
+ headers: {
13353
+ [name: string]: unknown;
13354
+ };
13355
+ content?: never;
13356
+ };
12600
13357
  /** @description Internal server error */
12601
13358
  500: {
12602
13359
  headers: {
@@ -12992,7 +13749,7 @@ export interface operations {
12992
13749
  "application/json": components["schemas"]["AddFollowPositionMarginResponse"];
12993
13750
  };
12994
13751
  };
12995
- /** @description Invalid follow id, trading pair or amount, or refused by the engine with code COPY_TRADING_REJECTED (no copy position on the pair, the position or the margin account is being liquidated, the position has lost more than its margin, more than the copy account holds; the message names the rule) */
13752
+ /** @description Invalid follow id, trading pair or amount, or refused with code COPY_TRADING_REJECTED (no isolated copy position on the pair, the copy position is being liquidated or is in bad debt, or more than the copy account can put in; the message names the rule) */
12996
13753
  400: {
12997
13754
  headers: {
12998
13755
  [name: string]: unknown;
@@ -13020,7 +13777,7 @@ export interface operations {
13020
13777
  };
13021
13778
  content?: never;
13022
13779
  };
13023
- /** @description The follow is stopping or stopped, or code COPY_TRADING_UNAVAILABLE: copy trading is not available on the platform */
13780
+ /** @description The follow is stopping or stopped */
13024
13781
  409: {
13025
13782
  headers: {
13026
13783
  [name: string]: unknown;
@@ -13098,6 +13855,13 @@ export interface operations {
13098
13855
  };
13099
13856
  content?: never;
13100
13857
  };
13858
+ /** @description Follow stop rate limit exceeded; retry after the interval in details.retryAfter */
13859
+ 429: {
13860
+ headers: {
13861
+ [name: string]: unknown;
13862
+ };
13863
+ content?: never;
13864
+ };
13101
13865
  /** @description Internal server error */
13102
13866
  500: {
13103
13867
  headers: {
@@ -13258,6 +14022,13 @@ export interface operations {
13258
14022
  };
13259
14023
  content?: never;
13260
14024
  };
14025
+ /** @description Settings write rate limit exceeded — the lead trader profile, follow create/edit and self-trade-prevention default share a per-account budget; retry after the interval in details.retryAfter */
14026
+ 429: {
14027
+ headers: {
14028
+ [name: string]: unknown;
14029
+ };
14030
+ content?: never;
14031
+ };
13261
14032
  /** @description Internal server error */
13262
14033
  500: {
13263
14034
  headers: {
@@ -13974,10 +14745,24 @@ export interface operations {
13974
14745
  list_managed_market_assignments: {
13975
14746
  parameters: {
13976
14747
  query?: {
13977
- /** @description Page number (1-indexed) */
13978
- page?: number;
13979
- /** @description Items per page (max 100) */
14748
+ /** @description Items per page (max 1000) */
13980
14749
  pageSize?: number;
14750
+ /**
14751
+ * @description Pagination cursor with two states:
14752
+ * - Omitted or empty string (""): start a cursor walk with no prior
14753
+ * position, from the oldest assignment.
14754
+ * - Non-empty: an opaque cursor from a previous response's
14755
+ * `next_page_token`; results resume immediately after that position.
14756
+ *
14757
+ * The walk seeks on `(created_at, id)` ascending — the order this listing
14758
+ * already read in, and the order
14759
+ * `idx_market_launch_maker_inventory (maker_user_id, maker_application_id,
14760
+ * created_at, id)` is built for, so the seek stays an index scan. Both
14761
+ * columns are NOT NULL and fixed for a launch's lifetime. `total` is
14762
+ * populated and exact: a maker's assignment inventory is a small bounded
14763
+ * set.
14764
+ */
14765
+ pageToken?: string;
13981
14766
  };
13982
14767
  header?: never;
13983
14768
  path?: never;
@@ -14072,13 +14857,43 @@ export interface operations {
14072
14857
  list_margin_accounts: {
14073
14858
  parameters: {
14074
14859
  query?: {
14075
- /** @description Page number (1-indexed) */
14076
- page?: number;
14077
- /** @description Items per page (max 100) */
14860
+ /** @description Items per page (max 1000) */
14078
14861
  pageSize?: number;
14862
+ /**
14863
+ * @description Keep only risk-bucket rows in this state (see `risk_bucket_state`). A
14864
+ * parent margin account row has no state, so any filter excludes it.
14865
+ */
14079
14866
  state?: string;
14080
14867
  /** @description Trading pair identifier (UUID) */
14081
14868
  tradingPairId?: string;
14869
+ /**
14870
+ * @description Pagination cursor with two states:
14871
+ * - Omitted or empty string (""): start a cursor walk with no prior
14872
+ * position, from the lowest margin account id.
14873
+ * - Non-empty: an opaque cursor from a previous response's
14874
+ * `nextPageToken`; results resume immediately after that position.
14875
+ *
14876
+ * This listing has no database page to walk: one row is a margin account
14877
+ * and one row is a risk bucket, each repriced against live marks and the
14878
+ * engine's bounds, so the set is built in memory and paged there. The walk
14879
+ * seeks by KEY on
14880
+ * `(margin_account_id, trading_pair_id, risk_bucket_id, strategy_key)` —
14881
+ * every component immutable for the row's lifetime, the parent row sorting
14882
+ * ahead of its buckets — rather than by index, so a bucket that opens or
14883
+ * closes mid-walk no longer shifts the rows behind it across the resume
14884
+ * point. The strategy key is part of the key because an auto bucket the
14885
+ * engine has not materialized yet carries no `risk_bucket_id`, and one
14886
+ * account and pair can hold several strategies; such a row sorts under the
14887
+ * id its bucket will carry once the engine projects it, derived from the
14888
+ * account and pair, so provisioning completing mid-walk cannot move the row
14889
+ * across the resume point and serve the same risk bucket twice. `total` is
14890
+ * exact: a user's accounts and buckets are a small bounded set, counted in
14891
+ * memory.
14892
+ *
14893
+ * Filters must match the request that produced the token, or the request is
14894
+ * rejected 400.
14895
+ */
14896
+ pageToken?: string;
14082
14897
  };
14083
14898
  header?: never;
14084
14899
  path?: never;
@@ -14218,10 +15033,21 @@ export interface operations {
14218
15033
  parameters: {
14219
15034
  query?: {
14220
15035
  movementType?: string;
14221
- /** @description Page number (1-indexed) */
14222
- page?: number;
14223
- /** @description Items per page (max 100) */
15036
+ /** @description Items per page (max 1000) */
14224
15037
  pageSize?: number;
15038
+ /**
15039
+ * @description Pagination cursor with two states:
15040
+ * - Omitted or empty string (""): start a cursor walk with no prior
15041
+ * position, from the newest movement — this listing always sorts
15042
+ * newest-first.
15043
+ * - Non-empty: an opaque cursor from a previous response's
15044
+ * `nextPageToken`; results resume immediately after that position.
15045
+ *
15046
+ * The response carries no item count: the underlying ledger is too large to
15047
+ * count behind a filter. `movementType` must match the request that produced
15048
+ * the token, or the request is rejected 400.
15049
+ */
15050
+ pageToken?: string;
14225
15051
  };
14226
15052
  header?: never;
14227
15053
  path: {
@@ -14253,6 +15079,39 @@ export interface operations {
14253
15079
  };
14254
15080
  };
14255
15081
  };
15082
+ get_margin_account_pnl: {
15083
+ parameters: {
15084
+ query?: never;
15085
+ header?: never;
15086
+ path: {
15087
+ /**
15088
+ * @description One of the caller's margin accounts: the default one or a sub-account.
15089
+ * @example 2b1a5f9c-0000-4000-8000-000000000001
15090
+ */
15091
+ marginAccountId: string;
15092
+ };
15093
+ cookie?: never;
15094
+ };
15095
+ requestBody?: never;
15096
+ responses: {
15097
+ /** @description OK */
15098
+ 200: {
15099
+ headers: {
15100
+ [name: string]: unknown;
15101
+ };
15102
+ content: {
15103
+ "application/json": components["schemas"]["GetMarginAccountPnlResponse"];
15104
+ };
15105
+ };
15106
+ /** @description Read rate limit exceeded — every authenticated read draws one request from the account's read budget; retry after the interval in details.retryAfter */
15107
+ 429: {
15108
+ headers: {
15109
+ [name: string]: unknown;
15110
+ };
15111
+ content?: never;
15112
+ };
15113
+ };
15114
+ };
14256
15115
  simulate_order_risk: {
14257
15116
  parameters: {
14258
15117
  query?: never;
@@ -14319,6 +15178,37 @@ export interface operations {
14319
15178
  };
14320
15179
  };
14321
15180
  };
15181
+ transfer_collateral: {
15182
+ parameters: {
15183
+ query?: never;
15184
+ header?: never;
15185
+ path?: never;
15186
+ cookie?: never;
15187
+ };
15188
+ requestBody: {
15189
+ content: {
15190
+ "application/json": components["schemas"]["TransferCollateralRequest"];
15191
+ };
15192
+ };
15193
+ responses: {
15194
+ /** @description OK */
15195
+ 200: {
15196
+ headers: {
15197
+ [name: string]: unknown;
15198
+ };
15199
+ content: {
15200
+ "application/json": components["schemas"]["TransferCollateralResponse"];
15201
+ };
15202
+ };
15203
+ /** @description Movement rate limit exceeded — withdrawals and collateral transfers share a per-user budget; retry after the interval in details.retryAfter */
15204
+ 429: {
15205
+ headers: {
15206
+ [name: string]: unknown;
15207
+ };
15208
+ content?: never;
15209
+ };
15210
+ };
15211
+ };
14322
15212
  get_parent_margin_account_summary: {
14323
15213
  parameters: {
14324
15214
  query?: {
@@ -14415,10 +15305,13 @@ export interface operations {
14415
15305
  parameters: {
14416
15306
  query?: {
14417
15307
  movementType?: string;
14418
- /** @description Page number (1-indexed) */
14419
- page?: number;
14420
- /** @description Items per page (max 100) */
15308
+ /** @description Items per page (max 1000) */
14421
15309
  pageSize?: number;
15310
+ /**
15311
+ * @description See `GetMarginAccountMovementsRequest.page_token`: the same cursor walk,
15312
+ * scoped to the caller's parent margin account.
15313
+ */
15314
+ pageToken?: string;
14422
15315
  };
14423
15316
  header?: never;
14424
15317
  path?: never;
@@ -14537,6 +15430,145 @@ export interface operations {
14537
15430
  };
14538
15431
  };
14539
15432
  };
15433
+ create_sub_account: {
15434
+ parameters: {
15435
+ query?: never;
15436
+ header?: never;
15437
+ path?: never;
15438
+ cookie?: never;
15439
+ };
15440
+ requestBody: {
15441
+ content: {
15442
+ "application/json": components["schemas"]["CreateSubAccountRequest"];
15443
+ };
15444
+ };
15445
+ responses: {
15446
+ /** @description OK */
15447
+ 200: {
15448
+ headers: {
15449
+ [name: string]: unknown;
15450
+ };
15451
+ content: {
15452
+ "application/json": components["schemas"]["CreateSubAccountResponse"];
15453
+ };
15454
+ };
15455
+ /** @description Movement rate limit exceeded — withdrawals and collateral transfers share a per-user budget; retry after the interval in details.retryAfter */
15456
+ 429: {
15457
+ headers: {
15458
+ [name: string]: unknown;
15459
+ };
15460
+ content?: never;
15461
+ };
15462
+ };
15463
+ };
15464
+ close_sub_account: {
15465
+ parameters: {
15466
+ query?: never;
15467
+ header?: never;
15468
+ path: {
15469
+ /** @example 2b1a5f9c-0000-4000-8000-000000000001 */
15470
+ marginAccountId: string;
15471
+ };
15472
+ cookie?: never;
15473
+ };
15474
+ requestBody: {
15475
+ content: {
15476
+ "application/json": components["schemas"]["CloseSubAccountRequest"];
15477
+ };
15478
+ };
15479
+ responses: {
15480
+ /** @description OK */
15481
+ 200: {
15482
+ headers: {
15483
+ [name: string]: unknown;
15484
+ };
15485
+ content: {
15486
+ "application/json": components["schemas"]["CloseSubAccountResponse"];
15487
+ };
15488
+ };
15489
+ /** @description Movement rate limit exceeded — withdrawals and collateral transfers share a per-user budget; retry after the interval in details.retryAfter */
15490
+ 429: {
15491
+ headers: {
15492
+ [name: string]: unknown;
15493
+ };
15494
+ content?: never;
15495
+ };
15496
+ };
15497
+ };
15498
+ transfer_collateral_to_sub_account: {
15499
+ parameters: {
15500
+ query?: never;
15501
+ header?: never;
15502
+ path: {
15503
+ /**
15504
+ * @description The caller's sub-account that receives the collateral.
15505
+ * @example 2b1a5f9c-0000-4000-8000-000000000001
15506
+ */
15507
+ marginAccountId: string;
15508
+ };
15509
+ cookie?: never;
15510
+ };
15511
+ requestBody: {
15512
+ content: {
15513
+ "application/json": components["schemas"]["TransferCollateralToSubAccountRequest"];
15514
+ };
15515
+ };
15516
+ responses: {
15517
+ /** @description OK */
15518
+ 200: {
15519
+ headers: {
15520
+ [name: string]: unknown;
15521
+ };
15522
+ content: {
15523
+ "application/json": components["schemas"]["TransferCollateralResponse"];
15524
+ };
15525
+ };
15526
+ /** @description Movement rate limit exceeded — withdrawals and collateral transfers share a per-user budget; retry after the interval in details.retryAfter */
15527
+ 429: {
15528
+ headers: {
15529
+ [name: string]: unknown;
15530
+ };
15531
+ content?: never;
15532
+ };
15533
+ };
15534
+ };
15535
+ transfer_collateral_from_sub_account: {
15536
+ parameters: {
15537
+ query?: never;
15538
+ header?: never;
15539
+ path: {
15540
+ /**
15541
+ * @description The caller's sub-account the collateral leaves.
15542
+ * @example 2b1a5f9c-0000-4000-8000-000000000001
15543
+ */
15544
+ marginAccountId: string;
15545
+ };
15546
+ cookie?: never;
15547
+ };
15548
+ requestBody: {
15549
+ content: {
15550
+ "application/json": components["schemas"]["TransferCollateralFromSubAccountRequest"];
15551
+ };
15552
+ };
15553
+ responses: {
15554
+ /** @description OK */
15555
+ 200: {
15556
+ headers: {
15557
+ [name: string]: unknown;
15558
+ };
15559
+ content: {
15560
+ "application/json": components["schemas"]["TransferCollateralResponse"];
15561
+ };
15562
+ };
15563
+ /** @description Movement rate limit exceeded — withdrawals and collateral transfers share a per-user budget; retry after the interval in details.retryAfter */
15564
+ 429: {
15565
+ headers: {
15566
+ [name: string]: unknown;
15567
+ };
15568
+ content?: never;
15569
+ };
15570
+ };
15571
+ };
14540
15572
  list_all_funding_history: {
14541
15573
  parameters: {
14542
15574
  query?: {
@@ -14544,12 +15576,30 @@ export interface operations {
14544
15576
  startTime?: number;
14545
15577
  /** @description End time as Unix timestamp (milliseconds) */
14546
15578
  endTime?: number;
14547
- /** @description Page number (1-indexed) */
14548
- page?: number;
14549
- /** @description Items per page (max 100) */
15579
+ /** @description Items per page (max 1000) */
14550
15580
  pageSize?: number;
14551
15581
  /** @description Sort direction for settledAt */
14552
15582
  orderBy?: "ASC" | "DESC";
15583
+ /**
15584
+ * @description Pagination cursor with two states:
15585
+ * - Omitted or empty string (""): start a cursor walk with no prior
15586
+ * position, from the newest settlement (the oldest when `orderBy` is
15587
+ * ASC).
15588
+ * - Non-empty: an opaque cursor from a previous response's
15589
+ * `nextPageToken`; results resume immediately after that position.
15590
+ *
15591
+ * The walk seeks on `(settled_at, id)` in the requested direction.
15592
+ * `settled_at` is NOT NULL and never changes once a window settles, and the
15593
+ * `id` tie-break makes the key total — the removed page-number mode ordered
15594
+ * by `(settled_at, trading_pair_id, epoch)` with no tie-break, so a page
15595
+ * boundary between two settlements sharing that triple could repeat or drop
15596
+ * a row.
15597
+ *
15598
+ * `total` is populated — bounded by the server count ceiling, see
15599
+ * `totalCapped`. Filters and `orderBy` must match the request that produced
15600
+ * the token, or the request is rejected 400.
15601
+ */
15602
+ pageToken?: string;
14553
15603
  };
14554
15604
  header?: never;
14555
15605
  path?: never;
@@ -14735,12 +15785,29 @@ export interface operations {
14735
15785
  startTime?: number;
14736
15786
  /** @description End time as Unix timestamp (milliseconds) */
14737
15787
  endTime?: number;
14738
- /** @description Page number (1-indexed) */
14739
- page?: number;
14740
- /** @description Items per page (max 100) */
15788
+ /** @description Items per page (max 1000) */
14741
15789
  pageSize?: number;
14742
- /** @description Sort direction for createdAt */
15790
+ /** @description Sort direction for settledAt */
14743
15791
  orderBy?: "ASC" | "DESC";
15792
+ /**
15793
+ * @description Pagination cursor with two states:
15794
+ * - Omitted or empty string (""): start a cursor walk with no prior
15795
+ * position, from the newest settlement (the oldest when `orderBy` is
15796
+ * ASC).
15797
+ * - Non-empty: an opaque cursor from a previous response's
15798
+ * `nextPageToken`; results resume immediately after that position.
15799
+ *
15800
+ * The walk seeks on `(settled_at, id)` in the requested direction.
15801
+ * `settled_at` is NOT NULL and never changes once a window settles, and the
15802
+ * `id` tie-break makes the key total — the removed page-number mode ordered
15803
+ * by `epoch` with no tie-break, so a page boundary between two
15804
+ * settlements sharing it could repeat or drop a row.
15805
+ *
15806
+ * `total` is populated — bounded by the server count ceiling, see
15807
+ * `totalCapped`. Filters and `orderBy` must match the request that produced
15808
+ * the token, or the request is rejected 400.
15809
+ */
15810
+ pageToken?: string;
14744
15811
  };
14745
15812
  header?: never;
14746
15813
  path: {
@@ -16308,7 +17375,15 @@ export interface operations {
16308
17375
  };
16309
17376
  get_my_referral_downline: {
16310
17377
  parameters: {
16311
- query?: never;
17378
+ query?: {
17379
+ /** @description `earningsBySource` rows per page (max 500) */
17380
+ pageSize?: number;
17381
+ /**
17382
+ * @description Opaque cursor from a previous response's `nextPageToken`; omit or send an
17383
+ * empty string for the first page.
17384
+ */
17385
+ pageToken?: string;
17386
+ };
16312
17387
  header?: never;
16313
17388
  path?: never;
16314
17389
  cookie?: never;
@@ -16347,6 +17422,70 @@ export interface operations {
16347
17422
  };
16348
17423
  };
16349
17424
  };
17425
+ get_my_referral_tree: {
17426
+ parameters: {
17427
+ query?: {
17428
+ parent?: string;
17429
+ /** @description Nodes per page (max 200) */
17430
+ pageSize?: number;
17431
+ /**
17432
+ * @description Opaque cursor from a previous response's `nextPageToken`; omit or send an
17433
+ * empty string for the first page. Only valid with the same `parent`.
17434
+ */
17435
+ pageToken?: string;
17436
+ };
17437
+ header?: never;
17438
+ path?: never;
17439
+ cookie?: never;
17440
+ };
17441
+ requestBody?: never;
17442
+ responses: {
17443
+ /** @description OK */
17444
+ 200: {
17445
+ headers: {
17446
+ [name: string]: unknown;
17447
+ };
17448
+ content: {
17449
+ "application/json": components["schemas"]["GetMyReferralTreeResponse"];
17450
+ };
17451
+ };
17452
+ /** @description Invalid `parent` wallet address, `pageSize`, or `pageToken` */
17453
+ 400: {
17454
+ headers: {
17455
+ [name: string]: unknown;
17456
+ };
17457
+ content?: never;
17458
+ };
17459
+ /** @description Authentication required */
17460
+ 401: {
17461
+ headers: {
17462
+ [name: string]: unknown;
17463
+ };
17464
+ content?: never;
17465
+ };
17466
+ /** @description `parent` is not the caller or one of the caller's own expandable referees */
17467
+ 404: {
17468
+ headers: {
17469
+ [name: string]: unknown;
17470
+ };
17471
+ content?: never;
17472
+ };
17473
+ /** @description Read rate limit exceeded — every authenticated read draws one request from the account's read budget; retry after the interval in details.retryAfter */
17474
+ 429: {
17475
+ headers: {
17476
+ [name: string]: unknown;
17477
+ };
17478
+ content?: never;
17479
+ };
17480
+ /** @description Internal server error */
17481
+ 500: {
17482
+ headers: {
17483
+ [name: string]: unknown;
17484
+ };
17485
+ content?: never;
17486
+ };
17487
+ };
17488
+ };
16350
17489
  get_rewards_balance: {
16351
17490
  parameters: {
16352
17491
  query?: never;
@@ -16431,6 +17570,13 @@ export interface operations {
16431
17570
  };
16432
17571
  content?: never;
16433
17572
  };
17573
+ /** @description Movement rate limit exceeded — withdrawals, collateral transfers and reward transfers share a per-user budget; retry after the interval in details.retryAfter */
17574
+ 429: {
17575
+ headers: {
17576
+ [name: string]: unknown;
17577
+ };
17578
+ content?: never;
17579
+ };
16434
17580
  /** @description Internal server error */
16435
17581
  500: {
16436
17582
  headers: {
@@ -16449,10 +17595,53 @@ export interface operations {
16449
17595
  tradingPairId?: string;
16450
17596
  /** @description Order status (single value or comma-separated list) */
16451
17597
  status?: string;
16452
- /** @description Page number (1-indexed) */
16453
- page?: number;
16454
- /** @description Items per page (max 100) */
17598
+ /** @description Items per page (max 1000) */
16455
17599
  pageSize?: number;
17600
+ /**
17601
+ * @description Pagination cursor with two states:
17602
+ * - Omitted or empty string (""): start a cursor walk with no prior
17603
+ * position.
17604
+ * - Non-empty: an opaque cursor from a previous response's
17605
+ * `nextPageToken`; results resume immediately after that position.
17606
+ *
17607
+ * ORDER DEPENDS ON THE FILTER, because the two cases are served from
17608
+ * different places:
17609
+ *
17610
+ * - `status=OPEN` is answered from the matching engine's live view, which
17611
+ * carries no timestamps for a position the persistor has not written
17612
+ * yet. It is ordered by `(marginAccountId, tradingPairId, positionId)`
17613
+ * ascending — stable and total, but UUID order, NOT newest-first.
17614
+ * - Every other filter reads persisted rows, ordered by the IMMUTABLE
17615
+ * `(opened_at, id)` descending: newest-opened first. The removed
17616
+ * page-number mode sorted on `COALESCE(closed_at, last_funding_at,
17617
+ * opened_at)`, which *advances* whenever a position takes a funding
17618
+ * payment or closes, so rows moved across a resume point mid-walk;
17619
+ * `opened_at` never changes after the insert. Order therefore differs
17620
+ * from the removed mode's. One exception: an operator correction may
17621
+ * move an OPEN position's `opened_at` EARLIER, never later, to its
17622
+ * opening fill. A walk in flight while that runs can return such a
17623
+ * position a second time, but cannot skip one: dedupe on `positionId`.
17624
+ *
17625
+ * Those are two separate cursor spaces, so a token is only valid in the one
17626
+ * that minted it, and crossing between them is ASYMMETRIC:
17627
+ *
17628
+ * - A PERSISTED token offered to `status=OPEN` while the engine is
17629
+ * reachable is served: the live branch does not recognise it, declines,
17630
+ * and the persisted walk answers. That is what keeps a walk going which
17631
+ * started on persisted rows because the engine was down at the time and
17632
+ * has since come back.
17633
+ * - A LIVE token offered after the engine becomes unreachable is NOT
17634
+ * served. The live branch cannot answer at all, and the persisted
17635
+ * decoder rejects the `src=live` token, so the request is a 400 and the
17636
+ * walk has to start over. There is no way to carry a live position into
17637
+ * the persisted ordering: the two relations do not share a sort key, and
17638
+ * resuming at a key from the wrong one would skip or repeat rows
17639
+ * silently, which is worse than the restart.
17640
+ *
17641
+ * A token neither relation recognises is rejected 400, and so is one minted
17642
+ * under different filters.
17643
+ */
17644
+ pageToken?: string;
16456
17645
  };
16457
17646
  header?: never;
16458
17647
  path?: never;
@@ -16500,6 +17689,13 @@ export interface operations {
16500
17689
  "application/json": components["schemas"]["BatchCloseAllResponse"];
16501
17690
  };
16502
17691
  };
17692
+ /** @description Order rate limit exceeded — each call draws one item per open position it closes (at least 1) from the per-account risk-reduction budget it shares with cancels (and the budget the account family shares). Returned when the first 100 closes do not fit; positions past 100 that do not fit are reported per position as RATE_LIMIT_EXCEEDED instead. Retry after the interval in details.retryAfter */
17693
+ 429: {
17694
+ headers: {
17695
+ [name: string]: unknown;
17696
+ };
17697
+ content?: never;
17698
+ };
16503
17699
  };
16504
17700
  };
16505
17701
  list_position_history: {
@@ -16509,12 +17705,24 @@ export interface operations {
16509
17705
  marginAccountId?: string;
16510
17706
  /** @description Trading pair identifier (UUID) */
16511
17707
  tradingPairId?: string;
16512
- /** @description Page number (1-indexed) */
16513
- page?: number;
16514
- /** @description Items per page (max 100) */
17708
+ /** @description Items per page (max 1000) */
16515
17709
  pageSize?: number;
16516
17710
  /** @description When true, return only DECREASE, CLOSE, and LIQUIDATE execution rows. */
16517
17711
  reductionOnly?: boolean;
17712
+ /**
17713
+ * @description Pagination cursor with two states:
17714
+ * - Omitted or empty string (""): start a cursor walk with no prior
17715
+ * position, from the newest event — this listing always sorts
17716
+ * newest-first.
17717
+ * - Non-empty: an opaque cursor from a previous response's
17718
+ * `nextPageToken`; results resume immediately after that position.
17719
+ *
17720
+ * Every walk covers full position history — hot and archived rows merged.
17721
+ * The response carries no item count: this listing's relation is too large
17722
+ * to count behind a filter. Filters must match the request that produced the
17723
+ * token, or the request is rejected 400.
17724
+ */
17725
+ pageToken?: string;
16518
17726
  };
16519
17727
  header?: never;
16520
17728
  path?: never;
@@ -16595,6 +17803,13 @@ export interface operations {
16595
17803
  "application/json": components["schemas"]["ClosePositionResponse"];
16596
17804
  };
16597
17805
  };
17806
+ /** @description Order rate limit exceeded — each close draws one item from the per-account risk-reduction budget it shares with cancels (and the budget the account family shares); retry after the interval in details.retryAfter */
17807
+ 429: {
17808
+ headers: {
17809
+ [name: string]: unknown;
17810
+ };
17811
+ content?: never;
17812
+ };
16598
17813
  };
16599
17814
  };
16600
17815
  get_position_pnl_history: {
@@ -16900,10 +18115,24 @@ export interface operations {
16900
18115
  get_trades: {
16901
18116
  parameters: {
16902
18117
  query?: {
16903
- /** @description Page number (1-indexed) */
16904
- page?: number;
16905
- /** @description Max trades to return (max 100) */
18118
+ /** @description Max trades to return (max 1000) */
16906
18119
  pageSize?: number;
18120
+ /**
18121
+ * @description Pagination cursor with two states:
18122
+ * - Omitted or empty string (""): start a cursor walk with no prior
18123
+ * position, from the most recent trade (this listing always sorts
18124
+ * newest-first).
18125
+ * - Non-empty: an opaque cursor from a previous response's
18126
+ * `next_page_token`; results resume immediately after that position.
18127
+ *
18128
+ * The walk is a keyset seek on `(executed_at, id)`, both immutable once a
18129
+ * trade is written, so a page can neither repeat nor skip a trade when new
18130
+ * fills land mid-walk — the failure the removed page number had by
18131
+ * construction on a table this endpoint appends to continuously.
18132
+ * `trading_pair_id` is pinned inside the token, so a token minted for one
18133
+ * pair is rejected rather than seeking into another pair's history.
18134
+ */
18135
+ pageToken?: string;
16907
18136
  };
16908
18137
  header?: never;
16909
18138
  path: {
@@ -16994,10 +18223,24 @@ export interface operations {
16994
18223
  list_pending_withdrawals: {
16995
18224
  parameters: {
16996
18225
  query?: {
16997
- /** @description Page number (1-indexed) */
16998
- page?: number;
16999
- /** @description Items per page (max 100) */
18226
+ /** @description Items per page (max 1000) */
17000
18227
  pageSize?: number;
18228
+ /**
18229
+ * @description Pagination cursor with two states:
18230
+ * - Omitted or empty string (""): start a cursor walk with no prior
18231
+ * position, from the newest pending withdrawal.
18232
+ * - Non-empty: an opaque cursor from a previous response's
18233
+ * `next_page_token`; results resume immediately after that position.
18234
+ *
18235
+ * The walk seeks on `(created_at, withdrawal_index)` descending — the order
18236
+ * this listing already read in, served by
18237
+ * `idx_withdrawals_user_created (user_id, created_at DESC)`. `created_at` is
18238
+ * NOT NULL and `withdrawal_index` is the table's primary key, assigned by
18239
+ * the vault in request order, so the key is total and immutable. `total` is
18240
+ * populated and exact: a user's unexecuted withdrawals are a small bounded
18241
+ * set.
18242
+ */
18243
+ pageToken?: string;
17001
18244
  };
17002
18245
  header?: never;
17003
18246
  path?: never;