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

HTTP Protocols

Request and response conventions for HTTP and WebSocket.

1. HTTP

1.1 Method

Not every HTTP endpoint is GET.

Kind
Method
Notes

Trades, depth, basic info, package, fundamentals

GET

Path / query parameters

Historical / realtime kline v2

POST

Path /{market}/v2/batch_kline, JSON body

Monthly archive downloads also use POST with a JSON body at /kline/archive/download; see Monthly Candlestick Archive Download.

Always send the API key:

Header
Required
Description

apiKey

Yes

Plan API key. apikey is also accepted

1.2 Response format

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

ret

Business code. 200 is success; see REST API Error Codes

msg

Short status, e.g. success

traceId

Server-generated trace id (not tradeId)

data

Payload; shape depends on the endpoint

Quote failures are often HTTP 200 + ret=5xx. Read ret / msg first.

2. WebSocket

Quote URL:

Markets share one host; business selects the channel.

News is a different path and has no business:

After connect, business=stock may send a plaintext greeting, then {"code":200,"msg":"ws connect success"}. 200 means the socket is up.

Subscription failures on crypto and common can be sent as Subscribe fail: followed by JSON. Handle text types/prefixes before parsing JSON; a successful connection does not imply a successful subscription.

See WebSocket Limitation and Heartbeat. Addresses: Endpoints. HTTP rate limits: REST API Limitation.

Last updated