Skip to main content
The updateMarginMode action switches the margin mode for a specific contract between cross and isolated. In cross margin mode, your positions share a common collateral pool and can draw on your full available balance. In isolated margin mode, each position is allocated a fixed amount of collateral that you control explicitly. Before switching modes, the contract must have no open positions and no active orders. If either condition is not met, the exchange rejects the request — close all positions and cancel all orders on the contract first.
This action uses full field names (asset, isCross, isHedge) rather than the compact single-character keys used by order and cancel actions.
This action is idempotent: setting the same margin mode that is already active returns a success response without modifying any state.

Endpoint

Request

All requests must include an ECDSA signature and a millisecond-precision nonce.

Action fields

string
required
Fixed value: "updateMarginMode".
int32
required
The contract ID to update the margin mode for.
boolean
required
true = switch to cross margin mode. false = switch to isolated margin mode.
boolean
Optional. false selects ONE_WAY (one-way) position mode. Omit to keep the current position mode unchanged.
HEDGE (two-way) position mode is currently unavailable. Only ONE_WAY is accepted, and any request passing isHedge: true is rejected. Isolated margin (isCross: false) works directly under ONE_WAY — you do not need HEDGE for it.

Response

Success

Rejection

Rejections still return HTTP 200 with status: "ok". Check for the presence of errorCode in data to detect failures.

Response fields

int
The margin mode for the contract before the update: 1 = cross, 2 = isolated. Returns 0 on rejection.
int
The margin mode for the contract after the update: 1 = cross, 2 = isolated. Returns 0 on rejection.
int
The position mode before the update: 0 = ONE_WAY, 1 = HEDGE. Returns 0 on rejection.
int
The position mode after the update: 0 = ONE_WAY, 1 = HEDGE. Equals positionModeBefore when isHedge is omitted (unchanged). Returns 0 on rejection.
int
Present only on rejection. Identifies the failure reason.
string
Present only on rejection. Human-readable description of the failure.

Error reference