KUCOIN API - EU
SDK
Telegram
Kucoin
  1. Base Info
  • Introduction
  • Authentication
  • Enums Definitions
  • Terms Definitions
  • SDK
  • Rate Limit
  • Classic REST
    • Account Info
      • Account & Funding
        • Get Account Summary Info
        • Get KYC Regions
        • Get Apikey Info
        • Get Account Type - Spot
        • Get Account List - Spot
        • Get Account Detail - Spot
        • Get Account - Cross Margin
        • Get Account - Isolated Margin
        • Get Account Ledgers - Spot/Margin
        • Get Account Ledgers - Trade_hf
        • Get Account Ledgers - Margin_hf
      • Sub Account
        • Add sub-account
        • Add sub-account Margin Permission
        • Get sub-account List - Summary Info
        • Get sub-account Detail - Balance
        • Get sub-account List - Spot Balance (V2)
      • Sub Account API
        • Get sub-account API List
        • Add sub-account API
        • Modify sub-account API
        • Delete sub-account API
      • Deposit
        • Add Deposit Address (V3)
        • Get Deposit Address (V3)
        • Get Deposit History
      • Withdrawals
        • Get Withdrawal Quotas
        • Withdraw (V4)
        • Cancel Withdrawal
        • Get Withdrawal History
        • Get Withdrawal History By ID
      • Transfer
        • Get Transfer Quotas
        • Flex Transfer
      • Trade Fee
        • Get Basic Fee - Spot/Margin
        • Get Actual Fee - Spot/Margin
    • Spot Trading
      • Market Data
        • Get Announcements
        • Get Currency
        • Get All Currencies
        • Get Symbol
        • Get All Symbols
        • Get Ticker
        • Get All Tickers
        • Get Trade History
        • Get Klines
        • Get Part OrderBook
        • Get Full OrderBook
        • Get Call Auction Part OrderBook
        • Get Call Auction Info
        • Get Fiat Price
        • Get 24hr Stats
        • Get Market List
        • Get Client IP Address
        • Get Server Time
        • Get Service Status
      • Orders
        • Add Order
        • Add Order Sync
        • Add Order Test
        • Batch Add Orders
        • Batch Add Orders Sync
        • Cancel Order By OrderId
        • Cancel Order By OrderId Sync
        • Cancel Order By ClientOid
        • Cancel Order By ClientOid Sync
        • Cancel Partial Order
        • Cancel All Orders By Symbol
        • Cancel All Orders
        • Modify Order
        • Get Order By OrderId
        • Get Order By ClientOid
        • Get Symbols With Open Order
        • Get Open Orders
        • Get Open Orders By Page
        • Get Closed Orders
        • Get Trade History
        • Get DCP
        • Set DCP
        • Add Stop Order
        • Cancel Stop Order By ClientOid
        • Cancel Stop Order By OrderId
        • Batch Cancel Stop Orders
        • Get Stop Orders List
        • Get Stop Order By OrderId
        • Get Stop Order By ClientOid
        • Add OCO Order
        • Cancel OCO Order By OrderId
        • Cancel OCO Order By ClientOid
        • Batch Cancel OCO Order
        • Get OCO Order By OrderId
        • Get OCO Order By ClientOid
        • Get OCO Order Detail By OrderId
        • Get OCO Order List
    • Margin Trading
      • Market Data
        • Get Symbols - Cross Margin
        • Get Symbols - Isolated Margin
        • Get Mark Price Detail
        • Get Margin Config
        • Get Mark Price List
        • Get Margin Collateral Ratio
        • Get Market Available Inventory
      • Orders
        • Add Order
        • Add Order Test
        • Cancel Order By OrderId
        • Cancel Order By ClientOid
        • Cancel All Orders By Symbol
        • Get Symbols With Open Order
        • Get Open Orders
        • Get Closed Orders
        • Get Trade History
        • Get Order By OrderId
        • Get Order By ClientOid
      • Debit
        • Borrow
        • Get Borrow History
        • Repay
        • Get Repay History
        • Get Interest History
        • Modify Leverage
      • Risk Limit
        • Get Margin Risk Limit
    • Earn
      • Simple Earn
        • Purchase
        • Get Redeem Preview
        • Redeem
        • Get Savings Products
        • Get Promotion Products
        • Get Account Holding
    • Broker
      • Introduction
      • Broker Application
      • Instructions
      • Broker Pro
        • Introduction
        • Broker Fast API Service
        • Get Broker Rebate
        • Get Commission
        • Get User List
        • Get User Transactions
  • Classic Websocket
    • Base Info
      • Introduction
      • Get Public Token - Classic Spot/Margin
        POST
      • Get Private Token - Classic Spot/Margin
        POST
    • Spot Trading
      • Public Channels
        • Ticker
        • All Tickers
        • Orderbook - Level 1
        • Orderbook - Level 5
        • Orderbook - Level 50
        • Orderbook - Increment
        • Call Auction Orderbook - Level 50
        • Call Auction Data
        • Klines
        • Trade
        • Symbol Snapshot
        • Market Snapshot
      • Private Channels
        • Order V2
        • Order V1
        • Balance
        • Stop Order
    • Margin Trading
      • Public Channels
        • Index Price
        • Mark Price
      • Private Channels
        • Cross Margin Position
        • Isolated Margin Position
  • Error Code
    • HTTP
    • Spot
    • Margin
    • Earn
    • Websocket
  • Abandoned Endpoints
    • Introduction
    • Account & Funding
      • Get sub-account List - Summary Info (V1)
      • Get sub-account List - Spot Balance (V1)
      • Get Deposit Addresses (V2)
      • Get Deposit Addresses - V1
      • Get Deposit History - Old
      • Get Withdrawal History - Old
      • Add Deposit Address - V1
      • Withdraw - V1
    • Spot Trading
      • Orders
        • Add Order - Old
        • Add Order Test - Old
        • Batch Add Orders - Old
        • Cancel Order By OrderId - Old
        • Cancel Order By ClientOid - Old
        • Batch Cancel Order - Old
        • Get Orders List - Old
        • Get Recent Orders List - Old
        • Get Order By OrderId - Old
        • Get Order By ClientOid - Old
        • Get Trade History - Old
        • Get Recent Trade History - Old
    • Margin Trading
      • Get Account Detail - Margin
      • Add Order - V1
      • Add Order Test - V1
      • Get Account List - Isolated Margin - V1
      • Get Account Detail - Isolated Margin - V1
  • Developing
    • Introduction
  1. Base Info

