Skip to content
Account Profile & Status

Update Account Trade Permission

PermissionChange

WhaleUpdateAccountTradePermission

Overview

After a successful account opening, Whale can update one or multiple trade permissions of an account in a single call via (account_no, [changes...]) — covering account-level permissions, market trading, and trade channels (the risk-disclosure questionnaire category is not included in this iteration). This bypasses back-office ticket approval and accelerates the "HK/US trading available right after account opening" client experience.

Multiple changes share all-or-nothing semantics — the entire batch is written atomically: either every change succeeds, or none takes effect. There is no half-applied state.

Request Parameters

Top-level Fields

Field Type Required Description
account_no string Yes Securities account number, mapped to accounts.origin_id
changes PermissionChange[] Yes List of permission changes, N ≥ 1

PermissionChange

Field Type Required Description
permission_type string Yes Format: {product}.{market}, e.g. stock.US; see the table below for valid values
permission_status string Yes Only open / close accepted, case-sensitive

Valid permission_type Values

The table below lists the full set supported at the code level. The actually available subset is determined by the SaaS Config of sg_mexc; the entire flag.* group is rejected in this iteration.

Market Codes

Code Meaning
HK Hong Kong stocks
US US stocks
SH Shanghai A-shares
SZ Shenzhen A-shares
SG Singapore
JP Japan
UK United Kingdom
DE Germany
AU Australia

Account-level Permissions account.*

permission_type Meaning
account.trade Account-level trading switch
account.exchange Currency exchange
account.rollover Position transfer
account.withdraw Withdrawal
account.deposit Deposit
account.public_funds Public mutual funds
account.private_funds Private funds
account.otc OTC market
account.balance_funds Balance funds (cash sweep)

Market Trading Permissions

{MARKET} is one of the values from "Market Codes" above. For example, stock.HK denotes the Hong Kong equity market.

permission_type Meaning
stock.{MARKET} Equity market (regular buy/sell)
options.{MARKET} Options
shortsell.{MARKET} Short selling / margin shorting
ipo.{MARKET} IPO subscription
warrant.{MARKET} Warrants / CBBC
stockgrey.{MARKET} Grey market
otc.{MARKET} OTC trading

Virtual Assets va.*

permission_type Meaning
va.OSL OSL channel
va.HAS HashKey channel

Trade Channels trade.*

permission_type Meaning
trade.client Online trading
trade.bo Back-office (counter) trading
trade.fix FIX channel
trade.openapi Open API

Not Supported in This Iteration

Any call referencing the flag.* group (flag.options / flag.warrant / flag.shortsell ...) returns an "invalid enum" error and is not persisted.

Response Parameters

Field Type Description
failure_index int32 When pre-validation fails fast, this is the index (0-based) of the offending change in the changes array. Unset (zero value) in other cases.

failure_index Across Scenarios

Scenario failure_index
All succeed Unset (zero value)
Pre-validation failure — invalid enum Index of the offending change
Pre-validation failure — invalid permission_status Index of the offending change
Pre-validation failure — no actual state change Index of the offending change
Account-level error — account not found / deregistered Unset (zero value)
Write-phase failure — DB error, etc. Unset (zero value)
POSThttps://b-api.longbridge.xyz/v1/whaleapi/account/update_account_trade_permission

Authorization

AuthorizationstringheaderRequired

Send the Broker ACCESS_TOKEN as Authorization: Bearer <token>.

Request body application/json

account_nostringrequired

account_no

changesarray<object>required

changes

Child attributes
permission_typestringrequired

permission_type. otc.US, stock.HK)

permission_statusstringrequired

permission_status. close / open)

Responses

HTTP 200Fields are taken from the real responses definition for this operation in the published Whale OpenAPI spec (whale-openapi/Whale-openapi.json).
HTTP 400Bad request. Check the business error code in code and the error details in message.
Standard response envelopecodemessagedata
dataobjectdata structure

No nested fields

HTTP 401The user is not authenticated, or the login session has expired.
Standard response envelopecodemessagedata
dataobjectdata structure

No nested fields

HTTP 403The current account is not authorized to use this feature. Grant the required permission to the account in User Permission.
Standard response envelopecodemessagedata
dataobjectdata structure

No nested fields

HTTP 408The request timed out. Check the business error code in code and the error details in message.
Standard response envelopecodemessagedata
dataobjectdata structure

No nested fields

Whale Docs