Skip to content

Get Withdrawable Amounts (WebSocket)

Query withdrawable amounts for one or more collateral symbols through the trade WebSocket.

Endpoint

ws.send() wss://api.synthetix.io/v1/ws/trade

Request

Request Format

{
  "id": "withdrawable-1",
  "method": "post",
  "params": {
    "action": "getWithdrawableAmounts",
    "subAccountId": "1867542890123456789",
    "symbols": ["USDT", "WETH"],
    "expiresAfter": 1704153600,
    "signature": {
      "v": 28,
      "r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
      "s": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890"
    }
  }
}

Parameters

ParameterTypeRequiredDescription
idstringYesClient-generated request identifier
methodstringYesMust be "post"
params.actionstringYesMust be "getWithdrawableAmounts"
params.subAccountIdstringYesSubaccount identifier
params.symbolsstring[]YesCollateral symbols to query. Must include 1-100 symbols
params.expiresAfterintegerNoOptional expiration timestamp
params.signatureobjectYesEIP-712 signature using SubAccountAction

Response Format

Success Response

{
  "id": "withdrawable-1",
  "status": 200,
  "result": {
    "status": "success",
    "response": {
      "items": [
        {
          "symbol": "USDT",
          "withdrawableAmount": "995.00",
          "quantity": "1000.00",
          "pendingWithdraw": "0",
          "withdrawFee": "5.00"
        }
      ],
      "totalWithdrawableUsdt": "995.00"
    }
  }
}

Response Fields

FieldTypeDescription
itemsarrayPer-collateral withdrawable amounts
items[].symbolstringCollateral symbol
items[].withdrawableAmountstringAmount currently withdrawable for this collateral
items[].quantitystringCurrent collateral quantity
items[].pendingWithdrawstringAmount already pending withdrawal
items[].withdrawFeestringWithdrawal fee for this collateral
totalWithdrawableUsdtstringAggregate USD-equivalent withdrawable value

Implementation Notes

  • Uses SubAccountAction EIP-712 signing with action: "getWithdrawableAmounts"
  • symbols must be non-empty and cannot exceed 100 entries
  • Requests can return HTTP 400 when the account is in liquidation
Error CodeDescriptionRetryable
UNAUTHORIZEDEIP-712 signature validation failedNo
VALIDATION_ERRORRequest validation failedNo
MISSING_REQUIRED_FIELDRequired field is missingNo
INVALID_FORMATField format is invalidNo
INVALID_VALUEInvalid parameter valueNo
RATE_LIMIT_EXCEEDEDToo many requests in time windowYes
INSUFFICIENT_MARGINNot enough margin for tradeNo
ORDER_NOT_FOUNDOrder does not existNo
OPERATION_TIMEOUTOperation timed outYes