For the complete documentation index, see llms.txt. This page is also available as Markdown.

WebSocket Error Codes

These numbers arrive in WS JSON: {"code":5xx,"msg":"...","trace":"..."}. Subscribe rejections are the exception — they arrive prefixed with Subscribe fail: plus one space, and are not bare JSON — see the next section.

Do not interpret them with the REST ret table. REST 508 means the symbol is missing; WS 508 means the API key expired. REST: REST API Error Codes. Limits: WebSocket Limitation.

Subscribe acks 10001 / 10004 / 10007 with msg=ok only mean the frame was accepted. A wrong business for the symbol can still ack and then never push.

The welcome frame {"code":200,"msg":"ws connect success"} is not an error. business=stock may also send a plaintext greeting first.

Subscribe rejections: prefixed, not bare JSON

When a subscribe is rejected, the server replies with a text frame that starts with Subscribe fail: followed by one space. Running JSON.parse / json.loads on the whole frame throws. If your code silently drops frames it cannot parse, the symptom is "connected, subscribe sent, but no market data and no error at all".

There are four shapes. The first two carry JSON after the prefix; the last two carry plain English text and no code:

Condition
Frame

Symbols on this connection exceed the limit (505)

Subscribe fail: {"traceId":"...","code":505,"msg":"Single WS subscribe exceeds the limit 200"}

Total symbols across connections exceed the limit (516)

Subscribe fail: {"traceId":"...","code":516,"msg":"All WS subscribe exceeds the limit 6000"}

business does not match the symbol type

Subscribe fail: Some product is not stock product like:BTCUSDT.Business stock can only subscribe stock products

Market not included in your plan

Subscribe fail: No access to the following market data:JP

In the two JSON shapes the field is traceId, not the trace used by other frames.

Recommended handling:

  1. Check whether the text starts with Subscribe fail:; if so, strip that prefix together with the space after it.

  2. If the remainder starts with {, parse it as JSON and read code against the table below. Otherwise pass the whole remainder up as the error message.

  3. Do not resend the same subscribe as-is. Wrong business, missing market entitlement and 505 fail identically no matter how many times you retry. 516 may be retried with backoff, but retry frames also count against the 60 requests per minute budget (see WebSocket Limitation) — unthrottled resends trigger 501, the server closes the connection, the client reconnects, hits the limit again, and loops.

Application codes

code

Meaning

English msg

200

Connected (welcome)

ws connect success

500

Server error

server error

501

Per-minute request limit (includes heartbeats, 60/min)

Request frequency exceed the limit:%s times per minute

502

Daily request limit

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

Symbols on this connection exceed the limit

Single WS subscribe exceeds the limit %s

506

Parameter error

Param error:%s

507

Required parameter missing

Param lost:%s

508

API key permission expired

The apiKey permission has expired

509

API key invalid

The apiKey is invalid

510

API key empty

The apiKey is empty

511

API key blacklisted

The apiKey is in the blacklist

512

WebSocket connection count exceeds the plan

WebSocket connections exceeds the limit:%s

513

Heartbeat timeout

Websocket heartbeat timeout

514

Wrong WebSocket URL

Websocket Url Wrong

515

Payload is not JSON

Param not json,request failed

516

Total symbols across connections exceed the limit

All WS subscribe exceeds the limit %s

There is no 427. Connection-over-quota is 512.

Handshake extras

News / Korea / Taiwan ports may also return:

code
Meaning

517

Handshake API key missing

518

API key does not exist

519

No permission (news entitlement; Korea subscribe permission)

520

Korea/Taiwan: suffix does not match the market (.KS / .TW); news: this key already has a news connection

521

Handshake connection cap

A key without news access may also fail the /news HTTP handshake with 401.

Gateway / CDN

HTTP status
Meaning

401

Handshake auth failed

404

Path not found

429

Gateway rate limit

499

Client disconnect

524

Origin timeout

Last updated