Introduction

1. Introduction#

While there is a strict access frequency control for REST API, we highly recommend that API users utilize Websocket to get the real-time data.
TIP
The recommended way is to just create a Websocket connection and subscribe to multiple channels.

2. Apply Connect Token#

Before creating a Websocket connection, you need to get the websocket base URL and apply for a Token。
Note
The token is valid for only 24 hours, and a single connection is expected to be disconnected after 24 hours.
It should be noted that:
if you subscribe to spot/margin data, you need to obtain tokens through the spot base URL:
Get Public Token - Spot/Margin
Get Private Token - Spot/Margin

3. Create connection#

Once the connection has been successfully established, the system will send a welcome message.
TIP
The connection will only be available once the welcome message has been received
{
  "id": "hQvf8jkno",
  "type": "welcome"
}
connectId: The connection ID is a unique value taken from the client side. The welcome message ID and the error message ID are both connectId.
If you only want to receive private messages of the specified topic, please set privateChannel to true when subscribing.

4. Heartbeat#

{
  "id": "1545910590801",
  "type": "ping"
}
WebSocket Heartbeat Mechanism
The WebSocket heartbeat mechanism is determined by two parameters returned from the following RESTful token-generation endpoints:
Get Public Token – Classic Spot/Margin
Get Private Token – Classic Spot/Margin
These endpoints return the following heartbeat parameters:
pingInterval — Heartbeat sending interval
pingTimeout — Heartbeat timeout threshold
1. Parameter Definitions
pingInterval
Indicates how often the client should send a ping frame.
The recommended behavior is to send one ping every pingInterval seconds.
Current server value: 18 seconds.
pingTimeout
Indicates the maximum time the client should wait for a pong after sending a ping.
If no pong is received within this timeout, the connection should be treated as disconnected.
Current server value: 10 seconds.
2. Behavior Notes
2.1 Session Close Logic
The WebSocket cluster’s session-closure logic is not simply pingInterval + pingTimeout.
Clients only need to ensure they send a ping at least once every pingInterval seconds.
No additional internal timing rules need to be considered.
2.2 Timeout Timer Reset Rules
The timeout countdown is based on the most recent outgoing message, which includes:
ping frames
Business messages (e.g., place order, cancel order, etc.)
Any outgoing message refreshes the timeout timer.
Network delay should also be considered; some users implement a heartbeat cycle of 9 seconds for higher reliability.
2.3 Per-Session Heartbeat Requirement
Each WebSocket session must maintain its own independent heartbeat logic.
All sessions must implement keepalive handling to prevent disconnection.
2.4 Handling Timeout Conditions
If the client's configured pingInterval:
> 10 seconds and < 18 seconds
After sending a ping, if no pong is received within 10 seconds (pingTimeout),
the client should immediately send another ping, without waiting for the next scheduled interval.
< 10 seconds
Additional pong-response detection logic is not required, because the next ping will be sent before the timeout occurs.
3. Summary
pingInterval determines how often the client should send heartbeats.
pingTimeout determines how long to wait for the server’s response.
A correct implementation should:
Send heartbeats at or before pingInterval
Detect server silence using pingTimeout
Reset timeout on any outgoing traffic
Implement heartbeat independently for each WebSocket session
This ensures stable, long-lived WebSocket connections under the Classic Spot/Margin APIs.
{
  "id": "1545910590801",
  "type": "pong",
  "timestamp": 1764215232226553
}

