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) 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.

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
Present only on rejection. Identifies the failure reason.
string
Present only on rejection. Human-readable description of the failure.

Error reference