> For the complete documentation index, see [llms.txt](https://docs.infoway.io/llms.txt). Markdown versions of documentation pages are available by appending `.md` to page URLs; this page is available as [Markdown](https://docs.infoway.io/en-docs/getting-started/error-codes/rest-api-error-codes.md).

# REST API Error Codes

How HTTP APIs report errors.

Treat these as two separate number spaces:

1. **HTTP status** from the gateway / CDN (`401` `404` `429` `499` `524`).
2. **Business `ret`** in the JSON body. Quote endpoints often return **HTTP 200 + `ret=5xx`**. Do not read only the HTTP status.

`508`–`514` collide with WebSocket codes and mean different things. Use this page for REST only. See [WebSocket Error Codes](/en-docs/getting-started/error-codes/websocket-error-codes.md) for sockets. Rate limits: [REST API Limitation](/en-docs/getting-started/api-limitation/rest-api-limitation.md).

### Response envelope

```json
{
    "ret": 200,
    "msg": "success",
    "traceId": "698f920a-c53b-401c-bfac-4ea46b9b8f12",
    "data": []
}
```

`ret=200` is success. On failure read `ret` and `msg` first; keep `traceId` for support.

Basic-info endpoints (`/common/basic/*` and some `/common/v2/basic/*`) usually return only `200` / `400` / `500`.

### Business `ret`

| ret | Meaning                                                                | Server English `msg`                                   |
| --- | ---------------------------------------------------------------------- | ------------------------------------------------------ |
| 200 | Success                                                                | success                                                |
| 400 | Bad request (basic info, missing required query, and similar)          | Bad request                                            |
| 500 | Server failure. Some production quote failures currently land here too | server error / Apikey not exists                       |
| 501 | Per-minute request limit exceeded                                      | Request frequency exceed the limit：%s times per minute |
| 502 | Daily request limit reached                                            | Request frequency for the day upper limit：%s           |
| 503 | Candlestick count exceeds the limit                                    | Kline quantity exceeds the limit：%s                    |
| 504 | Order-book depth exceeds the limit                                     | Orderbook depth exceeds the limit：%s                   |
| 505 | Symbol count exceeds the limit                                         | Products quantity exceeds the limit：%s                 |
| 506 | Parameter error                                                        | Param error：%s                                         |
| 507 | Required parameter missing                                             | Param lost：%s                                          |
| 508 | Symbol does not exist or is delisted                                   | All product not exists                                 |
| 509 | Token permission expired                                               | The token permission has expired                       |
| 513 | Historical timestamp outside the plan window                           | Timestamp limit error,earliest timestamp：%s            |
| 514 | No permission for this query                                           | No permission：%s                                       |

`510` / `511` / `512` are WebSocket meanings (connection count / heartbeat / disconnect). REST quote APIs rarely return them.

### Gateway / CDN (HTTP status, not `ret`)

| HTTP status | Meaning                                                            |
| ----------- | ------------------------------------------------------------------ |
| 401         | Auth failed. API key missing or not in the required header / query |
| 404         | Endpoint not found                                                 |
| 429         | Gateway rate limit                                                 |
| 499         | Client closed the request                                          |
| 524         | Origin timeout between the CDN and the origin                      |
