Skip to content

getSubAccountIds

Returns all subaccount IDs associated with a wallet address.

Endpoint

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

Request

Request Format

{
  "params": {
    "action": "getSubAccountIds",
    "walletAddress": "0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb0"
  }
}

Request Parameters

ParameterTypeRequiredDescription
params.actionstringYesMust be getSubAccountIds
params.walletAddressstringYesEthereum wallet address to query
params.includeDelegationsbooleanNoWhen true, returns owned and delegated subaccount IDs separately. Defaults to false (returns owned IDs as a flat array).

Response

Success Response (default)

When includeDelegations is omitted or false, the response is a flat array of owned subaccount IDs:

{
  "status": "ok",
  "response": [
    "1867542890123456789",
    "1867542890123456790",
    "1867542890123456791"
  ],
  "request_id": "5ccf215d37e3ae6d"
}

Success Response (with includeDelegations: true)

When includeDelegations is true, the response is an object with owned and delegated subaccount IDs listed separately:

{
  "status": "ok",
  "response": {
    "subAccountIds": [
      "1867542890123456789",
      "1867542890123456790"
    ],
    "delegatedSubAccountIds": [
      "1867542890123456800"
    ]
  },
  "request_id": "5ccf215d37e3ae6d"
}

Response Fields

Default response (includeDelegations omitted or false):

The response is an array of subaccount ID strings. Each ID is a uint64 represented as a string for precision.

With includeDelegations: true:

FieldTypeDescription
response.subAccountIdsstring[]Subaccount IDs owned by the wallet address
response.delegatedSubAccountIdsstring[]Subaccount IDs for which the wallet address has been granted delegate access

All IDs are uint64 values represented as strings for precision.

Error Response

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

Code Examples

TypeScript — owned IDs (default)

const response = await fetch('https://papi.synthetix.io/v1/info', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    params: {
      action: 'getSubAccountIds',
      walletAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb0'
    }
  })
});
 
const data = await response.json();
console.log('Subaccounts:', data.response);  // Array of subaccount IDs

TypeScript — owned and delegated IDs

const response = await fetch('https://papi.synthetix.io/v1/info', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    params: {
      action: 'getSubAccountIds',
      walletAddress: '0x742d35Cc6634C0532925a3b844Bc9e7595f0bEb0',
      includeDelegations: true
    }
  })
});
 
const data = await response.json();
console.log('Owned subaccounts:', data.response.subAccountIds);
console.log('Delegated subaccounts:', data.response.delegatedSubAccountIds);

Implementation Notes

  • No authentication required (public endpoint)
  • Returns all subaccounts ever created for the wallet address
  • Subaccount IDs are returned as strings to preserve uint64 precision
  • includeDelegations: true triggers a parallel lookup of delegations for the wallet address