Skip to main content
When you want to move funds out of a market deployer 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 market deployer 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
marketDeployerId (required) — The ID of the market deployer from which you want to withdraw funds.
int32
required
coinId (required) — The coin or currency ID to transfer back to your chain-level balance.
string
required
amount (required) — The amount to withdraw, expressed as a raw integer string (e.g. "1000"). Must be greater than zero — 0 or a negative value returns 400 INVALID_PARAM 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.
number
Present only when the request is rejected; a non-zero value means nothing moved.
string
Present together with errorCode. The rejection reason.

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 non-zero errorCode (number) and an errorMessage are present 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.

HTTP errors

To move funds in the opposite direction — from your chain-level balance into a market deployer — use lockCollateral.