Skip to content

Get Delegations For Delegate

Retrieve a list of all delegations granted to the authenticated wallet address. This endpoint allows a delegate wallet to discover which accounts have delegated permissions to it, enabling frontends to detect when a connected wallet is a delegate and allow switching to the delegator's account.

Endpoint

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

Request

Request Format

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

Request Parameters

ParameterTypeRequiredDescription
paramsobjectYesParameters object containing method details
params.actionstringYesMust be "getDelegationsForDelegate"
params.subAccountIdstringYesSubaccount ID included in the signed SubAccountAction payload
params.owningAddressstringNoOptional Ethereum address to query on behalf of. When provided and different from the signing wallet, the caller must have trading permission for that address
expiresAfterintegerNoUnix timestamp (seconds) when this request expires
signatureobjectYesEIP-712 signature object

::::info Authentication The delegate address is determined from the wallet that signed the request. By default, this returns delegations for the signing wallet. If you provide owningAddress, the caller must have trading permission for that address. ::::

Response

Success Response

{
  "status": "ok",
  "response": {
    "delegatedAccounts": [
      {
        "subAccountId": "1867542890123456789",
        "ownerAddress": "0x8B3a9A6F8D1e2C4E5B7A9D0F1C3E5A7B9D1F3E5A",
        "accountName": "Main Trading Account",
        "accountValue": "12500.50",
        "permissions": ["trading"],
        "expiresAt": null
      },
      {
        "subAccountId": "2987654321098765432",
        "ownerAddress": "0x9C4b8E7F0A2D3B6C5E8A1F3D5B7C9E1A3F5D7B9E",
        "accountName": "Secondary Account",
        "accountValue": "4300.00",
        "permissions": ["trading"],
        "expiresAt": 1767225600000
      }
    ]
  },
  "request_id": "5ccf215d37e3ae6d"
}

Response Fields

FieldTypeDescription
delegatedAccountsarrayArray of delegated account objects

Delegated Account Object

FieldTypeDescription
subAccountIdstringSubaccount ID this delegation applies to
ownerAddressstringEthereum wallet address of the account owner who granted the delegation
accountNamestringHuman-readable name of the delegated account
accountValuestringTotal account value of the delegating subaccount in decimal USDT
permissionsstring[]Array of permission levels granted. Currently supports: ["trading"]
expiresAtinteger | nullUnix timestamp (milliseconds) when the delegation expires. null indicates no expiration

Empty Response

{
  "status": "ok",
  "response": {
    "delegatedAccounts": []
  },
  "request_id": "5ccf215d37e3ae6d"
}

Error Response

{
  "status": "error",
  "error": {
    "message": "Authentication failed",
    "code": "UNAUTHORIZED"
  },
  "request_id": "5ccf215d37e3ae6d"
}

Code Examples

Get All Delegations for Connected Wallet

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

Response with Multiple Delegated Accounts

{
  "status": "ok",
  "response": {
    "delegatedAccounts": [
      {
        "subAccountId": "1867542890123456789",
        "ownerAddress": "0x8B3a9A6F8D1e2C4E5B7A9D0F1C3E5A7B9D1F3E5A",
        "accountName": "Main Trading Account",
        "accountValue": "12500.50",
        "permissions": ["trading"],
        "expiresAt": null
      },
      {
        "subAccountId": "2987654321098765432",
        "ownerAddress": "0x9C4b8E7F0A2D3B6C5E8A1F3D5B7C9E1A3F5D7B9E",
        "accountName": "Secondary Account",
        "accountValue": "4300.00",
        "permissions": ["trading"],
        "expiresAt": null
      },
      {
        "subAccountId": "3456789012345678901",
        "ownerAddress": "0xA1B2C3D4E5F6A7B8C9D0E1F2A3B4C5D6E7F8A9B0",
        "accountName": "Team Account",
        "accountValue": "980.25",
        "permissions": ["trading"],
        "expiresAt": 1798761600000
      }
    ]
  },
  "request_id": "5ccf215d37e3ae6d"
}

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: BigInt("1867542890123456789"),
  action: "getDelegationsForDelegate",
  expiresAfter: 0
};
 
const signature = await signer._signTypedData(domain, types, message);

Implementation Notes

  • Delegate-Centric Query: Unlike getDelegatedSigners which queries by subaccount, this endpoint returns all accounts that have delegated permissions to the authenticated wallet
  • Access Control: Returns delegations for the signing wallet by default, or for owningAddress when the caller has trading permission for that address
  • Real-time Data: Returns current active delegations only
  • Expiration Handling: Expired delegations are automatically excluded from results
  • No Pagination: All delegations are returned in a single response
  • Owner Information: Includes the ownerAddress, accountName, and accountValue to help identify which accounts have granted delegation

Use Cases

  • Wallet Detection: Frontend can detect when a connected wallet is a delegate and offer account switching
  • Account Switching UI: Build interfaces allowing delegates to switch between delegated accounts
  • Multi-Account Management: Delegates managing multiple accounts can see all their delegations in one place
  • Access Verification: Confirm which accounts a delegate has permission to trade on
  • Team Dashboard: Team members can see which accounts they have access to

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.

Error Handling

owningAddress-Specific Errors

StatusCodeWhen it happens
400VALIDATION_ERRORowningAddress is not a valid hex Ethereum address
403FORBIDDENCaller does not have trading permission for the specified owningAddress
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

Next Steps