Skip to main content
When you want to pull funds out of a PORTFOLIO share group and return them to your chain-level balance, use unlockFromShareGroup. Like other withdrawal actions, you can only move up to the withdrawable amount — the share group’s total equity minus the initial margin (IM) held against open positions and any margin frozen by active orders within that group. Unrealized profits are included in equity but cannot be withdrawn until realized.
You cannot withdraw funds committed as initial margin for open positions or frozen for pending orders within the share group. Close positions and cancel orders in the group first 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 source share group. Funds are deducted from this group’s shared margin pool, subject to its withdrawable amount limit.
int32
required
The coin or currency ID to withdraw 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 available in the share group. Decimals are not accepted — use the coin’s smallest unit.

Response

A successful withdrawal returns the updated balances for both the source share group and your chain-level ledger. The response type is shareGroupFund, consistent with other share group fund operations.
int32
The coin ID that was withdrawn.
int64
The amount moved from the share group back to your chain-level balance.
int64
The share group’s margin pool balance 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 — position IM and order-frozen margin within the group constrain how much can be withdrawn.
  • Account not in PORTFOLIO mode — share groups are only active when your margin share type is 1.
  • Invalid groupId — the specified share group must exist and be accessible to your account.
  • Amount ≤ 0 — the amount field must be a positive integer string.
To deposit funds into a share group from your chain-level balance, use lockIntoShareGroup. To move funds from a share group into a market deployer instead, use transferShareGroupToMd.