Skip to Content
Getting StartedAPI GuidesErrors & Rate Limits

Handle errors and rate limits

API errors should be handled as part of the normal workflow. Read the complete response, identify the exact cause and correct it before deciding whether to retry. Do not retry an order or position request until you have checked whether the earlier action succeeded.

Before you begin

Step-by-step workflow

  1. Capture the complete response

    Record the operation, time, response code and response message. Keep App Secrets, access tokens and other sensitive values out of logs.

  2. Read the error message first

    The response message explains the specific reason returned for that request. Use it to understand the affected field, token, order, position or limit.

  3. Review the error code

    Use the code to identify the error category. Then refer to Appendix → Common API Error Codes for the standard description and recommended action.

  4. Correct the cause before retrying

    Fix invalid inputs, renew an expired token, use the correct App ID or symbol, or wait for the applicable rate-limit window. Do not repeat an unchanged request.

  5. Retry only when it is safe

    Read requests may be retried after a temporary failure. Before retrying an order, exit, conversion or other account-changing request, check the latest account state.

  6. Verify the final state

    Use the relevant Order Book, positions, portfolio or market-data API to confirm the result. Keep the original code and message for troubleshooting if the issue continues.

  7. Verify the result

    Confirm that the corrected request succeeds or that the expected account state is visible. If the request still fails, compare the latest response code and message with the Common API Error Codes table before taking another action.

Common issues

Reading only the code and ignoring the message400 Bad Request

The numeric or HTTP code names the category. The message explains the exact condition. Read both before deciding the next action.

{"s":"error","code":-50,"message":"Please provide valid order parameters"}
View Error Code Reference →
Retrying an invalid request without correcting it400 Bad Request

Repeating the same payload will return the same error. Fix the stated field or permission, then send a new request.

HTTP/1.1 400 Bad Request
{"s":"error","message":"Invalid symbol"}
Review API conventions →
Retrying an account-changing request too earlyPending

Before placing, modifying or cancelling again, read the latest order or position state. A timeout does not mean the first request failed.

{"s":"ok","orderStatus":"6","message":"Pending"}
View Order Book →
Continuing after a rate limit429 Too Many Requests

Stop the burst, wait, then retry with exponential backoff. Check Plans & limits if the cap is plan-related.

HTTP/1.1 429 Too Many Requests
Retry-After: 1
Learn exponential backoff →
Logging access tokens or App Secrets401 Unauthorized

Never write tokens, App Secrets or passwords to logs, chat, or source control. Rotate credentials if they were exposed.

Authorization: appId:access_token
View Authentication →

Continue with AI

Last updated on