Skip to content

Update Subaccount Name

Rename an existing trading subaccount. The authenticated subaccount's display name is updated to the new value provided in the request.

Endpoint

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

Request

Request Format

{
  "params": {
    "action": "updateSubAccountName",
    "subAccountId": "1867542890123456789",
    "name": "Scalping Strategy"
  },
  "nonce": 1704067200000,
  "signature": {
    "v": 28,
    "r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
    "s": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890"
  },
  "expiresAfter": 1704067300
}

Request Parameters

ParameterTypeRequiredDescription
paramsobjectYesParameters object containing action details
params.actionstringYesMust be "updateSubAccountName"
params.subAccountIdstringYesSubaccount identifier to rename
params.namestringYesNew display name for the subaccount
nonceinteger (uint64)YesUnix milliseconds timestamp, monotonically increasing
signatureobjectYesEIP-712 signature object
expiresAfterintegerNoExpiration timestamp in seconds

EIP-712 Type Definition

const UpdateSubAccountNameTypes = {
  UpdateSubAccountName: [
    { name: "subAccountId", type: "uint256" },
    { name: "name", type: "string" },
    { name: "nonce", type: "uint256" },
    { name: "expiresAfter", type: "uint256" }
  ]
}

Response

Success Response

{
  "status": "ok",
  "response": {
    "subAccountId": "1867542890123456789",
    "name": "Scalping Strategy"
  },
  "request_id": "5ccf215d37e3ae6d"
}

Response Fields

FieldTypeDescription
subAccountIdstringSubaccount identifier that was renamed
namestringThe new display name that was applied

Error Response

{
  "status": "error",
  "error": {
    "message": "subAccountId is required",
    "code": "VALIDATION_ERROR"
  },
  "request_id": "5ccf215d37e3ae6d"
}

Common Error Cases

{
  "status": "error",
  "error": {
    "message": "Invalid request body",
    "code": "INVALID_FORMAT"
  },
  "request_id": "5ccf215d37e3ae6d"
}
{
  "status": "error",
  "error": {
    "message": "Subaccount not found",
    "code": "NOT_FOUND"
  },
  "request_id": "5ccf215d37e3ae6d"
}

Code Examples

Rename Subaccount

{
  "params": {
    "action": "updateSubAccountName",
    "subAccountId": "1867542890123456789",
    "name": "Main Trading"
  },
  "nonce": 1704067200000,
  "signature": {
    "v": 28,
    "r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
    "s": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890"
  },
  "expiresAfter": 1704067300
}

Rename to Strategy-Based Name

{
  "params": {
    "action": "updateSubAccountName",
    "subAccountId": "1867542890123456789",
    "name": "Grid Trading Bot"
  },
  "nonce": 1704067200001,
  "signature": {
    "v": 28,
    "r": "0x1234567890abcdef1234567890abcdef1234567890abcdef1234567890abcdef",
    "s": "0xabcdef1234567890abcdef1234567890abcdef1234567890abcdef1234567890"
  },
  "expiresAfter": 1704067301
}

Validation Rules

  • nonce must be a timestamp in milliseconds and must be increasing
  • name must be a valid string
  • subAccountId must reference an existing subaccount owned by the signer
  • Must be signed by account owner or authorized delegate
  • Name must not already be in use by another subaccount under the same wallet

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.

Nonce Management

The nonce system prevents replay attacks and ensures order uniqueness:

  • Use any positive integer as nonce
  • Each nonce must be greater than the previous one (incrementing)
  • Date.now() is a convenient option, not a requirement
  • If nonce conflicts occur, increment by 1 and retry

:::note SubAccountAction Exception SubAccountAction endpoints (getPositions, getOpenOrders, getOrdersHistory, getTrades, getFundingPayments, getSubAccount, getSubAccounts, getDelegatedSigners, getBalanceUpdates) do not require a nonce. Only the signature and optional expiresAfter parameters are needed. :::

Error Handling

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
ErrorDescription
subAccountId is requiredNo subaccount was specified in the request
Invalid request bodyRequest payload could not be parsed
Subaccount not foundThe specified subaccount does not exist
Name already in useAnother subaccount already uses this name
Failed to update subaccountInternal error during the update operation