5. Subscribe#

To subscribe to channel messages from a specific server, the client side should send a subscription message to the server.

Parameters#

ID: ID is a unique string to mark the request which is same as ID property of ack.
Topic: The topic you want to subscribe to.
PrivateChannel: You can subscribe to some private topics through the privateChannel parameter. This parameter is set to "false" by default. When set to "true", you can only receive content pushes related to the topics you subscribe to.
Response If the response is set to true, the system will return ack messages after the subscription has succeeded.
//Spot Demo
{
  "id": 1545910660739, //The ID should be a unique value
  "type": "subscribe",
  "topic": "/market/ticker:BTC-USDT,ETH-USDT", //Topic needs to be subscribed. Some topics support subscribing to information on multiple trading pairs by separating them with a comma (“,”).
  "privateChannel": false, //Adopted the private channel or not. Set as false by default.
  "response": true //Whether the server needs to return the receipt information of this subscription or not. Set as false by default.
}
If the subscription succeeds, the system will send ack messages to you, when the response is set as true.
{
  "id": "1545910660739",
  "type": "ack"
}
Whenever topic messages are generated, the system will send the corresponding messages to the client side. For details about the message format, please check the definitions of topics.

6. UnSubscribe#

Unsubscribe from topics you have subscribed to.

Parameters#

ID: ID unique string to mark the request.
Topic: The topic you want to unsubscribe from.
PrivateChannel: You can unsubscribe from some private topics through the privateChannel parameter. Set to "true", you can unsubscribe from related private channel pushes.
Response: If the response is set as true, the system will return the ack messages after the unsubscription succeeds.
//Spot Unsubscribe Topic
{
  "id": "1545910840805", //The ID should be a unique value
  "type": "unsubscribe",
  "topic": "/market/ticker:BTC-USDT,ETH-USDT", //Topic needs to be unsubscribed. Some topics support unsubscribing from information on multiple trading pairs by separating them with a comma (“,”).
  "privateChannel": false,
  "response": true //Whether the server needs to return the receipt information of this subscription or not. Set as false by default.
}

If the unsubscription succeeds, the system will send ack messages to you, when the response is set as true.

```json
{
  "id": "1545910840805",
  "type": "ack"
}
Modified at 2026-01-28 13:00:33
Previous
Get User Transactions
Next
Get Public Token - Classic Spot/Margin