Skip to content

Remove All Delegated Signers (WebSocket)

Remove all delegated signers from a subaccount through the WebSocket connection, revoking their ability to perform trading actions on behalf of the subaccount. This immediately terminates all trading permissions previously granted to any wallet addresses, providing a fast way to revoke all delegations at once.

Endpoint

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

Request

Request Format

{
  "id": "delegate-remove-all-1",
  "method": "post",
  "params": {
    "action": "removeAllDelegatedSigners",
    "subAccountId": "1867542890123456789",
    "nonce": 1735689600000,
    "expiresAfter": 1735689900,
    "signature": {
      "v": 28,
      "r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
      "s": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890"
    }
  }
}

Parameters

Request Parameters

ParameterTypeRequiredDescription
idstringYesClient-generated unique request identifier
methodstringYesMust be "post"
paramsobjectYesContains all parameters for the request

Params Object

ParameterTypeRequiredDescription
actionstringYesMust be "removeAllDelegatedSigners"
subAccountIdstringYesSubaccount identifier
nonceintegerYesPositive integer, incrementing nonce
expiresAfterintegerNoOptional request expiration timestamp (Unix seconds)
signatureobjectYesEIP-712 signature

Important: Only the master account owner can remove delegated signers.

EIP-712 Type Definition

const RemoveAllDelegatedSignersTypes = {
  RemoveAllDelegatedSigners: [
    { name: "subAccountId", type: "uint256" },
    { name: "nonce", type: "uint256" },
    { name: "expiresAfter", type: "uint256" }
  ]
}

Response Format

Success Response

{
  "id": "delegate-remove-all-1",
  "status": 200,
  "result": {
    "subAccountId": "1867542890123456789",
    "removedSigners": [
      "0x742d35Cc6634C0532925a3b844Bc9e7595f89590",
      "0x8B3a9A6F8D1e2C4E5B7A9D0F1C3E5A7B9D1F3E5A",
      "0x9C4b8E7F0A2D3B6C5E8A1F3D5B7C9E1A3F5D7B9E"
    ]
  }
}

Response Fields

FieldTypeDescription
subAccountIdstringThe subaccount ID that delegated signers were removed from
removedSignersstring[]Array of wallet addresses that were removed

No Delegations Response

{
  "id": "delegate-remove-all-1",
  "status": 200,
  "result": {
    "subAccountId": "1867542890123456789",
    "removedSigners": []
  }
}

Error Response

{
  "id": "delegate-remove-all-1",
  "status": 401,
  "result": null,
  "error": {
    "code": 401,
    "message": "Only master account can remove delegated signers"
  }
}

Implementation Example

import { ethers } from 'ethers';
 
async function removeAllDelegatedSigners(ws, signer, subAccountId) {
  const nonce = Date.now();
  const expiresAfter = Math.floor(Date.now() / 1000) + 300; // 5 minutes from now (Unix seconds)
 
  const domain = {
    name: "Synthetix",
    version: "1",
    chainId: 1,
    verifyingContract: "0x0000000000000000000000000000000000000000"
  };
 
  const types = {
    RemoveAllDelegatedSigners: [
      { name: "subAccountId", type: "uint256" },
      { name: "nonce", type: "uint256" },
      { name: "expiresAfter", type: "uint256" }
    ]
  };
 
  const message = {
    subAccountId: BigInt(subAccountId),
    nonce: BigInt(nonce),
    expiresAfter: BigInt(expiresAfter)
  };
 
  const sig = await signer.signTypedData(domain, types, message);
  const signature = ethers.Signature.from(sig);
 
  ws.send(JSON.stringify({
    id: `delegate-remove-all-${Date.now()}`,
    method: "post",
    params: {
      action: "removeAllDelegatedSigners",
      subAccountId,
      nonce,
      expiresAfter,
      signature: { v: signature.v, r: signature.r, s: signature.s }
    }
  }));
}
 
// Usage: Emergency removal of all delegated signers
await removeAllDelegatedSigners(
  ws,
  signer,
  "1867542890123456789"
);

Code Examples

Emergency Revocation of All Signers

{
  "id": "emergency-revoke",
  "method": "post",
  "params": {
    "action": "removeAllDelegatedSigners",
    "subAccountId": "1867542890123456789",
    "nonce": 1735689600000,
    "expiresAfter": 1735689900,
    "signature": { "v": 28, "r": "0x...", "s": "0x..." }
  }
}

Implementation Notes

  • Immediate Effect: All delegations are revoked immediately upon successful execution
  • Access Requirements: Only master account owners can remove delegated signers
  • Atomic Operation: Either all delegations are removed or none are (transaction is atomic)
  • Idempotent: Calling when no delegations exist returns a success response with an empty removedSigners array
  • Signature Required: All removal operations require valid EIP-712 signatures
  • Recovery: Removed signers can be re-added individually through the addDelegatedSigner endpoint

Use Cases

  • Emergency Lockdown: Quickly revoke all delegated access in a security event
  • Account Reset: Clear all delegations before setting up new access patterns
  • Team Offboarding: Remove all team member access when restructuring
  • Security Rotation: Revoke all existing delegations before re-adding with new permissions

Common Errors

Error CodeMessageDescription
401Only master account can remove delegated signersMust be signed by master account owner
404Subaccount not foundInvalid subaccount ID
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