Error Codes
All API responses include the following common fields:
- code: Business status code
- message: Description of the status
| code | message | message detail | Description |
|---|---|---|---|
| 0 | success | The request was successful. | |
| 1 | server error | The request parameters could not be processed, or the server encountered an internal service error. | |
| 2 | network read time out | The request timed out. Check network conditions, consider deploying closer to the Tiger OpenAPI service region, or use a stable dedicated network connection. | |
| 4 | access forbidden | Access was denied. Possible causes: 1. An IP whitelist is configured, but the requesting machine is not included. 2. The account may have been blacklisted because of frequent requests or excessive failed requests. 3. WebSocket connection signature verification failed. 4. The WebSocket connection subscribed to more symbols than allowed. 5. An institutional developer queried sub-account data without providing secret_key. | |
| -- | You do not have permission to subscribe to quotes. Purchase an API market data package first. | No permission for WebSocket quote subscriptions; the subscription quota is 0. | |
| -- | According to your user level, you can only subscribe to xxx symbols | The WebSocket subscription exceeds the symbol limit for the user's tier. | |
| 5 | rate limit error | Request frequency exceeded the limit. HTTP status 429 and a limit description are returned. Existing documentation contains conflicting application-code examples, so clients should not depend on one application code until the service contract is confirmed. | |
| 1000 | common param error | A common parameter could not be parsed. Possible causes: 1. The requested method is unsupported or the method parameter is invalid.2. The request URL is incorrect. 3. The request parameters are not valid JSON. 4. A common parameter outside bizContent failed validation, such as an invalid timestamp, an empty required field, or an invalid signature. | |
| -- | invalid symbols | The symbol is invalid. | |
| -- | the current requested method does not support | The requested API method is invalid or unsupported. This usually occurs when calling an unsupported SDK method or specifying an incorrect API method without an SDK. | |
| -- | time parse error, support time format is 'yyyy-MM-dd HH:mm:ss' | Date parameter format error | |
| -- | failed to verify signature, please make sure you use the correct rsa private key | Signature verification failed, usually because the key is incorrect. | |
| -- | request parameters cannot be empty | Request parameters cannot be empty | |
| -- | field 'xxx' cannot be empty | Field cannot be empty | |
| -- | failed to get developer information | Developer information could not be retrieved. The Tiger ID may not exist, or the request may target the wrong region, such as using a US Tiger ID in a non-US region. | |
| -- | get device information error | Device ID error | |
| 1010 | biz param error | The bizContent parameter could not be parsed or a business parameter failed validation, such as an invalid begin_time format or unsupported sec_type. | |
| -- | failed to parse parameters in 'biz_content' | biz_content parameter content error | |
| -- | field 'secret_key' or 'account' invalid | Business parameter error: institutional account secret_key or account error | |
| -- | 'market' xxxx not supported, all supported market include:[HK] | Market not supported | |
| -- | 'page_token' is used in the wrong way, when this parameter is used, other parameters cannot be changed | page_token was used incorrectly. When using it, keep every other request parameter unchanged. | |
| -- | field 'page_token' is illegal, can't be parsed | page_token error | |
| -- | option symbol format error | Option identifier format error | |
| -- | sec_type xxx error, current contract interface supported sec_type include:[STK, OPT, FUT] | sec type error | |
| -- | symbols cannot be empty and cannot exceed xxx | The symbol list is empty or exceeds the allowed size. | |
| 1100 | global account response error | Global account trading error, such as: 1. TRADE DUPLICATE ORDER ID: Trading order ID duplicate 2. TRADE ORDER NOT ALLOWED: Order placement currently not allowed | |
| 1200 | prime account response error | Prime account trading error, such as: 1. BAD_REQUEST:Orders cannot be place at this moment: Cannot place orders at current time 2. BAD_REQUEST:You cannot place market or stop order during pre-market and after-hours trading: Cannot place market or stop orders during US pre-market and after-hours trading 3. The order quantity you entered exceeds your currently available position: Order quantity exceeds tradable quantity 4. bad_request:We don't support trading of this stock now: Trading of this symbol is not supported | |
| 1300 | paper account response error | Paper trading account error. The error descriptions are generally the same as those for a Prime Account. | |
| 2100 | stock response error | Stock market data error. | |
| 2200 | option response error | Option market data error. | |
| 2300 | futures response error | Futures market data error. | |
| 2400 | user token error | HK license token error | |
| user token can not be empty | Token is empty | ||
| user token expired invalid | Token expired | ||
| user token invalid | Token invalid | ||
| 3xxx | subscribe error | A subscription error occurred. Possible causes: 1. A Tiger ID error occurred during subscription. 2. The server encountered an error during subscription. 3. The market data provider parameter is unsupported. 4. The subscription type is unsupported. 5. The number of subscriptions exceeds the allowed limit. | |
| 4000 | permission denied | Access was denied because the required permission is unavailable. Possible causes: 1. The requested candlestick-bar period exceeds the allowed historical range. 2. The requested tick-data period exceeds the allowed historical range. 3. The requesting device does not currently hold market data access; only one device is supported when multiple devices compete for access. 4. The account does not have the required market data access. | |
| 4001 | kick out by a new connection | A newly established WebSocket connection disconnected the existing connection. |
Common Error Troubleshooting
Connection and Authentication
| Symptom | Likely cause | Resolution |
|---|---|---|
failed to verify signature | The private key does not match the public key in Developer Center, or uses the wrong format | Use a complete PKCS#8 PEM key (-----BEGIN PRIVATE KEY-----), or regenerate the key pair and upload the new public key. |
failed to get developer information | Invalid Tiger ID or wrong region | Verify the Tiger ID and ensure the regional setting matches. |
access forbidden (code 4) | IP whitelist, signature, subscription limit, or missing institutional secret_key | Verify the source IP, signature, subscription count, and secret_key. |
get device information error | Outdated SDK or invalid device ID | Upgrade to the latest SDK. |
kick out by a new connection (code 4001) | Another WebSocket connection was opened for the same Tiger ID | Keep one connection, or use grab_quote_permission() when the current device needs to claim existing market data access. |
network read time out (code 2) | Network latency or instability | Check connectivity, deploy closer to the API region, and adjust the SDK timeout/retry settings. |
TBHK Token Authentication
| Symptom | Resolution |
|---|---|
user token expired invalid (code 2400) | Generate a new token in Developer Center and download tiger_openapi_token.properties. Tokens are valid for 30 days. |
user token can not be empty (code 2400) | Put tiger_openapi_token.properties in the SDK configuration directory. |
user token invalid (code 2400) | Regenerate the token. For automatic refresh, set Python client_config.token_refresh_duration = 86400 or Java clientConfig.isAutoRefreshToken = true. |
Rate Limits
For code 5 or HTTP 429, do not retry immediately. Batch requests where possible and use exponential backoff:
import time
for attempt in range(3):
try:
result = quote_client.get_stock_briefs(['AAPL'])
break
except Exception as exc:
if 'rate limit' in str(exc).lower():
time.sleep(2 ** attempt) # 1s, 2s, 4s
else:
raiseMarket Data Permissions
| Symptom | Resolution |
|---|---|
permission denied (code 4000) | Claim existing market data access for the current device with grab_quote_permission(). Python SDK 2.0.9+ does this by default when QuoteClient starts. |
You don't have permission to subscribe quotes | Purchase the required API market data permission in Developer Center or Tiger Trade. |
According to your user level, you can only subscribe to xxx symbols | Check quota with get_kline_quota() and see Historical Market Data Limitations. |
| K-line request returns no data | Check whether historical-data quota is exhausted with get_kline_quota(). Repeat requests for one symbol within 30 days do not consume additional quota. |
Parameter Errors
| Symptom | Likely cause | Resolution |
|---|---|---|
common param error (code 1000) | Common parameters failed to parse | 1. Verify the request URL and method parameter. 2. Confirm the request body is standard JSON. 3. Check the format of common fields such as timestamp and sign. |
invalid symbols (code 1000) | Malformed symbol | Confirm the symbol format: AAPL for US stocks, 00700 (5 digits) for Hong Kong stocks; options must use the identifier format. |
biz param error (code 1010) | Business parameter validation failed | 1. Check that dates use yyyy-MM-dd HH:mm:ss. 2. Check sec_type is a supported value (STK/OPT/FUT). 3. Check symbols is neither empty nor over the count limit. |
option symbol format error (code 1010) | Malformed option identifier | Confirm the option identifier format; retrieve a valid identifier from get_option_chain first. |
page_token is used in the wrong way (code 1010) | Pagination parameters misused | When paging with page_token, every other parameter must stay identical to the first request. |
Trading Errors
| Symptom | Likely cause | Resolution |
|---|---|---|
Orders cannot be placed at this moment (code 1200) | Order placed outside trading hours | Confirm the market is within its trading session; see Order and Trading Rules. |
market or stop order during pre-market (code 1200) | Unsupported order type in pre-market or after-hours | US pre-market and after-hours sessions accept limit orders (LMT) only, not market (MKT) or stop (STP) orders. |
exceeds your currently available position (code 1200) | Order quantity exceeds the tradable quantity | Check the position and sellable quantity; T+1 settled instruments must wait for settlement to complete. |
TRADE DUPLICATE ORDER ID (code 1100) | Duplicate order ID | Occurs on Global Account trading; check whether the same order was submitted twice. |
We don't support trading of this stock now (code 1200) | Instrument is not tradable | The instrument may be halted or outside the tradable universe; confirm its trading status. |
Subscription and Push Errors
| Symptom | Likely cause | Resolution |
|---|---|---|
subscribe error (code 3xxx) | Subscription failure | 1. Verify the Tiger ID. 2. Check whether the number of subscribed symbols exceeds your quota. 3. Confirm the market data provider parameter and subscription type are correct. |
| Push callback never fires | Callback function not registered correctly | Confirm the callback is registered and the matching subscribe method was called, and that the long-lived connection is still active (not kicked out). |
Security Best Practices
Private Key Format and Management
Private key format by SDK
Every SDK recommends an RSA private key in PKCS#8 format. A format mismatch causes signature verification to fail:
| SDK | Private key format | File header | Configuration field |
|---|---|---|---|
| Python | PKCS#8 (recommended; PKCS#1 also supported) | -----BEGIN PRIVATE KEY----- | private_key_pk8 |
| Java | PKCS#8 | -----BEGIN PRIVATE KEY----- | private_key_pk8 |
| C++ | PKCS#8 | -----BEGIN PRIVATE KEY----- | private_key_pk8 |
If you hit a
failed to verify signatureerror, first confirm the private key is in PKCS#8 format. When generating the key pair in Developer Center, download the PKCS#8 private key.
Private key storage recommendations
- Store the private key file in a protected directory and restrict it to the current user:
chmod 600 your_private_key.pem - Never commit private keys or configuration files to a code repository. Add these rules to
.gitignore:*.pem tiger_openapi_config.properties tiger_openapi_token.properties - In production, pass the private key in through an environment variable instead of keeping the file on disk:
import os client_config = TigerOpenClientConfig() client_config.private_key = os.environ.get('TIGER_PRIVATE_KEY') client_config.tiger_id = os.environ.get('TIGER_ID') client_config.account = os.environ.get('TIGER_ACCOUNT') - For stricter security requirements, use a secrets manager such as AWS Secrets Manager, HashiCorp Vault, or Alibaba Cloud KMS.
- Never hard-code private keys or an institutional
secret_keyin source. - Rotate key pairs periodically: generate a new pair in Developer Center. A six-month rotation interval is recommended.
Token Management (TBHK License)
TBHK license holders manage an additional token. Tokens are valid for 30 days and must be regenerated after they expire:
- Enable automatic refresh so an expired token does not interrupt service:
# Python: refresh the token once a day client_config.token_refresh_duration = 24 * 60 * 60// Java: enable automatic refresh, every 5 days by default clientConfig.isAutoRefreshToken = true; // Optional: customize the refresh interval and time of day // clientConfig.refreshTokenIntervalDays = 3; // clientConfig.refreshTokenTime = "03:00:00"; - Keep
tiger_openapi_token.propertiesin the same directory as the primary configuration file. - After a successful automatic refresh, the SDK also updates the local token file.
Production Deployment
- Configure an IP whitelist in Developer Center.
- Do not log full requests or responses containing account and position data; disable debug logs in production.
- Keep SSL/TLS enabled. Do not disable certificate verification.
- Alert on repeated signature failures, token expiration, frequent rate limits, and code 4001 disconnections.
Updated about 12 hours ago
Did this page help you?
