@0xmonaco/types 1.0.70 → 1.0.73-develop.af0f5d0

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.
@@ -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;
@@ -621,9 +623,11 @@ export interface paths {
621
623
  * Refresh session expiry
622
624
  * @description Refresh session expiry.
623
625
  *
624
- * Extends the expiration of the current session. The request must be signed
626
+ * Refreshes the expiration of the current session. The request must be signed
625
627
  * by the session private key (RFC 9421 or legacy X-Monaco-* headers); no body is
626
- * required.
628
+ * required. Delegated sessions require an active, unexpired delegation;
629
+ * their resulting expiry is capped by the delegation expiry and may move
630
+ * earlier if the owner shortened that delegation.
627
631
  */
628
632
  post: operations["refresh_session"];
629
633
  delete?: never;
@@ -704,6 +708,75 @@ export interface paths {
704
708
  patch?: never;
705
709
  trace?: never;
706
710
  };
711
+ "/api/v1/buildercodes/builder-fee": {
712
+ parameters: {
713
+ query?: never;
714
+ header?: never;
715
+ path?: never;
716
+ cookie?: never;
717
+ };
718
+ get?: never;
719
+ /**
720
+ * Set your builder fee
721
+ * @description Set this application's builder fee.
722
+ *
723
+ * The builder fee is an additional taker fee, in basis points, that this
724
+ * frontend charges its own users on top of Monaco's fee. The application is
725
+ * taken from the authenticated session; the caller must be the application's
726
+ * BuilderCodes payout wallet, and delegated-agent sessions are refused.
727
+ *
728
+ * `bps` must be between 0 and the current builder-fee cap
729
+ * (`builderFeeCapBps` on `GetBuildercodesConfig`) inclusive. The application
730
+ * must be enrolled in BuilderCodes with a payout address. At most two changes
731
+ * are allowed in any rolling 24 hours; changes Monaco makes on the
732
+ * application's behalf do not count. Setting the fee it already has is a
733
+ * no-op that succeeds and does not use up a change.
734
+ *
735
+ * The fee can be set while builder fees are switched off
736
+ * (`builderFeeEnabled` false): it is stored and nothing is charged until they
737
+ * are switched on. A newly stored fee reaches order requests within a few
738
+ * seconds. Sequencer ordering is authoritative for matching-engine policy and
739
+ * enrollment state: an order processed before one of those sequenced changes
740
+ * uses the earlier state, and a later order uses the new state.
741
+ *
742
+ * A refused change is **HTTP 409** / **FAILED_PRECONDITION** when the
743
+ * application is not enrolled with a payout address or has no changes left
744
+ * (REST adds `details.nextChangeAllowedAt`), and **HTTP 400** /
745
+ * **INVALID_ARGUMENT** when `bps` is above the cap.
746
+ */
747
+ put: operations["set_builder_fee"];
748
+ post?: never;
749
+ delete?: never;
750
+ options?: never;
751
+ head?: never;
752
+ patch?: never;
753
+ trace?: never;
754
+ };
755
+ "/api/v1/buildercodes/builder-fee/changes": {
756
+ parameters: {
757
+ query?: never;
758
+ header?: never;
759
+ path?: never;
760
+ cookie?: never;
761
+ };
762
+ /**
763
+ * List your builder-fee changes
764
+ * @description List this application's builder-fee changes.
765
+ *
766
+ * Newest first, cursor-paginated. Includes every change to this
767
+ * application's builder fee: those its payout wallet made (`BUILDER`) and
768
+ * those Monaco made on its behalf (`ADMIN`). The application is taken from
769
+ * the authenticated session.
770
+ */
771
+ get: operations["list_builder_fee_changes"];
772
+ put?: never;
773
+ post?: never;
774
+ delete?: never;
775
+ options?: never;
776
+ head?: never;
777
+ patch?: never;
778
+ trace?: never;
779
+ };
707
780
  "/api/v1/buildercodes/config": {
708
781
  parameters: {
709
782
  query?: never;
@@ -870,6 +943,11 @@ export interface paths {
870
943
  * retry with backoff, and an overload positively wants one. Only an UNTAGGED
871
944
  * availability failure — matching-engine transport, timeout and fail-closed
872
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`.
873
951
  */
874
952
  post: operations["claim_buildercode_rewards"];
875
953
  delete?: never;
@@ -905,7 +983,9 @@ export interface paths {
905
983
  * `leader` handle that names a different leader is refused. `copyExisting`
906
984
  * copies the leader's open positions into the new copy account at creation
907
985
  * (see PreviewFollow for what that costs); it applies only to a create, and
908
- * 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.
909
989
  */
910
990
  post: operations["upsert_follow"];
911
991
  delete?: never;
@@ -914,6 +994,36 @@ export interface paths {
914
994
  patch?: never;
915
995
  trace?: never;
916
996
  };
997
+ "/api/v1/copy-trading/follows/close-positions": {
998
+ parameters: {
999
+ query?: never;
1000
+ header?: never;
1001
+ path?: never;
1002
+ cookie?: never;
1003
+ };
1004
+ get?: never;
1005
+ put?: never;
1006
+ /**
1007
+ * Close all your copy positions
1008
+ * @description Close all your copy positions.
1009
+ *
1010
+ * Closes the copy positions of every live follow of yours, as
1011
+ * CloseFollowPositions does for one: one batch per follow, the follows
1012
+ * kept, and the same limits (not a flatten guarantee; the follows keep
1013
+ * mirroring). A follow whose stop is in progress is listed in
1014
+ * `stoppingFollowIds` and left to its stop. A follow whose close could not
1015
+ * run is listed in `failedFollows` and the others still close. Never gated
1016
+ * by copy trading being switched off or by an operations block; only a
1017
+ * delegated agent session is refused. Shares CloseFollowPositions' rate
1018
+ * limit.
1019
+ */
1020
+ post: operations["close_all_copy_positions"];
1021
+ delete?: never;
1022
+ options?: never;
1023
+ head?: never;
1024
+ patch?: never;
1025
+ trace?: never;
1026
+ };
917
1027
  "/api/v1/copy-trading/follows/preview": {
918
1028
  parameters: {
919
1029
  query?: never;
@@ -965,6 +1075,41 @@ export interface paths {
965
1075
  patch?: never;
966
1076
  trace?: never;
967
1077
  };
1078
+ "/api/v1/copy-trading/follows/{followId}/close-positions": {
1079
+ parameters: {
1080
+ query?: never;
1081
+ header?: never;
1082
+ path?: never;
1083
+ cookie?: never;
1084
+ };
1085
+ get?: never;
1086
+ put?: never;
1087
+ /**
1088
+ * Close a follow's copy positions
1089
+ * @description Close a follow's copy positions.
1090
+ *
1091
+ * Closes every position in the follow's copy account at market (reduce-only,
1092
+ * immediate-or-cancel) and cancels the resting orders and conditional
1093
+ * orders (TP/SL) on its copy risk buckets (a TWAP cannot run on a copy risk
1094
+ * bucket), but keeps the follow: it stays ACTIVE (or CLOSE_ONLY) and the
1095
+ * leader's next trades keep mirroring. StopFollow is the close-and-stop
1096
+ * path. The proceeds stay in the copy account. Not a flatten guarantee:
1097
+ * on a thin or halted market part of a position can stay open
1098
+ * (`positionsNotClosed`), and a leader trade after the close opens copy
1099
+ * positions again; stop the follow to end the copying. A close is never
1100
+ * gated by copy trading being switched off or by an operations block, and
1101
+ * only a delegated agent session is refused. Both close routes share a
1102
+ * small per-account rate limit (about one close per second, burst 5). The
1103
+ * response is sent once the batch is durably logged; each close's fills
1104
+ * arrive on the order, position and copy channels.
1105
+ */
1106
+ post: operations["close_follow_positions"];
1107
+ delete?: never;
1108
+ options?: never;
1109
+ head?: never;
1110
+ patch?: never;
1111
+ trace?: never;
1112
+ };
968
1113
  "/api/v1/copy-trading/follows/{followId}/leader-positions": {
969
1114
  parameters: {
970
1115
  query?: never;
@@ -989,6 +1134,39 @@ export interface paths {
989
1134
  patch?: never;
990
1135
  trace?: never;
991
1136
  };
1137
+ "/api/v1/copy-trading/follows/{followId}/position-margin": {
1138
+ parameters: {
1139
+ query?: never;
1140
+ header?: never;
1141
+ path?: never;
1142
+ cookie?: never;
1143
+ };
1144
+ get?: never;
1145
+ put?: never;
1146
+ /**
1147
+ * Add margin to a copy position
1148
+ * @description Add margin to a copy position (0XM-2971).
1149
+ *
1150
+ * Moves collateral from the follow's copy account into the margin of its
1151
+ * isolated copy position on one trading pair: the position's margin rises
1152
+ * by exactly `amount`, the copy account's remaining collateral falls by the
1153
+ * same, and your margin account is never touched. It lowers the position's
1154
+ * leverage and moves its liquidation price away; it opens no exposure, so
1155
+ * it works while copy trading is switched off and on a CLOSE_ONLY follow.
1156
+ * There is no margin reduction: a follow exits by being stopped. Follow
1157
+ * writes need a master account session (not a delegated agent or a
1158
+ * sub-account). 404 unless the follow is yours; 409 while it is stopping
1159
+ * or once it is stopped. It spends the per-user movement budget withdrawals and collateral transfers
1160
+ * share. It is not idempotent: a retry after a timeout whose first attempt
1161
+ * landed adds the amount twice, so read the follow before retrying.
1162
+ */
1163
+ post: operations["add_follow_position_margin"];
1164
+ delete?: never;
1165
+ options?: never;
1166
+ head?: never;
1167
+ patch?: never;
1168
+ trace?: never;
1169
+ };
992
1170
  "/api/v1/copy-trading/follows/{followId}/stop": {
993
1171
  parameters: {
994
1172
  query?: never;
@@ -1003,8 +1181,11 @@ export interface paths {
1003
1181
  * @description Stop a follow.
1004
1182
  *
1005
1183
  * Stops mirroring the leader. Stopping one of your own follows only; the
1006
- * follow is identified by its id. An exit is never gated beyond ownership,
1007
- * 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.
1008
1189
  */
1009
1190
  post: operations["stop_follow"];
1010
1191
  delete?: never;
@@ -1062,7 +1243,9 @@ export interface paths {
1062
1243
  * TraderCode handle. The profile is replaced as sent: an omitted `bio` or
1063
1244
  * `minAllocation` clears it and an omitted `status` means ACTIVE; an
1064
1245
  * omitted `shareBps` keeps the current share (the platform default on a
1065
- * 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.
1066
1249
  */
1067
1250
  put: operations["upsert_lead_trader"];
1068
1251
  post?: never;
@@ -1190,7 +1373,10 @@ export interface paths {
1190
1373
  *
1191
1374
  * Master accounts only. Creates (or updates, keyed on `agent_address`) a
1192
1375
  * delegation linking the calling owner to an agent wallet, together with the
1193
- * 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.
1194
1380
  */
1195
1381
  post: operations["upsert_delegated_agent"];
1196
1382
  delete?: never;
@@ -1242,7 +1428,10 @@ export interface paths {
1242
1428
  * `ListDelegatedAgentOwners`) and a freshly generated session public key.
1243
1429
  * The new session acts as the owner but records the agent's address for
1244
1430
  * policy enforcement. Requires an active delegation for the (owner, agent)
1245
- * pair.
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
1433
+ * authenticated request and periodic WebSocket session revalidation requires
1434
+ * the backing delegation to remain active and unexpired.
1246
1435
  */
1247
1436
  post: operations["create_delegated_session"];
1248
1437
  delete?: never;
@@ -1266,8 +1455,9 @@ export interface paths {
1266
1455
  * @description Revoke a delegated agent.
1267
1456
  *
1268
1457
  * Master accounts only. Revokes the delegation identified by
1269
- * `delegated_agent_id`. Existing delegated sessions are not invalidated; only
1270
- * future session creation is blocked.
1458
+ * `delegated_agent_id` and its existing delegated sessions. Subsequent signed
1459
+ * requests and session refresh fail; connected WebSockets lose access at
1460
+ * their next periodic session revalidation. Existing orders are not canceled.
1271
1461
  */
1272
1462
  delete: operations["revoke_delegated_agent"];
1273
1463
  options?: never;
@@ -1360,6 +1550,8 @@ export interface paths {
1360
1550
  /**
1361
1551
  * Get my fee tier and pair schedule
1362
1552
  * @description Return the caller's current fee tier, rolling 14-day volumes, and a pair's schedule.
1553
+ *
1554
+ * Volumes and the tier are wallet-wide: the caller's wallet total across every application.
1363
1555
  */
1364
1556
  get: operations["get_my_fee_tier"];
1365
1557
  put?: never;
@@ -1521,6 +1713,29 @@ export interface paths {
1521
1713
  patch?: never;
1522
1714
  trace?: never;
1523
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
+ };
1524
1739
  "/api/v1/margin/accounts/{marginAccountId}/simulate-order-risk": {
1525
1740
  parameters: {
1526
1741
  query?: never;
@@ -1553,6 +1768,30 @@ export interface paths {
1553
1768
  patch?: never;
1554
1769
  trace?: never;
1555
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
+ };
1556
1795
  "/api/v1/margin/parent-margin-account": {
1557
1796
  parameters: {
1558
1797
  query?: never;
@@ -1674,6 +1913,56 @@ export interface paths {
1674
1913
  patch?: never;
1675
1914
  trace?: never;
1676
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
+ };
1677
1966
  "/api/v1/market/funding/history": {
1678
1967
  parameters: {
1679
1968
  query?: never;
@@ -2468,12 +2757,13 @@ export interface paths {
2468
2757
  * Get your referral position
2469
2758
  * @description Read your own referral position (self-scoped).
2470
2759
  *
2471
- * Return the authenticated caller's referral position: their direct (L1)
2472
- * referrer, the total rewards they have earned, and their most recent reward
2473
- * rows. Self-scoped — identity comes only from the session, never a path id,
2760
+ * Return the authenticated caller's referral position: their referral chain
2761
+ * upward (L1, L2 and L3 — who referred them, who referred that wallet, and so
2762
+ * on), the total rewards they have earned, and their most recent reward rows.
2763
+ * Self-scoped — identity comes only from the session, never a path id,
2474
2764
  * so a caller can only ever read their own chain. Every other user is
2475
2765
  * identified by their public wallet address, never an internal id. An empty
2476
- * `referrer` means the caller was not referred.
2766
+ * `referrer` and `upline` mean the caller was not referred.
2477
2767
  */
2478
2768
  get: operations["get_my_referral_position"];
2479
2769
  put?: never;
@@ -2512,6 +2802,41 @@ export interface paths {
2512
2802
  patch?: never;
2513
2803
  trace?: never;
2514
2804
  };
2805
+ "/api/v1/pitpass/referrals/me/tree": {
2806
+ parameters: {
2807
+ query?: never;
2808
+ header?: never;
2809
+ path?: never;
2810
+ cookie?: never;
2811
+ };
2812
+ /**
2813
+ * Get one level of your referral tree
2814
+ * @description Read one level of your own referral tree (self-scoped).
2815
+ *
2816
+ * Return the wallets directly referred by `parent` — the authenticated caller
2817
+ * when `parent` is omitted, otherwise one of the caller's own L1 or L2
2818
+ * referees — one page at a time, newest first. Each node carries its level
2819
+ * relative to the caller, its parent, how many wallets it has referred (so the
2820
+ * client knows whether it can be expanded), and what the caller has earned
2821
+ * from that wallet's own trades. Expanding a node is another call with
2822
+ * `parent` set to that node's wallet; the tree stops at L3, the deepest level
2823
+ * that pays referral rewards.
2824
+ *
2825
+ * Self-scoped — identity comes only from the session. A `parent` that is not
2826
+ * the caller or inside the caller's own L1/L2 downline returns 404, the same
2827
+ * as a wallet that does not exist, so the endpoint cannot be used to read
2828
+ * anyone else's tree. Every node is identified by its public wallet address,
2829
+ * never an internal id.
2830
+ */
2831
+ get: operations["get_my_referral_tree"];
2832
+ put?: never;
2833
+ post?: never;
2834
+ delete?: never;
2835
+ options?: never;
2836
+ head?: never;
2837
+ patch?: never;
2838
+ trace?: never;
2839
+ };
2515
2840
  "/api/v1/pitpass/rewards/balance": {
2516
2841
  parameters: {
2517
2842
  query?: never;
@@ -2554,7 +2879,8 @@ export interface paths {
2554
2879
  * trading balance under the authenticated application, making it tradeable
2555
2880
  * immediately. Ledger-only (one shared vault + one backend ledger) — no
2556
2881
  * on-chain transaction and no gas. Fails with 402 when the rewards balance is
2557
- * insufficient.
2882
+ * insufficient. It spends the per-user movement budget withdrawals and
2883
+ * collateral transfers share.
2558
2884
  */
2559
2885
  post: operations["transfer_rewards"];
2560
2886
  delete?: never;
@@ -2594,7 +2920,13 @@ export interface paths {
2594
2920
  * Submits a MARKET reduce-only close for every open position owned by the
2595
2921
  * caller, optionally filtered to a single trading pair. Best-effort and
2596
2922
  * partial: each position closes independently and per-position failures are
2597
- * reported in `results` rather than aborting the batch.
2923
+ * reported in `results` rather than aborting the batch. Each close draws
2924
+ * one item from the risk-reduction rate limit (an empty call draws one).
2925
+ * The first 100 are charged before anything is sent: over budget, the
2926
+ * whole call is refused with 429 and nothing is closed. Past 100 open
2927
+ * positions the rest are charged 100 at a time as the call reaches them,
2928
+ * and those the budget does not cover are not sent: they come back in
2929
+ * `results` with `RATE_LIMIT_EXCEEDED`, to be retried.
2598
2930
  */
2599
2931
  post: operations["batch_close_all_positions"];
2600
2932
  delete?: never;
@@ -3039,6 +3371,55 @@ export interface components {
3039
3371
  */
3040
3372
  version?: number | null;
3041
3373
  };
3374
+ AddFollowPositionMarginRequest: {
3375
+ /**
3376
+ * Format: uuid
3377
+ * @description The follow's id
3378
+ */
3379
+ followId?: string | null;
3380
+ /**
3381
+ * Format: uuid
3382
+ * @description Trading pair UUID of the copy position to add margin to
3383
+ */
3384
+ tradingPairId?: string | null;
3385
+ /**
3386
+ * @description Margin to add, in quote units: a positive decimal, taken from the follow's copy account
3387
+ * @example 25
3388
+ */
3389
+ amount?: string | null;
3390
+ };
3391
+ AddFollowPositionMarginResponse: {
3392
+ /**
3393
+ * Format: uuid
3394
+ * @description The follow's id
3395
+ */
3396
+ followId?: string | null;
3397
+ /**
3398
+ * Format: uuid
3399
+ * @description Trading pair UUID of the copy position
3400
+ */
3401
+ tradingPairId?: string | null;
3402
+ /**
3403
+ * Format: uuid
3404
+ * @description The copy position's isolated risk bucket
3405
+ */
3406
+ riskBucketId?: string | null;
3407
+ /**
3408
+ * Format: uuid
3409
+ * @description The copy position's id
3410
+ */
3411
+ positionId?: string | null;
3412
+ /**
3413
+ * @description The copy position's margin after the add, in quote units
3414
+ * @example 125
3415
+ */
3416
+ positionMargin?: string | null;
3417
+ /**
3418
+ * @description What the copy account can still put into this position, in quote units, after the add
3419
+ * @example 875
3420
+ */
3421
+ copyAccountAvailable?: string | null;
3422
+ };
3042
3423
  AppUser: {
3043
3424
  /**
3044
3425
  * Format: uuid
@@ -3667,6 +4048,36 @@ export interface components {
3667
4048
  matchResult?: components["schemas"]["MatchResult"];
3668
4049
  error?: components["schemas"]["BatchReplaceError"];
3669
4050
  };
4051
+ BuilderFeeChange: {
4052
+ /**
4053
+ * @description Who made the change: `BUILDER` (this application's payout wallet) or `ADMIN` (Monaco, on the application's behalf).
4054
+ * @example BUILDER
4055
+ * @enum {string|null}
4056
+ */
4057
+ actorType?: "BUILDER" | "ADMIN" | null;
4058
+ /**
4059
+ * @description The lowercase payout wallet address for a `BUILDER` change, or the Monaco operator's email for an `ADMIN` change.
4060
+ * @example 0x0000000000000000000000000000000000000001
4061
+ */
4062
+ actor?: string | null;
4063
+ /**
4064
+ * Format: uint32
4065
+ * @description Builder fee before the change, in basis points.
4066
+ * @example 0
4067
+ */
4068
+ oldBps?: number | null;
4069
+ /**
4070
+ * Format: uint32
4071
+ * @description Builder fee after the change, in basis points.
4072
+ * @example 10
4073
+ */
4074
+ newBps?: number | null;
4075
+ /**
4076
+ * Format: date-time
4077
+ * @description RFC 3339 time of the change.
4078
+ */
4079
+ createdAt?: string | null;
4080
+ };
3670
4081
  BuildercodePayout: {
3671
4082
  /**
3672
4083
  * Format: uuid
@@ -3690,7 +4101,7 @@ export interface components {
3690
4101
  amount?: string | null;
3691
4102
  /**
3692
4103
  * Format: int32
3693
- * @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.
4104
+ * @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.
3694
4105
  * @example 1000
3695
4106
  */
3696
4107
  appliedBps?: number | null;
@@ -3700,7 +4111,7 @@ export interface components {
3700
4111
  */
3701
4112
  createdAt?: string | null;
3702
4113
  /**
3703
- * @description Payout stream this credit belongs to: `REVENUE_SHARE` (the frontend's share of Monaco's fee) or `BUILDER_FEE` (the frontend's own builder fee, paid by the taker). Both land in the same claimable balance.
4114
+ * @description Payout category for this credit: `REVENUE_SHARE` for Monaco revenue sharing or `BUILDER_FEE` for an ordinary builder fee charged to the taker.
3704
4115
  * @example REVENUE_SHARE
3705
4116
  * @enum {string|null}
3706
4117
  */
@@ -3973,6 +4384,37 @@ export interface components {
3973
4384
  /** @description Required when renewing an unexpired lease. Decimal string in JSON. */
3974
4385
  expectedGeneration?: string | null;
3975
4386
  };
4387
+ CloseAllCopyPositionsResponse: {
4388
+ /**
4389
+ * @description Every live follow whose stop is not in progress and whose close ran,
4390
+ * including one with nothing to close (0 orders placed, 0 positions not
4391
+ * closed).
4392
+ */
4393
+ follows?: components["schemas"]["CloseFollowPositionsResponse"][] | null;
4394
+ /** @description Follows whose stop is in progress: their stop closes their positions. */
4395
+ stoppingFollowIds?: string[] | null;
4396
+ /** @description Follows whose close could not run; the other follows still closed. */
4397
+ failedFollows?: components["schemas"]["FollowCloseFailure"][] | null;
4398
+ };
4399
+ CloseFollowPositionsResponse: {
4400
+ /**
4401
+ * Format: uuid
4402
+ * @description The follow's id
4403
+ */
4404
+ followId?: string | null;
4405
+ /**
4406
+ * Format: uint32
4407
+ * @description Reduce-only, immediate-or-cancel close orders placed; each may fill in part
4408
+ * @example 2
4409
+ */
4410
+ closeOrdersPlaced?: number | null;
4411
+ /**
4412
+ * Format: uint32
4413
+ * @description Copy positions still open after the batch (for example a thin or halted market); 0 when the copy account is flat
4414
+ * @example 0
4415
+ */
4416
+ positionsNotClosed?: number | null;
4417
+ };
3976
4418
  ClosePositionRequest: {
3977
4419
  quantity?: string | null;
3978
4420
  closeType?: string | null;
@@ -3986,6 +4428,16 @@ export interface components {
3986
4428
  message?: string | null;
3987
4429
  submittedQuantity?: string | null;
3988
4430
  };
4431
+ CloseSubAccountRequest: {
4432
+ marginAccountId?: string | null;
4433
+ };
4434
+ CloseSubAccountResponse: {
4435
+ marginAccountId?: string | null;
4436
+ /** @description The default margin account that received the remaining collateral. */
4437
+ defaultMarginAccountId?: string | null;
4438
+ /** @description Collateral moved to the default margin account. */
4439
+ amount?: string | null;
4440
+ };
3989
4441
  ClosedTrade: {
3990
4442
  /**
3991
4443
  * Format: uuid
@@ -4014,6 +4466,17 @@ export interface components {
4014
4466
  /** @description Execution time (RFC 3339) */
4015
4467
  closedAt?: string | null;
4016
4468
  };
4469
+ /**
4470
+ * @description One side of a `TransferCollateral`: the spot wallet, or a margin account
4471
+ * and optionally one of its risk buckets.
4472
+ */
4473
+ CollateralTransferEndpoint: {
4474
+ /** @description The spot wallet. Set exactly one of `wallet` and `margin_account_id`. */
4475
+ wallet?: boolean | null;
4476
+ marginAccountId?: string | null;
4477
+ /** @description A risk bucket of `margin_account_id`. */
4478
+ riskBucketId?: string | null;
4479
+ };
4017
4480
  ConditionalOrder: {
4018
4481
  conditionalOrderId?: string | null;
4019
4482
  /** Format: uuid */
@@ -4097,7 +4560,7 @@ export interface components {
4097
4560
  };
4098
4561
  CreateDelegatedSessionResponse: {
4099
4562
  /**
4100
- * @description Session expiry as a Unix timestamp (seconds)
4563
+ * @description Session expiry as a Unix timestamp (seconds), bounded by the delegation expiry when set. Earlier revocation or policy expiry also ends access.
4101
4564
  * @example 1735689599
4102
4565
  */
4103
4566
  expiresAt?: string | null;
@@ -4313,9 +4776,26 @@ export interface components {
4313
4776
  */
4314
4777
  trailingStopOrderId?: string | null;
4315
4778
  };
4316
- CreateTwapOrderRequest: {
4779
+ CreateSubAccountRequest: {
4317
4780
  /**
4318
- * Format: uuid
4781
+ * @description Sub-account key: up to 64 letters, digits, `_`, `-`, `.` or `:`. Keys
4782
+ * starting with `copy:` are reserved, and `default` names the default
4783
+ * margin account.
4784
+ */
4785
+ subaccountKey?: string | null;
4786
+ /** @description Optional display label. */
4787
+ label?: string | null;
4788
+ };
4789
+ CreateSubAccountResponse: {
4790
+ marginAccountId?: string | null;
4791
+ subaccountKey?: string | null;
4792
+ /** @description Values: ACTIVE. */
4793
+ marginAccountState?: string | null;
4794
+ label?: string | null;
4795
+ };
4796
+ CreateTwapOrderRequest: {
4797
+ /**
4798
+ * Format: uuid
4319
4799
  * @description Trading pair UUID
4320
4800
  * @example afae0e16-2d05-4ee9-9ee8-afae0e162d05
4321
4801
  */
@@ -4526,6 +5006,8 @@ export interface components {
4526
5006
  * @description Legacy field; no concurrent open-order cap is enforced. New or updated policies leave it unset.
4527
5007
  */
4528
5008
  maxOpenOrders?: number | null;
5009
+ /** @description IP addresses and CIDR ranges the agent may create its delegated session from, normalized. Empty allows any address. */
5010
+ ipAllowlist?: string[] | null;
4529
5011
  };
4530
5012
  DelegatedAgentOwner: {
4531
5013
  /**
@@ -4684,6 +5166,19 @@ export interface components {
4684
5166
  /** @description FOLLOWER, STOP_LOSS, SKIP_LIMIT, ADMIN or LEADER_SUSPENDED */
4685
5167
  stopReason?: string | null;
4686
5168
  };
5169
+ /** @description A follow whose close could not run. */
5170
+ FollowCloseFailure: {
5171
+ /**
5172
+ * Format: uuid
5173
+ * @description The follow's id
5174
+ */
5175
+ followId?: string | null;
5176
+ /**
5177
+ * @description Why the close could not run, as a fixed sentence; retry the close
5178
+ * @example The copy positions could not be closed right now; retry shortly
5179
+ */
5180
+ reason?: string | null;
5181
+ };
4687
5182
  Follower: {
4688
5183
  /** @description The follower's wallet address (lowercase hex) */
4689
5184
  walletAddress?: string | null;
@@ -4846,12 +5341,13 @@ export interface components {
4846
5341
  * margin account yet.
4847
5342
  *
4848
5343
  * This is NOT trading headroom for existing cross exposure. It is bounded
4849
- * by allocation (principal not earmarked by risk buckets) as well as by
5344
+ * by allocation (net deposits plus settled realized PnL not allocated to
5345
+ * risk buckets) as well as by
4850
5346
  * margin requirements, and an unrealized gain does not raise it: a
4851
5347
  * mark-to-market gain is initial margin against existing cross exposure but
4852
5348
  * may not fund an exit. `MarginAccountSummary.free_collateral` credits that
4853
5349
  * gain in full and remains the trading-margin headroom for existing cross
4854
- * exposure — but a NEW isolated or first-use position allocates principal
5350
+ * exposure — but a NEW isolated or first-use position allocates collateral
4855
5351
  * through the same gate this field measures, so size those from this field.
4856
5352
  *
4857
5353
  * Note the two `margin_*` fields answer opposite questions:
@@ -4993,6 +5489,31 @@ export interface components {
4993
5489
  * @example 1000
4994
5490
  */
4995
5491
  buildercodesBudgetBps?: number | null;
5492
+ /** @description Whether builder fees are currently charged. While false, `builderFeeBps` is stored but no builder fee is charged. */
5493
+ builderFeeEnabled?: boolean | null;
5494
+ /**
5495
+ * Format: uint32
5496
+ * @description This application's stored builder fee in basis points: the additional taker fee it charges its users. The fee charged is this value capped at `builderFeeCapBps`, and 0 while `builderFeeEnabled` is false or the application is not enrolled with a payout address.
5497
+ * @example 10
5498
+ */
5499
+ builderFeeBps?: number | null;
5500
+ /**
5501
+ * Format: uint32
5502
+ * @description The highest builder fee, in basis points, that can currently be set or charged.
5503
+ * @example 100
5504
+ */
5505
+ builderFeeCapBps?: number | null;
5506
+ /**
5507
+ * Format: uint32
5508
+ * @description Builder-fee changes this application can still make in the current rolling 24 hours (at most 2).
5509
+ * @example 2
5510
+ */
5511
+ changesRemaining?: number | null;
5512
+ /**
5513
+ * Format: date-time
5514
+ * @description RFC 3339 time at which the next builder-fee change becomes allowed, or null while `changesRemaining` is above 0.
5515
+ */
5516
+ nextChangeAllowedAt?: string | null;
4996
5517
  };
4997
5518
  /** @description OHLCV candlestick data. */
4998
5519
  GetCandlesResponse: {
@@ -5122,9 +5643,21 @@ export interface components {
5122
5643
  /** Format: uint32 */
5123
5644
  pageSize?: number | null;
5124
5645
  };
5646
+ GetMarginAccountPnlResponse: {
5647
+ marginAccountId?: string | null;
5648
+ /**
5649
+ * @description Decimal string: settled on the account plus still held in its open risk
5650
+ * buckets.
5651
+ */
5652
+ realizedPnl?: string | null;
5653
+ /**
5654
+ * @description Decimal string: the account's open positions repriced at the latest risk
5655
+ * marks.
5656
+ */
5657
+ unrealizedPnl?: string | null;
5658
+ };
5125
5659
  GetMarginAccountSummaryResponse: {
5126
5660
  marginAccountId?: string | null;
5127
- accountState?: string | null;
5128
5661
  equity?: string | null;
5129
5662
  initialMarginRequired?: string | null;
5130
5663
  maintenanceMarginRequired?: string | null;
@@ -5133,23 +5666,23 @@ export interface components {
5133
5666
  * @description The largest amount a transfer-out of this scope will actually accept.
5134
5667
  *
5135
5668
  * NOT a clamped `free_collateral`. Free collateral is equity headroom, and
5136
- * equity includes realized PnL, accrued funding and mark-to-market gains
5137
- * that are not principal a transfer can move — so the two can differ
5138
- * without limit. An unrealized gain never counts toward this figure.
5669
+ * equity includes mark-to-market gains that a transfer cannot move — so
5670
+ * the two can differ without limit. An unrealized gain never counts toward
5671
+ * this figure.
5139
5672
  *
5140
- * For a risk bucket this is capped by the bucket's allocated collateral;
5141
- * for a parent margin account, by deposited collateral that no risk bucket
5142
- * has earmarked.
5673
+ * For a risk bucket this is the bucket's allocated collateral plus its
5674
+ * realized PnL, less what its positions and resting orders require (the
5675
+ * bucket's allocation may go negative, which is how realized profit leaves
5676
+ * a live bucket); for a parent margin account, net deposits plus settled
5677
+ * realized PnL that no risk bucket has allocated.
5143
5678
  *
5144
- * This is the largest accepted transfer-out, NOT a promise that every
5145
- * smaller one is accepted. Acceptance is not monotone in the amount: a risk
5146
- * bucket whose realized loss exceeds its remaining value accepts the full
5147
- * close-out reported here — which settles that loss to the parent margin
5148
- * account — while refusing a partial withdrawal that would leave the bucket
5149
- * holding less collateral than the loss it has already taken. For such a
5150
- * bucket the accepted amounts are everything up to its equity, plus this
5151
- * figure itself, with a gap in between. Size a transfer directly from this
5152
- * field rather than shaving a margin off it.
5679
+ * This is the largest accepted transfer-out, and every smaller amount is
5680
+ * accepted too. It is zero on a risk bucket that is not `NORMAL` (under
5681
+ * liquidation or frozen as bad debt), whose allocation cannot be released,
5682
+ * and on a risk bucket whose realized loss has used up its allocation: that
5683
+ * bucket cannot be released at all, and the parent margin account is
5684
+ * charged at most its allocation, the loss past it being the insurance
5685
+ * fund's.
5153
5686
  */
5154
5687
  withdrawableCollateral?: string | null;
5155
5688
  totalPositionNotional?: string | null;
@@ -5184,6 +5717,16 @@ export interface components {
5184
5717
  copyFollowId?: string | null;
5185
5718
  /** @description On a copy risk bucket row, the followed leader's custom TraderCode handle, when they still hold one */
5186
5719
  copyLeaderHandle?: string | null;
5720
+ /**
5721
+ * @description The risk bucket's lifecycle state. Present only for risk-bucket rows;
5722
+ * a parent margin account has no lifecycle of its own. Values: NORMAL,
5723
+ * PENDING_LIQUIDATION, LIQUIDATING, BAD_DEBT, CLOSED.
5724
+ */
5725
+ riskBucketState?: string | null;
5726
+ /** @description See `MarginAccountSummary.subaccount_key`. */
5727
+ subaccountKey?: string | null;
5728
+ /** @description See `MarginAccountSummary.margin_account_state`. */
5729
+ marginAccountState?: string | null;
5187
5730
  };
5188
5731
  GetMarkPriceResponse: {
5189
5732
  /** Format: uuid */
@@ -5337,22 +5880,22 @@ export interface components {
5337
5880
  GetMyFeeTierResponse: {
5338
5881
  /**
5339
5882
  * Format: int32
5340
- * @description Caller's resolved tier (1–6) from stored weighted 14-day volume
5883
+ * @description Caller's resolved tier (1–6) from their wallet's stored weighted 14-day volume
5341
5884
  * @example 2
5342
5885
  */
5343
5886
  currentTierLevel?: number | null;
5344
5887
  /**
5345
- * @description Caller's weighted 14-day volume (perp + 2.5× spot)
5888
+ * @description Caller's weighted 14-day volume (perp + 2.5× spot), summed across every application the wallet trades through
5346
5889
  * @example 7500000
5347
5890
  */
5348
5891
  weightedVolume14d?: string | null;
5349
5892
  /**
5350
- * @description Caller's rolling 14-day spot volume
5893
+ * @description Caller's rolling 14-day spot volume, summed across every application the wallet trades through
5351
5894
  * @example 1000000
5352
5895
  */
5353
5896
  spotVolume14d?: string | null;
5354
5897
  /**
5355
- * @description Caller's rolling 14-day perp volume
5898
+ * @description Caller's rolling 14-day perp volume, summed across every application the wallet trades through
5356
5899
  * @example 5000000
5357
5900
  */
5358
5901
  perpVolume14d?: string | null;
@@ -5380,7 +5923,7 @@ export interface components {
5380
5923
  };
5381
5924
  GetMyReferralPositionResponse: {
5382
5925
  /**
5383
- * @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.
5926
+ * @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.
5384
5927
  * @example 0x0000000000000000000000000000000000000002
5385
5928
  */
5386
5929
  referrer?: string | null;
@@ -5396,6 +5939,21 @@ export interface components {
5396
5939
  referrerDisplay?: string | null;
5397
5940
  /** @description The caller's most recent reward rows, newest first. Bounded server-side — not the full history. */
5398
5941
  rewards?: components["schemas"]["ReferralRewardEntry"][] | null;
5942
+ /** @description The caller's referral chain upward, nearest first: L1 (who referred the caller), then L2 (who referred them), then L3. At most three entries; 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. */
5943
+ upline?: components["schemas"]["ReferralUplineEntry"][] | null;
5944
+ };
5945
+ GetMyReferralTreeResponse: {
5946
+ /** @description Wallet address whose referees `nodes` lists — the caller's own wallet when the request omitted `parent`. */
5947
+ parent?: string | null;
5948
+ /**
5949
+ * Format: int32
5950
+ * @description Depth of `parent` below the caller: 0 for the caller, 1 or 2 for a referee being expanded. Every node is one level deeper.
5951
+ */
5952
+ parentLevel?: number | null;
5953
+ /** @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. */
5954
+ nodes?: components["schemas"]["ReferralTreeNode"][] | null;
5955
+ /** @description Cursor for the next page; empty when there are no more. */
5956
+ nextPageToken?: string | null;
5399
5957
  };
5400
5958
  /** @description Latest public open interest for a trading pair. */
5401
5959
  GetOpenInterestResponse: {
@@ -5633,7 +6191,7 @@ export interface components {
5633
6191
  */
5634
6192
  batchId?: string | null;
5635
6193
  /**
5636
- * @description Stable terminal cause for a cancelled order: USER_REQUESTED, REPLACED, LIQUIDATION, INSUFFICIENT_MARGIN, REDUCE_ONLY_EXHAUSTED, POSITION_CLOSED, OCO_SIBLING_TRIGGERED, or SYSTEM
6194
+ * @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, 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.
5637
6195
  * @example REDUCE_ONLY_EXHAUSTED
5638
6196
  */
5639
6197
  terminalReason?: string | null;
@@ -5818,6 +6376,18 @@ export interface components {
5818
6376
  total?: components["schemas"]["PortfolioMarginTotal"];
5819
6377
  positions?: components["schemas"]["PortfolioMarginPositionCounts"];
5820
6378
  riskBuckets?: components["schemas"]["PortfolioRiskBucket"][] | null;
6379
+ /**
6380
+ * @description The margin account `total`, `positions` and `risk_buckets` describe;
6381
+ * absent when the caller has no margin account yet.
6382
+ */
6383
+ marginAccountId?: string | null;
6384
+ /**
6385
+ * @description With `include_accounts`: every open margin account of the caller, the
6386
+ * default one first, then sub-accounts by key.
6387
+ */
6388
+ accounts?: components["schemas"]["PortfolioMarginAccount"][] | null;
6389
+ /** @description With `include_accounts`: the sum of `accounts`' totals. */
6390
+ ownerTotal?: components["schemas"]["PortfolioMarginTotal"] | null;
5821
6391
  };
5822
6392
  GetPortfolioPerformanceResponse: {
5823
6393
  window?: components["schemas"]["PortfolioSeriesWindow"];
@@ -6071,7 +6641,7 @@ export interface components {
6071
6641
  cumFees?: string | null;
6072
6642
  /**
6073
6643
  * Format: int64
6074
- * @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. A live frame is ranked only when it is a faithful projection of the row persisted at that sequence: in practice the fills that leave a position open. Frames that re-read live risk state after sequencing (funding, margin_added/margin_reduced) and terminal frames (which report size 0 and LIQUIDATED, while the stored row keeps its size and records CLOSED) omit the version even though the mutation did advance the persisted one, so an absent version never implies that nothing was persisted. 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.
6644
+ * @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.
6075
6645
  * @example 918342
6076
6646
  */
6077
6647
  version?: number | null;
@@ -6797,6 +7367,12 @@ export interface components {
6797
7367
  */
6798
7368
  totalPages?: number | null;
6799
7369
  };
7370
+ ListBuilderFeeChangesResponse: {
7371
+ /** @description Builder-fee changes, newest first. */
7372
+ changes?: components["schemas"]["BuilderFeeChange"][] | null;
7373
+ /** @description Cursor for the next page; empty when there are no more. */
7374
+ nextPageToken?: string | null;
7375
+ };
6800
7376
  ListBuildercodePayoutsResponse: {
6801
7377
  /** @description Per-trade credits, newest first. */
6802
7378
  payouts?: components["schemas"]["BuildercodePayout"][] | null;
@@ -7132,7 +7708,6 @@ export interface components {
7132
7708
  MarginAccountSummary: {
7133
7709
  /** @description Parent margin account UUID. */
7134
7710
  marginAccountId?: string | null;
7135
- accountState?: string | null;
7136
7711
  equity?: string | null;
7137
7712
  initialMarginRequired?: string | null;
7138
7713
  maintenanceMarginRequired?: string | null;
@@ -7141,23 +7716,23 @@ export interface components {
7141
7716
  * @description The largest amount a transfer-out of this scope will actually accept.
7142
7717
  *
7143
7718
  * NOT a clamped `free_collateral`. Free collateral is equity headroom, and
7144
- * equity includes realized PnL, accrued funding and mark-to-market gains
7145
- * that are not principal a transfer can move — so the two can differ
7146
- * without limit. An unrealized gain never counts toward this figure.
7719
+ * equity includes mark-to-market gains that a transfer cannot move — so
7720
+ * the two can differ without limit. An unrealized gain never counts toward
7721
+ * this figure.
7147
7722
  *
7148
- * For a risk bucket this is capped by the bucket's allocated collateral;
7149
- * for a parent margin account, by deposited collateral that no risk bucket
7150
- * has earmarked.
7723
+ * For a risk bucket this is the bucket's allocated collateral plus its
7724
+ * realized PnL, less what its positions and resting orders require (the
7725
+ * bucket's allocation may go negative, which is how realized profit leaves
7726
+ * a live bucket); for a parent margin account, net deposits plus settled
7727
+ * realized PnL that no risk bucket has allocated.
7151
7728
  *
7152
- * This is the largest accepted transfer-out, NOT a promise that every
7153
- * smaller one is accepted. Acceptance is not monotone in the amount: a risk
7154
- * bucket whose realized loss exceeds its remaining value accepts the full
7155
- * close-out reported here — which settles that loss to the parent margin
7156
- * account — while refusing a partial withdrawal that would leave the bucket
7157
- * holding less collateral than the loss it has already taken. For such a
7158
- * bucket the accepted amounts are everything up to its equity, plus this
7159
- * figure itself, with a gap in between. Size a transfer directly from this
7160
- * field rather than shaving a margin off it.
7729
+ * This is the largest accepted transfer-out, and every smaller amount is
7730
+ * accepted too. It is zero on a risk bucket that is not `NORMAL` (under
7731
+ * liquidation or frozen as bad debt), whose allocation cannot be released,
7732
+ * and on a risk bucket whose realized loss has used up its allocation: that
7733
+ * bucket cannot be released at all, and the parent margin account is
7734
+ * charged at most its allocation, the loss past it being the insurance
7735
+ * fund's.
7161
7736
  */
7162
7737
  withdrawableCollateral?: string | null;
7163
7738
  totalPositionNotional?: string | null;
@@ -7223,6 +7798,22 @@ export interface components {
7223
7798
  copyFollowId?: string | null;
7224
7799
  /** @description On a copy risk bucket row, the followed leader's custom TraderCode handle, when they still hold one */
7225
7800
  copyLeaderHandle?: string | null;
7801
+ /**
7802
+ * @description The risk bucket's lifecycle state. Present only for risk-bucket rows;
7803
+ * a parent margin account has no lifecycle of its own. Values: NORMAL,
7804
+ * PENDING_LIQUIDATION, LIQUIDATING, BAD_DEBT, CLOSED.
7805
+ */
7806
+ riskBucketState?: string | null;
7807
+ /**
7808
+ * @description The margin account's sub-account key; `default` is the default margin
7809
+ * account.
7810
+ */
7811
+ subaccountKey?: string | null;
7812
+ /**
7813
+ * @description The margin account's state. Values: ACTIVE, CLOSED (a closed
7814
+ * sub-account).
7815
+ */
7816
+ marginAccountState?: string | null;
7226
7817
  };
7227
7818
  MatchResult: {
7228
7819
  /**
@@ -7543,6 +8134,17 @@ export interface components {
7543
8134
  */
7544
8135
  positions?: string | null;
7545
8136
  };
8137
+ /** @description One of the caller's open margin accounts in the owner rollup. */
8138
+ PortfolioMarginAccount: {
8139
+ marginAccountId?: string | null;
8140
+ /** @description `default` for the default margin account, else the sub-account's key. */
8141
+ subaccountKey?: string | null;
8142
+ /**
8143
+ * @description The account's totals. `withdrawable_collateral` here is the persisted
8144
+ * reconstruction of the engine's bound.
8145
+ */
8146
+ total?: components["schemas"]["PortfolioMarginTotal"] | null;
8147
+ };
7546
8148
  PortfolioMarginPositionCounts: {
7547
8149
  total?: string | null;
7548
8150
  cross?: string | null;
@@ -7560,18 +8162,17 @@ export interface components {
7560
8162
  * the bound the engine enforces on transfers-out and withdrawals, and
7561
8163
  * therefore also the effective ceiling on funding new isolated or
7562
8164
  * first-use order capacity, because allocating collateral to a risk
7563
- * bucket passes through the same principal-gated door.
8165
+ * bucket passes through the same capacity-gated door.
7564
8166
  *
7565
8167
  * NOT a clamped `parent_available_collateral`. That field is
7566
- * `free_collateral`, an equity figure: it credits settled realized PnL,
7567
- * accrued funding, and mark-to-market gains that a transfer-out cannot
7568
- * move, so the two can differ without limit. This bound never credits an
7569
- * unrealized gain. Under the default capacity basis it also excludes
7570
- * non-principal balances such as banked realized PnL:
7571
- * `min(deposited principal - bucket allocations,
7572
- * free_collateral - max(unrealized_pnl, 0))`, floored at zero. Whatever
7573
- * the engine's configured capacity basis, this is the bound its gates
7574
- * actually enforce. It agrees with
8168
+ * `free_collateral`, an equity figure: it credits mark-to-market gains
8169
+ * and realized PnL still held in open risk buckets, which a transfer-out
8170
+ * of the parent cannot move, so the two can differ without limit. This bound never credits an
8171
+ * unrealized gain. It counts net deposits plus the account's settled
8172
+ * realized PnL and funding, less what risk buckets have allocated:
8173
+ * `min(net deposits + settled realized PnL - bucket allocations,
8174
+ * free_collateral - max(unrealized_pnl, 0))`, floored at zero. This is the
8175
+ * bound the engine's gates actually enforce. It agrees with
7575
8176
  * `MarginAccountSummary.withdrawable_collateral` up to quote-decimal
7576
8177
  * truncation: this surface truncates toward zero at the quote asset's
7577
8178
  * precision, while the margin-accounts surface may carry sub-tick tails.
@@ -7625,14 +8226,15 @@ export interface components {
7625
8226
  * accept — the bound enforced on bucket collateral withdrawals.
7626
8227
  *
7627
8228
  * NOT a clamped `free_collateral`: free collateral is equity headroom and
7628
- * credits realized PnL and mark-to-market gains that a transfer-out cannot
7629
- * move. This bound is capped by the bucket's settled capacity (its
7630
- * allocated collateral, under the default capacity basis), and an
7631
- * unrealized gain never raises it.
8229
+ * credits mark-to-market gains that a transfer-out cannot move. This bound
8230
+ * is the bucket's allocated collateral plus its realized PnL, less funding
8231
+ * paid, unrealized losses and the margin its positions and resting orders
8232
+ * require. Realized profit can leave a live bucket this way (the bucket's
8233
+ * allocation may go negative); an unrealized gain never raises it.
7632
8234
  *
7633
- * This is the largest accepted transfer-out, NOT a promise that every
7634
- * smaller one is accepted: an underwater flat bucket accepts its full
7635
- * close-out while refusing partial withdrawals below it. Agrees with the
8235
+ * This is the largest accepted transfer-out, and every smaller amount is
8236
+ * accepted too. It is zero on a risk bucket that is not `NORMAL` and on one
8237
+ * whose realized loss has used up its allocation. Agrees with the
7636
8238
  * risk-bucket rows' `MarginAccountSummary.withdrawable_collateral` up to
7637
8239
  * quote-decimal truncation (this surface truncates toward zero; that one
7638
8240
  * may carry sub-tick tails).
@@ -7882,7 +8484,7 @@ export interface components {
7882
8484
  cumFees?: string | null;
7883
8485
  /**
7884
8486
  * Format: int64
7885
- * @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. A live frame is ranked only when it is a faithful projection of the row persisted at that sequence: in practice the fills that leave a position open. Frames that re-read live risk state after sequencing (funding, margin_added/margin_reduced) and terminal frames (which report size 0 and LIQUIDATED, while the stored row keeps its size and records CLOSED) omit the version even though the mutation did advance the persisted one, so an absent version never implies that nothing was persisted. 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.
8487
+ * @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.
7886
8488
  * @example 918342
7887
8489
  */
7888
8490
  version?: number | null;
@@ -8290,6 +8892,50 @@ export interface components {
8290
8892
  */
8291
8893
  sourceDisplay?: string | null;
8292
8894
  };
8895
+ /** @description One wallet in the caller's referral tree. */
8896
+ ReferralTreeNode: {
8897
+ /**
8898
+ * @description Public wallet address of this referee. Never an internal id.
8899
+ * @example 0x0000000000000000000000000000000000000004
8900
+ */
8901
+ wallet?: string | null;
8902
+ /** @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. */
8903
+ display?: string | null;
8904
+ /**
8905
+ * Format: int32
8906
+ * @description Depth below the caller: 1 (the caller referred this wallet), 2, or 3.
8907
+ */
8908
+ level?: number | null;
8909
+ /** @description Wallet address of the referrer of this node — the caller for a level-1 node. */
8910
+ parent?: string | null;
8911
+ /**
8912
+ * Format: date-time
8913
+ * @description RFC 3339 time this wallet signed up under its parent.
8914
+ */
8915
+ referredAt?: string | null;
8916
+ /**
8917
+ * Format: uint32
8918
+ * @description How many wallets this node has referred. Expand the node (request it as `parent`) when this is above 0. Always 0 at level 3, the deepest level shown.
8919
+ */
8920
+ refereeCount?: number | null;
8921
+ /** @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. */
8922
+ totalEarned?: string | null;
8923
+ };
8924
+ /** @description One ancestor in the caller's referral chain. */
8925
+ ReferralUplineEntry: {
8926
+ /**
8927
+ * @description Public wallet address of the ancestor. Never an internal id.
8928
+ * @example 0x0000000000000000000000000000000000000002
8929
+ */
8930
+ wallet?: string | null;
8931
+ /** @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. */
8932
+ display?: string | null;
8933
+ /**
8934
+ * Format: int32
8935
+ * @description How far above the caller this ancestor is: 1 (the caller's direct referrer), 2, or 3.
8936
+ */
8937
+ level?: number | null;
8938
+ };
8293
8939
  RefreshManagedMarketQuotesRequest: {
8294
8940
  launchId?: string | null;
8295
8941
  ownerId?: string | null;
@@ -8300,7 +8946,7 @@ export interface components {
8300
8946
  RefreshResponse: {
8301
8947
  /**
8302
8948
  * Format: int32
8303
- * @description Unix timestamp when the session expires after refresh
8949
+ * @description Unix timestamp when the session expires after refresh. For delegated sessions, bounded by the active delegation expiry when set.
8304
8950
  * @example 1699876543
8305
8951
  */
8306
8952
  expiresAt?: number | null;
@@ -8620,6 +9266,39 @@ export interface components {
8620
9266
  */
8621
9267
  isCustom?: boolean | null;
8622
9268
  };
9269
+ SetBuilderFeeRequest: {
9270
+ /**
9271
+ * Format: uint32
9272
+ * @description New builder fee in basis points, from 0 up to the current `builderFeeCapBps` inclusive. 0 stops charging a builder fee.
9273
+ * @example 10
9274
+ */
9275
+ bps: number;
9276
+ };
9277
+ SetBuilderFeeResponse: {
9278
+ /**
9279
+ * Format: uint32
9280
+ * @description The builder fee now stored, in basis points.
9281
+ * @example 10
9282
+ */
9283
+ builderFeeBps?: number | null;
9284
+ /**
9285
+ * Format: uint32
9286
+ * @description The builder fee this change replaced, in basis points. Equal to `builderFeeBps` when the request set the fee it already had, which changes nothing.
9287
+ * @example 0
9288
+ */
9289
+ previousBuilderFeeBps?: number | null;
9290
+ /**
9291
+ * Format: uint32
9292
+ * @description Builder-fee changes this application can still make in the current rolling 24 hours (at most 2).
9293
+ * @example 1
9294
+ */
9295
+ changesRemaining?: number | null;
9296
+ /**
9297
+ * Format: date-time
9298
+ * @description RFC 3339 time at which the next builder-fee change becomes allowed, or null while `changesRemaining` is above 0.
9299
+ */
9300
+ nextChangeAllowedAt?: string | null;
9301
+ };
8623
9302
  SetSelfTradePreventionDefaultRequest: {
8624
9303
  /**
8625
9304
  * @description The self-trade-prevention mode applied when an order from this wallet would match the wallet family's own resting order and the order names no override: `CANCEL_MAKER` (cancel the resting order — the platform default), `CANCEL_TAKER` (cancel the incoming order), `CANCEL_BOTH`, or `SKIP` (trade around own orders). Input is case-insensitive.
@@ -8916,6 +9595,12 @@ export interface components {
8916
9595
  * @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.
8917
9596
  */
8918
9597
  slippageToleranceBps?: number | null;
9598
+ /**
9599
+ * @description The margin account the preview runs against: the default margin account
9600
+ * (the default) or any of the caller's open sub-accounts, previewing that
9601
+ * account's own risk buckets.
9602
+ */
9603
+ marginAccountId?: string | null;
8919
9604
  };
8920
9605
  StopFollowResponse: {
8921
9606
  /**
@@ -9391,6 +10076,25 @@ export interface components {
9391
10076
  asset?: string | null;
9392
10077
  amount?: string | null;
9393
10078
  };
10079
+ TransferCollateralRequest: {
10080
+ /** @description Collateral asset symbol or address. */
10081
+ asset?: string | null;
10082
+ amount?: string | null;
10083
+ /** @description Where the collateral comes from. */
10084
+ from?: components["schemas"]["CollateralTransferEndpoint"] | null;
10085
+ /** @description Where the collateral goes. */
10086
+ to?: components["schemas"]["CollateralTransferEndpoint"] | null;
10087
+ };
10088
+ TransferCollateralResponse: {
10089
+ movementId?: string | null;
10090
+ amount?: string | null;
10091
+ /** @description The source margin account, when the source is one. */
10092
+ fromMarginAccountId?: string | null;
10093
+ /** @description The destination margin account, when the destination is one. */
10094
+ toMarginAccountId?: string | null;
10095
+ /** @description The destination risk bucket, when the destination is one. */
10096
+ toRiskBucketId?: string | null;
10097
+ };
9394
10098
  TransferCollateralToMarginAccountRequest: {
9395
10099
  /** @description Parent margin account UUID that receives collateral. */
9396
10100
  marginAccountId?: string | null;
@@ -9495,6 +10199,13 @@ export interface components {
9495
10199
  * row is stale (close/reopen race).
9496
10200
  */
9497
10201
  applyToPositionMargin?: boolean | null;
10202
+ /**
10203
+ * @description The margin account whose risk bucket is funded: the default margin
10204
+ * account (the default) or any of the caller's open sub-accounts, which
10205
+ * fund their own risk buckets from their own collateral. A copy-trading
10206
+ * sub-account's buckets belong to its follow and are refused.
10207
+ */
10208
+ marginAccountId?: string | null;
9498
10209
  };
9499
10210
  TransferRewardsRequest: {
9500
10211
  /**
@@ -9763,12 +10474,12 @@ export interface components {
9763
10474
  };
9764
10475
  UpdatedFields: {
9765
10476
  /**
9766
- * @description New price (if changed)
10477
+ * @description The replacement's limit price: the requested price, or the original order's price when price was omitted.
9767
10478
  * @example 35500.00
9768
10479
  */
9769
10480
  price?: string | null;
9770
10481
  /**
9771
- * @description New quantity (if changed)
10482
+ * @description The replacement's total quantity: the requested quantity, or the original order's total when quantity was omitted. It is not the resting size: the replacement rests this total minus the already-filled amount, so a 100-lot with 60 filled reports 100 here and rests 40. Read the order's remainingQuantity for the resting size. Margin reduce-only replacements are the exception: this is the close size placed, which is the requested quantity or, when omitted, the original's remaining quantity.
9772
10483
  * @example 0.7
9773
10484
  */
9774
10485
  quantity?: string | null;
@@ -9785,21 +10496,21 @@ export interface components {
9785
10496
  */
9786
10497
  name?: string | null;
9787
10498
  /**
9788
- * @description Optional delegation expiry timestamp (ISO 8601). Omit for no expiry.
10499
+ * @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.
9789
10500
  * @example 2026-12-31T23:59:59Z
9790
10501
  */
9791
10502
  expiresAt?: string | null;
9792
10503
  /**
9793
- * @description Required JSON array of actions the agent may perform: CREATE_ORDER, CANCEL_ORDER, REPLACE_ORDER. An empty array permits no actions.
10504
+ * @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.
9794
10505
  * @example [
9795
10506
  * "CREATE_ORDER",
9796
10507
  * "CANCEL_ORDER"
9797
10508
  * ]
9798
10509
  */
9799
10510
  allowedActions: string[];
9800
- /** @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. */
10511
+ /** @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. */
9801
10512
  allowedTradingPairIds: string[];
9802
- /** @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. */
10513
+ /** @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. */
9803
10514
  allowedMarginAccountIds?: string[] | null;
9804
10515
  /**
9805
10516
  * @description Optional JSON array of permitted order types (LIMIT, MARKET). Omitted, null, or [] means unrestricted order types.
@@ -9830,6 +10541,13 @@ export interface components {
9830
10541
  * @description Unsupported legacy field. Requests that set maxOpenOrders are rejected; no concurrent open-order cap is enforced. Omit this field.
9831
10542
  */
9832
10543
  maxOpenOrders?: number | null;
10544
+ /**
10545
+ * @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.
10546
+ * @example [
10547
+ * "203.0.113.0/24"
10548
+ * ]
10549
+ */
10550
+ ipAllowlist?: string[] | null;
9833
10551
  };
9834
10552
  UpsertFollowRequest: {
9835
10553
  /**
@@ -10446,7 +11164,19 @@ export interface operations {
10446
11164
  };
10447
11165
  get_portfolio_margin: {
10448
11166
  parameters: {
10449
- query?: never;
11167
+ query?: {
11168
+ /**
11169
+ * @description One of the caller's margin accounts (the default one or a sub-account) to
11170
+ * describe instead of the default one: `total`, `positions` and
11171
+ * `risk_buckets` are then that account's own.
11172
+ */
11173
+ marginAccountId?: string;
11174
+ /**
11175
+ * @description Also return `accounts`, one row per open margin account of the caller,
11176
+ * and `owner_total`, their sum: the owner rollup across sub-accounts.
11177
+ */
11178
+ includeAccounts?: boolean;
11179
+ };
10450
11180
  header?: never;
10451
11181
  path?: never;
10452
11182
  cookie?: never;
@@ -10808,6 +11538,13 @@ export interface operations {
10808
11538
  };
10809
11539
  content?: never;
10810
11540
  };
11541
+ /** @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 */
11542
+ 429: {
11543
+ headers: {
11544
+ [name: string]: unknown;
11545
+ };
11546
+ content?: never;
11547
+ };
10811
11548
  /** @description Internal server error */
10812
11549
  500: {
10813
11550
  headers: {
@@ -11728,6 +12465,135 @@ export interface operations {
11728
12465
  };
11729
12466
  };
11730
12467
  };
12468
+ set_builder_fee: {
12469
+ parameters: {
12470
+ query?: never;
12471
+ header?: never;
12472
+ path?: never;
12473
+ cookie?: never;
12474
+ };
12475
+ requestBody: {
12476
+ content: {
12477
+ "application/json": components["schemas"]["SetBuilderFeeRequest"];
12478
+ };
12479
+ };
12480
+ responses: {
12481
+ /** @description OK */
12482
+ 200: {
12483
+ headers: {
12484
+ [name: string]: unknown;
12485
+ };
12486
+ content: {
12487
+ "application/json": components["schemas"]["SetBuilderFeeResponse"];
12488
+ };
12489
+ };
12490
+ /** @description bps is above the current builder-fee cap (gRPC: INVALID_ARGUMENT) */
12491
+ 400: {
12492
+ headers: {
12493
+ [name: string]: unknown;
12494
+ };
12495
+ content?: never;
12496
+ };
12497
+ /** @description Authentication required */
12498
+ 401: {
12499
+ headers: {
12500
+ [name: string]: unknown;
12501
+ };
12502
+ content?: never;
12503
+ };
12504
+ /** @description Refused: BuilderCodes is disabled, the caller is delegated, or the caller is not this application's payout wallet (gRPC: PERMISSION_DENIED) */
12505
+ 403: {
12506
+ headers: {
12507
+ [name: string]: unknown;
12508
+ };
12509
+ content?: never;
12510
+ };
12511
+ /** @description Authenticated application not found (gRPC: NOT_FOUND) */
12512
+ 404: {
12513
+ headers: {
12514
+ [name: string]: unknown;
12515
+ };
12516
+ content?: never;
12517
+ };
12518
+ /** @description The application is not enrolled in BuilderCodes with a payout address, or it has already made two changes in the last 24 hours; the latter carries `details.nextChangeAllowedAt` (gRPC: FAILED_PRECONDITION) */
12519
+ 409: {
12520
+ headers: {
12521
+ [name: string]: unknown;
12522
+ };
12523
+ content?: never;
12524
+ };
12525
+ /** @description Internal server error */
12526
+ 500: {
12527
+ headers: {
12528
+ [name: string]: unknown;
12529
+ };
12530
+ content?: never;
12531
+ };
12532
+ };
12533
+ };
12534
+ list_builder_fee_changes: {
12535
+ parameters: {
12536
+ query?: {
12537
+ /** @description Items per page (max 100) */
12538
+ pageSize?: number;
12539
+ /**
12540
+ * @description Opaque cursor from a previous response's `nextPageToken`; omit or send an
12541
+ * empty string for the first page.
12542
+ */
12543
+ pageToken?: string;
12544
+ };
12545
+ header?: never;
12546
+ path?: never;
12547
+ cookie?: never;
12548
+ };
12549
+ requestBody?: never;
12550
+ responses: {
12551
+ /** @description OK */
12552
+ 200: {
12553
+ headers: {
12554
+ [name: string]: unknown;
12555
+ };
12556
+ content: {
12557
+ "application/json": components["schemas"]["ListBuilderFeeChangesResponse"];
12558
+ };
12559
+ };
12560
+ /** @description Invalid page size or page token */
12561
+ 400: {
12562
+ headers: {
12563
+ [name: string]: unknown;
12564
+ };
12565
+ content?: never;
12566
+ };
12567
+ /** @description Authentication required */
12568
+ 401: {
12569
+ headers: {
12570
+ [name: string]: unknown;
12571
+ };
12572
+ content?: never;
12573
+ };
12574
+ /** @description Refused: BuilderCodes is disabled, the caller is delegated, or the caller is not this application's payout wallet (gRPC: PERMISSION_DENIED) */
12575
+ 403: {
12576
+ headers: {
12577
+ [name: string]: unknown;
12578
+ };
12579
+ content?: never;
12580
+ };
12581
+ /** @description Authenticated application not found (gRPC: NOT_FOUND) */
12582
+ 404: {
12583
+ headers: {
12584
+ [name: string]: unknown;
12585
+ };
12586
+ content?: never;
12587
+ };
12588
+ /** @description Internal server error */
12589
+ 500: {
12590
+ headers: {
12591
+ [name: string]: unknown;
12592
+ };
12593
+ content?: never;
12594
+ };
12595
+ };
12596
+ };
11731
12597
  get_buildercodes_config: {
11732
12598
  parameters: {
11733
12599
  query?: never;
@@ -11783,7 +12649,7 @@ export interface operations {
11783
12649
  page?: number;
11784
12650
  /** @description Items per page (max 100) */
11785
12651
  pageSize?: number;
11786
- /** @description Only return BuilderCodes payouts of this payout kind: REVENUE_SHARE (the frontend's share of Monaco's fee) or BUILDER_FEE (the frontend's own builder fee). Omit for every kind. */
12652
+ /** @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. */
11787
12653
  kind?: "REVENUE_SHARE" | "BUILDER_FEE";
11788
12654
  };
11789
12655
  header?: never;
@@ -11977,6 +12843,13 @@ export interface operations {
11977
12843
  };
11978
12844
  content?: never;
11979
12845
  };
12846
+ /** @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) */
12847
+ 429: {
12848
+ headers: {
12849
+ [name: string]: unknown;
12850
+ };
12851
+ content?: never;
12852
+ };
11980
12853
  /** @description Internal server error */
11981
12854
  500: {
11982
12855
  headers: {
@@ -12106,6 +12979,13 @@ export interface operations {
12106
12979
  };
12107
12980
  content?: never;
12108
12981
  };
12982
+ /** @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 */
12983
+ 429: {
12984
+ headers: {
12985
+ [name: string]: unknown;
12986
+ };
12987
+ content?: never;
12988
+ };
12109
12989
  /** @description Internal server error */
12110
12990
  500: {
12111
12991
  headers: {
@@ -12122,6 +13002,75 @@ export interface operations {
12122
13002
  };
12123
13003
  };
12124
13004
  };
13005
+ close_all_copy_positions: {
13006
+ parameters: {
13007
+ query?: never;
13008
+ header?: never;
13009
+ path?: never;
13010
+ cookie?: never;
13011
+ };
13012
+ requestBody?: never;
13013
+ responses: {
13014
+ /** @description OK */
13015
+ 200: {
13016
+ headers: {
13017
+ [name: string]: unknown;
13018
+ };
13019
+ content: {
13020
+ "application/json": components["schemas"]["CloseAllCopyPositionsResponse"];
13021
+ };
13022
+ };
13023
+ /** @description The close was refused */
13024
+ 400: {
13025
+ headers: {
13026
+ [name: string]: unknown;
13027
+ };
13028
+ content?: never;
13029
+ };
13030
+ /** @description Authentication required */
13031
+ 401: {
13032
+ headers: {
13033
+ [name: string]: unknown;
13034
+ };
13035
+ content?: never;
13036
+ };
13037
+ /** @description Delegated agent sessions cannot close copy positions */
13038
+ 403: {
13039
+ headers: {
13040
+ [name: string]: unknown;
13041
+ };
13042
+ content?: never;
13043
+ };
13044
+ /** @description Copy trading is not available */
13045
+ 409: {
13046
+ headers: {
13047
+ [name: string]: unknown;
13048
+ };
13049
+ content?: never;
13050
+ };
13051
+ /** @description Copy position close rate limit exceeded; retry after the interval in details.retryAfter */
13052
+ 429: {
13053
+ headers: {
13054
+ [name: string]: unknown;
13055
+ };
13056
+ content?: never;
13057
+ };
13058
+ /** @description Internal server error */
13059
+ 500: {
13060
+ headers: {
13061
+ [name: string]: unknown;
13062
+ };
13063
+ content?: never;
13064
+ };
13065
+ /** @description The matching engine is unavailable; retry */
13066
+ 503: {
13067
+ headers: {
13068
+ [name: string]: unknown;
13069
+ };
13070
+ content?: never;
13071
+ };
13072
+ };
13073
+ };
12125
13074
  preview_follow: {
12126
13075
  parameters: {
12127
13076
  query?: never;
@@ -12141,10 +13090,145 @@ export interface operations {
12141
13090
  [name: string]: unknown;
12142
13091
  };
12143
13092
  content: {
12144
- "application/json": components["schemas"]["PreviewFollowResponse"];
13093
+ "application/json": components["schemas"]["PreviewFollowResponse"];
13094
+ };
13095
+ };
13096
+ /** @description Invalid request, or terms a follow would refuse (the message names the rule) */
13097
+ 400: {
13098
+ headers: {
13099
+ [name: string]: unknown;
13100
+ };
13101
+ content?: never;
13102
+ };
13103
+ /** @description Authentication required */
13104
+ 401: {
13105
+ headers: {
13106
+ [name: string]: unknown;
13107
+ };
13108
+ content?: never;
13109
+ };
13110
+ /** @description Delegated agent or sub-account sessions cannot follow */
13111
+ 403: {
13112
+ headers: {
13113
+ [name: string]: unknown;
13114
+ };
13115
+ content?: never;
13116
+ };
13117
+ /** @description Lead trader not found */
13118
+ 404: {
13119
+ headers: {
13120
+ [name: string]: unknown;
13121
+ };
13122
+ content?: never;
13123
+ };
13124
+ /** @description Copy trading is not available */
13125
+ 409: {
13126
+ headers: {
13127
+ [name: string]: unknown;
13128
+ };
13129
+ content?: never;
13130
+ };
13131
+ /** @description Read or order-risk preview rate limit exceeded; retry after the interval in details.retryAfter */
13132
+ 429: {
13133
+ headers: {
13134
+ [name: string]: unknown;
13135
+ };
13136
+ content?: never;
13137
+ };
13138
+ /** @description Internal server error */
13139
+ 500: {
13140
+ headers: {
13141
+ [name: string]: unknown;
13142
+ };
13143
+ content?: never;
13144
+ };
13145
+ /** @description Matching engine unavailable or its preview capacity is busy; retry */
13146
+ 503: {
13147
+ headers: {
13148
+ [name: string]: unknown;
13149
+ };
13150
+ content?: never;
13151
+ };
13152
+ };
13153
+ };
13154
+ get_follow: {
13155
+ parameters: {
13156
+ query?: never;
13157
+ header?: never;
13158
+ path: {
13159
+ followId: string;
13160
+ };
13161
+ cookie?: never;
13162
+ };
13163
+ requestBody?: never;
13164
+ responses: {
13165
+ /** @description OK */
13166
+ 200: {
13167
+ headers: {
13168
+ [name: string]: unknown;
13169
+ };
13170
+ content: {
13171
+ "application/json": components["schemas"]["GetFollowResponse"];
13172
+ };
13173
+ };
13174
+ /** @description Invalid follow id */
13175
+ 400: {
13176
+ headers: {
13177
+ [name: string]: unknown;
13178
+ };
13179
+ content?: never;
13180
+ };
13181
+ /** @description Authentication required */
13182
+ 401: {
13183
+ headers: {
13184
+ [name: string]: unknown;
13185
+ };
13186
+ content?: never;
13187
+ };
13188
+ /** @description Follow not found */
13189
+ 404: {
13190
+ headers: {
13191
+ [name: string]: unknown;
13192
+ };
13193
+ content?: never;
13194
+ };
13195
+ /** @description Read rate limit exceeded — every authenticated read draws one request from the account's read budget; retry after the interval in details.retryAfter */
13196
+ 429: {
13197
+ headers: {
13198
+ [name: string]: unknown;
13199
+ };
13200
+ content?: never;
13201
+ };
13202
+ /** @description Internal server error */
13203
+ 500: {
13204
+ headers: {
13205
+ [name: string]: unknown;
13206
+ };
13207
+ content?: never;
13208
+ };
13209
+ };
13210
+ };
13211
+ close_follow_positions: {
13212
+ parameters: {
13213
+ query?: never;
13214
+ header?: never;
13215
+ path: {
13216
+ followId: string;
13217
+ };
13218
+ cookie?: never;
13219
+ };
13220
+ requestBody?: never;
13221
+ responses: {
13222
+ /** @description OK */
13223
+ 200: {
13224
+ headers: {
13225
+ [name: string]: unknown;
13226
+ };
13227
+ content: {
13228
+ "application/json": components["schemas"]["CloseFollowPositionsResponse"];
12145
13229
  };
12146
13230
  };
12147
- /** @description Invalid request, or terms a follow would refuse (the message names the rule) */
13231
+ /** @description Invalid follow id, or the close was refused */
12148
13232
  400: {
12149
13233
  headers: {
12150
13234
  [name: string]: unknown;
@@ -12158,28 +13242,28 @@ export interface operations {
12158
13242
  };
12159
13243
  content?: never;
12160
13244
  };
12161
- /** @description Delegated agent or sub-account sessions cannot follow */
13245
+ /** @description Delegated agent sessions cannot close copy positions */
12162
13246
  403: {
12163
13247
  headers: {
12164
13248
  [name: string]: unknown;
12165
13249
  };
12166
13250
  content?: never;
12167
13251
  };
12168
- /** @description Lead trader not found */
13252
+ /** @description Follow not found */
12169
13253
  404: {
12170
13254
  headers: {
12171
13255
  [name: string]: unknown;
12172
13256
  };
12173
13257
  content?: never;
12174
13258
  };
12175
- /** @description Copy trading is not available */
13259
+ /** @description The follow is stopped, or its stop is in progress (which closes its positions itself), or copy trading is not available */
12176
13260
  409: {
12177
13261
  headers: {
12178
13262
  [name: string]: unknown;
12179
13263
  };
12180
13264
  content?: never;
12181
13265
  };
12182
- /** @description Read or order-risk preview rate limit exceeded; retry after the interval in details.retryAfter */
13266
+ /** @description Copy position close rate limit exceeded; retry after the interval in details.retryAfter */
12183
13267
  429: {
12184
13268
  headers: {
12185
13269
  [name: string]: unknown;
@@ -12193,7 +13277,7 @@ export interface operations {
12193
13277
  };
12194
13278
  content?: never;
12195
13279
  };
12196
- /** @description Matching engine unavailable or its preview capacity is busy; retry */
13280
+ /** @description The close cannot run right now, or the matching engine is unavailable; retry */
12197
13281
  503: {
12198
13282
  headers: {
12199
13283
  [name: string]: unknown;
@@ -12202,7 +13286,7 @@ export interface operations {
12202
13286
  };
12203
13287
  };
12204
13288
  };
12205
- get_follow: {
13289
+ list_follow_leader_positions: {
12206
13290
  parameters: {
12207
13291
  query?: never;
12208
13292
  header?: never;
@@ -12219,7 +13303,7 @@ export interface operations {
12219
13303
  [name: string]: unknown;
12220
13304
  };
12221
13305
  content: {
12222
- "application/json": components["schemas"]["GetFollowResponse"];
13306
+ "application/json": components["schemas"]["ListFollowLeaderPositionsResponse"];
12223
13307
  };
12224
13308
  };
12225
13309
  /** @description Invalid follow id */
@@ -12236,6 +13320,13 @@ export interface operations {
12236
13320
  };
12237
13321
  content?: never;
12238
13322
  };
13323
+ /** @description The follow is stopped */
13324
+ 403: {
13325
+ headers: {
13326
+ [name: string]: unknown;
13327
+ };
13328
+ content?: never;
13329
+ };
12239
13330
  /** @description Follow not found */
12240
13331
  404: {
12241
13332
  headers: {
@@ -12257,9 +13348,16 @@ export interface operations {
12257
13348
  };
12258
13349
  content?: never;
12259
13350
  };
13351
+ /** @description Matching engine unavailable; retry */
13352
+ 503: {
13353
+ headers: {
13354
+ [name: string]: unknown;
13355
+ };
13356
+ content?: never;
13357
+ };
12260
13358
  };
12261
13359
  };
12262
- list_follow_leader_positions: {
13360
+ add_follow_position_margin: {
12263
13361
  parameters: {
12264
13362
  query?: never;
12265
13363
  header?: never;
@@ -12268,7 +13366,11 @@ export interface operations {
12268
13366
  };
12269
13367
  cookie?: never;
12270
13368
  };
12271
- requestBody?: never;
13369
+ requestBody: {
13370
+ content: {
13371
+ "application/json": components["schemas"]["AddFollowPositionMarginRequest"];
13372
+ };
13373
+ };
12272
13374
  responses: {
12273
13375
  /** @description OK */
12274
13376
  200: {
@@ -12276,10 +13378,10 @@ export interface operations {
12276
13378
  [name: string]: unknown;
12277
13379
  };
12278
13380
  content: {
12279
- "application/json": components["schemas"]["ListFollowLeaderPositionsResponse"];
13381
+ "application/json": components["schemas"]["AddFollowPositionMarginResponse"];
12280
13382
  };
12281
13383
  };
12282
- /** @description Invalid follow id */
13384
+ /** @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) */
12283
13385
  400: {
12284
13386
  headers: {
12285
13387
  [name: string]: unknown;
@@ -12293,7 +13395,7 @@ export interface operations {
12293
13395
  };
12294
13396
  content?: never;
12295
13397
  };
12296
- /** @description The follow is stopped */
13398
+ /** @description Only a master account session can add margin (not a delegated agent or a sub-account) */
12297
13399
  403: {
12298
13400
  headers: {
12299
13401
  [name: string]: unknown;
@@ -12307,7 +13409,14 @@ export interface operations {
12307
13409
  };
12308
13410
  content?: never;
12309
13411
  };
12310
- /** @description Read rate limit exceeded — every authenticated read draws one request from the account's read budget; retry after the interval in details.retryAfter */
13412
+ /** @description The follow is stopping or stopped */
13413
+ 409: {
13414
+ headers: {
13415
+ [name: string]: unknown;
13416
+ };
13417
+ content?: never;
13418
+ };
13419
+ /** @description Movement rate limit exceeded — withdrawals and collateral transfers share a per-user budget; retry after the interval in details.retryAfter */
12311
13420
  429: {
12312
13421
  headers: {
12313
13422
  [name: string]: unknown;
@@ -12378,6 +13487,13 @@ export interface operations {
12378
13487
  };
12379
13488
  content?: never;
12380
13489
  };
13490
+ /** @description Follow stop rate limit exceeded; retry after the interval in details.retryAfter */
13491
+ 429: {
13492
+ headers: {
13493
+ [name: string]: unknown;
13494
+ };
13495
+ content?: never;
13496
+ };
12381
13497
  /** @description Internal server error */
12382
13498
  500: {
12383
13499
  headers: {
@@ -12538,6 +13654,13 @@ export interface operations {
12538
13654
  };
12539
13655
  content?: never;
12540
13656
  };
13657
+ /** @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 */
13658
+ 429: {
13659
+ headers: {
13660
+ [name: string]: unknown;
13661
+ };
13662
+ content?: never;
13663
+ };
12541
13664
  /** @description Internal server error */
12542
13665
  500: {
12543
13666
  headers: {
@@ -13356,6 +14479,10 @@ export interface operations {
13356
14479
  page?: number;
13357
14480
  /** @description Items per page (max 100) */
13358
14481
  pageSize?: number;
14482
+ /**
14483
+ * @description Keep only risk-bucket rows in this state (see `risk_bucket_state`). A
14484
+ * parent margin account row has no state, so any filter excludes it.
14485
+ */
13359
14486
  state?: string;
13360
14487
  /** @description Trading pair identifier (UUID) */
13361
14488
  tradingPairId?: string;
@@ -13533,6 +14660,39 @@ export interface operations {
13533
14660
  };
13534
14661
  };
13535
14662
  };
14663
+ get_margin_account_pnl: {
14664
+ parameters: {
14665
+ query?: never;
14666
+ header?: never;
14667
+ path: {
14668
+ /**
14669
+ * @description One of the caller's margin accounts: the default one or a sub-account.
14670
+ * @example 2b1a5f9c-0000-4000-8000-000000000001
14671
+ */
14672
+ marginAccountId: string;
14673
+ };
14674
+ cookie?: never;
14675
+ };
14676
+ requestBody?: never;
14677
+ responses: {
14678
+ /** @description OK */
14679
+ 200: {
14680
+ headers: {
14681
+ [name: string]: unknown;
14682
+ };
14683
+ content: {
14684
+ "application/json": components["schemas"]["GetMarginAccountPnlResponse"];
14685
+ };
14686
+ };
14687
+ /** @description Read rate limit exceeded — every authenticated read draws one request from the account's read budget; retry after the interval in details.retryAfter */
14688
+ 429: {
14689
+ headers: {
14690
+ [name: string]: unknown;
14691
+ };
14692
+ content?: never;
14693
+ };
14694
+ };
14695
+ };
13536
14696
  simulate_order_risk: {
13537
14697
  parameters: {
13538
14698
  query?: never;
@@ -13599,6 +14759,37 @@ export interface operations {
13599
14759
  };
13600
14760
  };
13601
14761
  };
14762
+ transfer_collateral: {
14763
+ parameters: {
14764
+ query?: never;
14765
+ header?: never;
14766
+ path?: never;
14767
+ cookie?: never;
14768
+ };
14769
+ requestBody: {
14770
+ content: {
14771
+ "application/json": components["schemas"]["TransferCollateralRequest"];
14772
+ };
14773
+ };
14774
+ responses: {
14775
+ /** @description OK */
14776
+ 200: {
14777
+ headers: {
14778
+ [name: string]: unknown;
14779
+ };
14780
+ content: {
14781
+ "application/json": components["schemas"]["TransferCollateralResponse"];
14782
+ };
14783
+ };
14784
+ /** @description Movement rate limit exceeded — withdrawals and collateral transfers share a per-user budget; retry after the interval in details.retryAfter */
14785
+ 429: {
14786
+ headers: {
14787
+ [name: string]: unknown;
14788
+ };
14789
+ content?: never;
14790
+ };
14791
+ };
14792
+ };
13602
14793
  get_parent_margin_account_summary: {
13603
14794
  parameters: {
13604
14795
  query?: {
@@ -13817,6 +15008,71 @@ export interface operations {
13817
15008
  };
13818
15009
  };
13819
15010
  };
15011
+ create_sub_account: {
15012
+ parameters: {
15013
+ query?: never;
15014
+ header?: never;
15015
+ path?: never;
15016
+ cookie?: never;
15017
+ };
15018
+ requestBody: {
15019
+ content: {
15020
+ "application/json": components["schemas"]["CreateSubAccountRequest"];
15021
+ };
15022
+ };
15023
+ responses: {
15024
+ /** @description OK */
15025
+ 200: {
15026
+ headers: {
15027
+ [name: string]: unknown;
15028
+ };
15029
+ content: {
15030
+ "application/json": components["schemas"]["CreateSubAccountResponse"];
15031
+ };
15032
+ };
15033
+ /** @description Movement rate limit exceeded — withdrawals and collateral transfers share a per-user budget; retry after the interval in details.retryAfter */
15034
+ 429: {
15035
+ headers: {
15036
+ [name: string]: unknown;
15037
+ };
15038
+ content?: never;
15039
+ };
15040
+ };
15041
+ };
15042
+ close_sub_account: {
15043
+ parameters: {
15044
+ query?: never;
15045
+ header?: never;
15046
+ path: {
15047
+ /** @example 2b1a5f9c-0000-4000-8000-000000000001 */
15048
+ marginAccountId: string;
15049
+ };
15050
+ cookie?: never;
15051
+ };
15052
+ requestBody: {
15053
+ content: {
15054
+ "application/json": components["schemas"]["CloseSubAccountRequest"];
15055
+ };
15056
+ };
15057
+ responses: {
15058
+ /** @description OK */
15059
+ 200: {
15060
+ headers: {
15061
+ [name: string]: unknown;
15062
+ };
15063
+ content: {
15064
+ "application/json": components["schemas"]["CloseSubAccountResponse"];
15065
+ };
15066
+ };
15067
+ /** @description Movement rate limit exceeded — withdrawals and collateral transfers share a per-user budget; retry after the interval in details.retryAfter */
15068
+ 429: {
15069
+ headers: {
15070
+ [name: string]: unknown;
15071
+ };
15072
+ content?: never;
15073
+ };
15074
+ };
15075
+ };
13820
15076
  list_all_funding_history: {
13821
15077
  parameters: {
13822
15078
  query?: {
@@ -15627,6 +16883,70 @@ export interface operations {
15627
16883
  };
15628
16884
  };
15629
16885
  };
16886
+ get_my_referral_tree: {
16887
+ parameters: {
16888
+ query?: {
16889
+ parent?: string;
16890
+ /** @description Nodes per page (max 200) */
16891
+ pageSize?: number;
16892
+ /**
16893
+ * @description Opaque cursor from a previous response's `nextPageToken`; omit or send an
16894
+ * empty string for the first page. Only valid with the same `parent`.
16895
+ */
16896
+ pageToken?: string;
16897
+ };
16898
+ header?: never;
16899
+ path?: never;
16900
+ cookie?: never;
16901
+ };
16902
+ requestBody?: never;
16903
+ responses: {
16904
+ /** @description OK */
16905
+ 200: {
16906
+ headers: {
16907
+ [name: string]: unknown;
16908
+ };
16909
+ content: {
16910
+ "application/json": components["schemas"]["GetMyReferralTreeResponse"];
16911
+ };
16912
+ };
16913
+ /** @description Invalid `parent` wallet address, `pageSize`, or `pageToken` */
16914
+ 400: {
16915
+ headers: {
16916
+ [name: string]: unknown;
16917
+ };
16918
+ content?: never;
16919
+ };
16920
+ /** @description Authentication required */
16921
+ 401: {
16922
+ headers: {
16923
+ [name: string]: unknown;
16924
+ };
16925
+ content?: never;
16926
+ };
16927
+ /** @description `parent` is not the caller or one of the caller's own L1/L2 referees */
16928
+ 404: {
16929
+ headers: {
16930
+ [name: string]: unknown;
16931
+ };
16932
+ content?: never;
16933
+ };
16934
+ /** @description Read rate limit exceeded — every authenticated read draws one request from the account's read budget; retry after the interval in details.retryAfter */
16935
+ 429: {
16936
+ headers: {
16937
+ [name: string]: unknown;
16938
+ };
16939
+ content?: never;
16940
+ };
16941
+ /** @description Internal server error */
16942
+ 500: {
16943
+ headers: {
16944
+ [name: string]: unknown;
16945
+ };
16946
+ content?: never;
16947
+ };
16948
+ };
16949
+ };
15630
16950
  get_rewards_balance: {
15631
16951
  parameters: {
15632
16952
  query?: never;
@@ -15711,6 +17031,13 @@ export interface operations {
15711
17031
  };
15712
17032
  content?: never;
15713
17033
  };
17034
+ /** @description Movement rate limit exceeded — withdrawals, collateral transfers and reward transfers share a per-user budget; retry after the interval in details.retryAfter */
17035
+ 429: {
17036
+ headers: {
17037
+ [name: string]: unknown;
17038
+ };
17039
+ content?: never;
17040
+ };
15714
17041
  /** @description Internal server error */
15715
17042
  500: {
15716
17043
  headers: {
@@ -15780,6 +17107,13 @@ export interface operations {
15780
17107
  "application/json": components["schemas"]["BatchCloseAllResponse"];
15781
17108
  };
15782
17109
  };
17110
+ /** @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 */
17111
+ 429: {
17112
+ headers: {
17113
+ [name: string]: unknown;
17114
+ };
17115
+ content?: never;
17116
+ };
15783
17117
  };
15784
17118
  };
15785
17119
  list_position_history: {
@@ -15875,6 +17209,13 @@ export interface operations {
15875
17209
  "application/json": components["schemas"]["ClosePositionResponse"];
15876
17210
  };
15877
17211
  };
17212
+ /** @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 */
17213
+ 429: {
17214
+ headers: {
17215
+ [name: string]: unknown;
17216
+ };
17217
+ content?: never;
17218
+ };
15878
17219
  };
15879
17220
  };
15880
17221
  get_position_pnl_history: {