Skip to main content
When you want to move funds out of a market deployer (MD) and back to your chain-level balance, use the unlockCollateral action. You can only withdraw up to the withdrawable amount — defined as your total equity in the MD minus the initial margin (IM) held against open positions and any margin frozen by active orders. Unrealized profits are included in equity but cannot be withdrawn until realized.
You cannot withdraw funds that are currently committed as initial margin for open positions or frozen for pending orders. Close positions and cancel orders first if you need to free up additional margin.

Endpoint

Request

Every request must carry an ECDSA signature and a nonce to prevent replay attacks.

Action parameters

int32
required
The ID of the market deployer from which you want to withdraw funds.
int32
required
The coin or currency ID to transfer back to your chain-level balance.
string
required
The amount to withdraw, expressed as a raw integer string (e.g. "1000"). Must be greater than zero and must not exceed the withdrawable amount. Decimals are not accepted — use the coin’s smallest unit.

Response

A successful withdrawal returns the updated balances for both the market deployer’s cross margin pool and your chain-level ledger.
int32
The coin ID that was transferred, confirming which asset was moved.
int64
The amount that was withdrawn from the market deployer’s cross margin pool.
int64
Your cross margin balance within the market deployer after the withdrawal.
int64
Your chain-level balance for this coin after the withdrawal.

Errors

If the request cannot be fulfilled, the exchange still returns HTTP 200 with status: "ok" — the rejection is reported inside response.data, where a server-assigned integer errorCode and a human-readable errorMessage are populated while the numeric amount and balance fields are set to 0. Common causes include:
  • Amount exceeds withdrawable balance — you cannot withdraw more than your equity minus position IM and order-frozen margin.
  • Amount ≤ 0 — the amount field must be a positive integer string.
  • Not enrolled in the market deployer — the specified MD must be one you are enrolled in.
To move funds in the opposite direction — from your chain-level balance into a market deployer — use lockCollateral.