Skip to content

Get Subaccounts

Retrieve all subaccounts for the authenticated wallet, including comprehensive details for each subaccount such as collateral balances, cross margin summary, positions, market preferences, fee rates, and delegated signers. This is a more comprehensive alternative to getSubAccount that returns multiple subaccounts with delegation information included.

Endpoint

POST https://papi.synthetix.io/v1/trade

Request

Request Format

{
  "params": {
    "action": "getSubAccounts",
    "subAccountId": "1867542890123456789"
  },
  "expiresAfter": 1735689900000,
  "signature": {
    "v": 28,
    "r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
    "s": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890"
  }
}

Request Parameters

FieldTypeRequiredDescription
paramsobjectYesRequest parameters wrapper
params.actionstringYesMust be "getSubAccounts"
params.subAccountIdstringYesThe ID of a subaccount owned by the authenticated wallet
ParameterTypeRequiredDescription
nonceuint64Yes*Positive integer nonce (must be incrementing and unique per request)
signatureobjectYesEIP-712 signature object
expiresAfteruint64NoUnix milliseconds expiration timestamp (5x rate limit on stale cancels)

:::info Common Parameters These are top-level request parameters. The subAccountId parameter is specified within the params object (see each endpoint's parameter table). :::

:::info SubAccountAction Endpoints Endpoints using SubAccountAction signing (getPositions, getOpenOrders, getOrdersHistory, getTrades, getFundingPayments, getSubAccount, getSubAccounts, getDelegatedSigners, getBalanceUpdates) do not require the nonce parameter. Only signature and optional expiresAfter are needed. :::

Response

Success Response

{
  "status": "ok",
  "response": {
    "subAccounts": [
      {
        "subAccountId": "1867542890123456789",
        "masterAccountId": "1867542890123456788",
        "subAccountName": "Trading Account 1",
        "collaterals": [
          {
            "symbol": "USDC",
            "quantity": "1000.00000000",
            "withdrawable": "1000.00000000",
            "pendingWithdraw": "0.00000000"
          },
          {
            "symbol": "ETH",
            "quantity": "0.5000",
            "withdrawable": "0.5000",
            "pendingWithdraw": "0.0000"
          }
        ],
        "crossMarginSummary": {
          "accountValue": "6750.50",
          "availableMargin": "2415.00",
          "totalUnrealizedPnl": "75.00",
          "maintenanceMargin": "1207.50",
          "initialMargin": "2415.00",
          "withdrawable": "4335.50"
          "adjustedAccountValue": "6750.50"
        },
        "positions": [],
        "marketPreferences": {
          "leverages": {
            "BTC-USDT": 20,
            "ETH-USDT": 10
          }
        },
        "feeRates": {
          "makerFeeRate": "0.0002",
          "takerFeeRate": "0.0005",
          "tierName": "Regular User"
        },
        "delegatedSigners": [
          {
            "subAccountId": "1867542890123456789",
            "walletAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f89590",
            "permissions": ["trading"],
            "expiresAt": null
          },
          {
            "subAccountId": "1867542890123456789",
            "walletAddress": "0x8B3a9A6F8D1e2C4E5B7A9D0F1C3E5A7B9D1F3E5A",
            "permissions": ["trading"],
            "expiresAt": 1767225600000
          }
        ]
      },
      {
        "subAccountId": "1867542890123456790",
        "masterAccountId": "1867542890123456788",
        "subAccountName": "Trading Account 2",
        "collaterals": [
          {
            "symbol": "USDC",
            "quantity": "5000.00000000",
            "withdrawable": "5000.00000000",
            "pendingWithdraw": "0.00000000"
          }
        ],
        "crossMarginSummary": {
          "accountValue": "5000.00",
          "availableMargin": "5000.00",
          "totalUnrealizedPnl": "0.00",
          "maintenanceMargin": "0.00",
          "initialMargin": "0.00",
          "withdrawable": "5000.00"
          "adjustedAccountValue": "5000.00"
        },
        "positions": [],
        "marketPreferences": {
          "leverages": {}
        },
        "feeRates": {
          "makerFeeRate": "0.0002",
          "takerFeeRate": "0.0005",
          "tierName": "Regular User"
        },
        "delegatedSigners": []
      }
    ]
  },
  "request_id": "5ccf215d37e3ae6d"
}

Response Fields

FieldTypeDescription
subAccountsarrayArray of subaccount objects

Subaccount Object

Each subaccount in the subAccounts array includes the standard subaccount fields plus a delegatedSigners array:

FieldTypeDescription
subAccountIdstringUnique subaccount identifier
masterAccountIdstring | nullID of the master account (null if this is a master account)
subAccountNamestringHuman-readable subaccount name
collateralsarrayArray of collateral assets held in this subaccount
crossMarginSummaryobjectCross margin summary with account value, margins, and P&L
positionsarrayArray of open positions for this subaccount
marketPreferencesobjectMarket-specific preferences and settings
marketPreferences.leveragesobjectPer-market leverage settings (key: symbol, value: leverage multiplier)
feeRatesobjectFee rate information for this subaccount
feeRates.makerFeeRatestringMaker fee rate as decimal (e.g., "0.0002" for 0.02%)
feeRates.takerFeeRatestringTaker fee rate as decimal (e.g., "0.0005" for 0.05%)
feeRates.tierNamestringFee tier name (e.g., "Regular User", "Tier 1")
accountLimitsobjectAccount limits for this subaccount
accountLimits.maxSubAccountsintegerMaximum number of subaccounts allowed for the master account

Additional Field

FieldTypeDescription
delegatedSignersarrayArray of delegated signer objects for this subaccount

Collateral Object

FieldTypeDescription
symbolstringCollateral token symbol (e.g., "USDT")
quantitystringAmount of collateral held
withdrawablestringAmount available for withdrawal
pendingWithdrawstringAmount pending withdrawal
adjustedCollateralValuestringCollateral value after applying haircut discount (USD equivalent)
collateralValuestringFull collateral value before haircut (USD equivalent)

Cross Margin Summary Object

FieldTypeDescription
accountValuestringTotal account value including PnL
availableMarginstringUSDT amount available for new positions
totalUnrealizedPnlstringSum of all unrealized PnL
maintenanceMarginstringMinimum margin required for all positions
initialMarginstringInitial margin required for all positions
withdrawablestringUSDT amount available for withdrawal
adjustedAccountValuestringAdjusted account value for margin calculations

Delegate Object

Delegate Object

The delegate object represents a delegated signer in API responses. Note that the response uses walletAddress while EIP-712 signing uses delegateAddress.

FieldTypeDescription
subAccountIdstringSubaccount ID this delegation applies to
walletAddressstringEthereum wallet address of the delegated signer (42-character hex format)
permissionsstring[]Array of permission levels granted. Currently supports: ["trading"]
expiresAtinteger | nullUnix timestamp (milliseconds) when the delegation expires. null indicates no expiration
addedBystring | omittedWallet address that created this delegation. Omitted for pre-migration records where the creator was not recorded

Example Delegate Object

{
  "subAccountId": "1867542890123456789",
  "walletAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f89590",
  "permissions": ["trading"],
  "expiresAt": null,
  "addedBy": "0x1111111111111111111111111111111111111111"
}

Example with Expiration

{
  "subAccountId": "1867542890123456789",
  "walletAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f89590",
  "permissions": ["trading"],
  "expiresAt": 1767225600000
}

Error Response

{
  "status": "error",
  "error": {
    "message": "Subaccount not found",
    "code": "NOT_FOUND"
  },
  "request_id": "5ccf215d37e3ae6d"
}
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

Subaccount Information

  • Account Access: Must have access rights to the specified subaccount
  • Delegated Access: Works with delegated signer permissions
  • Multiple Accounts: Returns all subaccounts associated with the authenticated wallet
  • Delegation Visibility: Includes delegated signers for each subaccount, unlike getSubAccount
  • Complementary Data: Use with getPositions for detailed position information and getPerformanceHistory for performance analytics

Code Examples

Get All Subaccounts

{
  "params": {
    "action": "getSubAccounts",
    "subAccountId": "1867542890123456789"
  },
  "expiresAfter": 1735689900000,
  "signature": {
    "v": 28,
    "r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
    "s": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890"
  }
}
Response includes for each subaccount:
  • Detailed subaccount metadata
  • Collateral balances
  • Cross margin summary
  • Market preferences
  • Position information
  • Fee rates
  • Delegated signers with permissions and expiration

EIP-712 Signature

const domain = {
  name: "Synthetix",
  version: "1",
  chainId: 1,
  verifyingContract: "0x0000000000000000000000000000000000000000"
};
 
const types = {
  SubAccountAction: [
    { name: "subAccountId", type: "uint256" },
    { name: "action", type: "string" },
    { name: "expiresAfter", type: "uint256" }
  ]
};
 
const message = {
  subAccountId: "1867542890123456789",
  action: "getSubAccounts",
  expiresAfter: 0  // Optional, use 0 for no expiration
};
 
const signature = await signer._signTypedData(domain, types, message);

Comparison with getSubAccount

FeaturegetSubAccountgetSubAccounts
ReturnsSingle subaccountAll subaccounts for the wallet
Delegated SignersNot includedIncluded for each subaccount
Use CaseSpecific account lookupFull account overview with delegation info

Related Endpoints

:::info Rate Limits The Synthetix API enforces rate limits to ensure fair usage and system stability:

  • Order Placement: 100 orders per second per subaccount
  • WebSocket Connections: 100 connections per IP address
  • WebSocket Subscriptions: 1000 subscriptions per IP address

See Rate Limits for detailed information and best practices. :::

Signing

All trading methods are signed using EIP-712. Each successful trading request will contain:

  • A piece of structured data that includes the sender address
  • A signature of the hash of that structured data, signed by the sender

For detailed information on EIP-712 signing, see EIP-712 Signing.