Error Codes

All API responses include the following common fields:

  • code: Business status code
  • message: Description of the status
codemessagemessage detailDescription
0successThe request was successful.
1server errorThe request parameters could not be processed, or the server encountered an internal service error.
2network read time outThe request timed out. Check network conditions, consider deploying closer to the Tiger OpenAPI service region, or use a stable dedicated network connection.
4access forbiddenAccess 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 symbolsThe WebSocket subscription exceeds the symbol limit for the user's tier.
5rate limit errorRequest 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.
1000common param errorA 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 symbolsThe symbol is invalid.
--the current requested method does not supportThe 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 keySignature verification failed, usually because the key is incorrect.
--request parameters cannot be emptyRequest parameters cannot be empty
--field 'xxx' cannot be emptyField cannot be empty
--failed to get developer informationDeveloper 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 errorDevice ID error
1010biz param errorThe 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' invalidBusiness 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 changedpage_token was used incorrectly. When using it, keep every other request parameter unchanged.
--field 'page_token' is illegal, can't be parsedpage_token error
--option symbol format errorOption 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 xxxThe symbol list is empty or exceeds the allowed size.
1100global account response errorGlobal account trading error, such as:
1. TRADE DUPLICATE ORDER ID: Trading order ID duplicate
2. TRADE ORDER NOT ALLOWED: Order placement currently not allowed
1200prime account response errorPrime 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
1300paper account response errorPaper trading account error. The error descriptions are generally the same as those for a Prime Account.
2100stock response errorStock market data error.
2200option response errorOption market data error.
2300futures response errorFutures market data error.
2400user token errorHK license token error
user token can not be emptyToken is empty
user token expired invalidToken expired
user token invalidToken invalid
3xxxsubscribe errorA 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.
4000permission deniedAccess 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.
4001kick out by a new connectionA newly established WebSocket connection disconnected the existing connection.

Common Error Troubleshooting

Connection and Authentication

SymptomLikely causeResolution
failed to verify signatureThe private key does not match the public key in Developer Center, or uses the wrong formatUse a complete PKCS#8 PEM key (-----BEGIN PRIVATE KEY-----), or regenerate the key pair and upload the new public key.
failed to get developer informationInvalid Tiger ID or wrong regionVerify the Tiger ID and ensure the regional setting matches.
access forbidden (code 4)IP whitelist, signature, subscription limit, or missing institutional secret_keyVerify the source IP, signature, subscription count, and secret_key.
get device information errorOutdated SDK or invalid device IDUpgrade to the latest SDK.
kick out by a new connection (code 4001)Another WebSocket connection was opened for the same Tiger IDKeep 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 instabilityCheck connectivity, deploy closer to the API region, and adjust the SDK timeout/retry settings.

TBHK Token Authentication

SymptomResolution
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:
            raise

Market Data Permissions

SymptomResolution
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 quotesPurchase the required API market data permission in Developer Center or Tiger Trade.
According to your user level, you can only subscribe to xxx symbolsCheck quota with get_kline_quota() and see Historical Market Data Limitations.
K-line request returns no dataCheck 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

SymptomLikely causeResolution
common param error (code 1000)Common parameters failed to parse1. 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 symbolConfirm 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 failed1. 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 identifierConfirm 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 misusedWhen paging with page_token, every other parameter must stay identical to the first request.

Trading Errors

SymptomLikely causeResolution
Orders cannot be placed at this moment (code 1200)Order placed outside trading hoursConfirm 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-hoursUS 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 quantityCheck the position and sellable quantity; T+1 settled instruments must wait for settlement to complete.
TRADE DUPLICATE ORDER ID (code 1100)Duplicate order IDOccurs 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 tradableThe instrument may be halted or outside the tradable universe; confirm its trading status.

Subscription and Push Errors

SymptomLikely causeResolution
subscribe error (code 3xxx)Subscription failure1. 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 firesCallback function not registered correctlyConfirm 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:

SDKPrivate key formatFile headerConfiguration field
PythonPKCS#8 (recommended; PKCS#1 also supported)-----BEGIN PRIVATE KEY-----private_key_pk8
JavaPKCS#8-----BEGIN PRIVATE KEY-----private_key_pk8
C++PKCS#8-----BEGIN PRIVATE KEY-----private_key_pk8
⚠️

If you hit a failed to verify signature error, 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_key in 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.properties in 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.

Did this page help you?