HTX

HTX Spot REST API

The HTX Spot REST API provides HTTP access to reference data (system status, symbols, currencies, chains), market data (klines, tickers, depth, trades, 24h summaries), account and balance information, wallet deposits/withdrawals, sub-user management, spot and conditional order placement and querying, and cross/isolated margin lending. Base hosts are api.huobi.pro and the AWS-optimized api-aws.huobi.pro. Authentication uses AccessKeyId plus an HMAC-SHA256 Signature Version 2 request signature.

Work with this as data

Every API here is available over the APIs.io API and to AI agents over MCP.

MCP server

One button, every client — Claude, Cursor, VS Code and the rest.

https://apis.io/mcp

Tools for apis

7 MCP tools reach this
  • find_apisBrowse and filter every API in the catalog.
  • get_api_artifactsOne API's artifacts, grouped by type.
  • get_openapiThe primary OpenAPI for this API.
  • find_similar_apisAPIs that look like this one.
  • apis_io_searchSTART HERE — APIs, providers and tags for one query, each with its total.
  • resolveTurn a domain, URL or GitHub org into the provider it belongs to.
  • find_cohortsEvery scored population of providers in the catalog.
All 92 tools →

Call it yourself

curl for this page
This API
curl "https://apis.io/api/v1/apis/htx:htx-spot-api"
All apis
curl "https://apis.io/api/v1/apis?limit=25"

Discovery needs no key. Ratings and market analysis are Pro.

Get an API key

Free tier, no form to fill in. Signing in shares your email address with us — we store it to create your key and to recognise you if you sign in with another provider. See our Privacy Policy and Terms.

A second provider on the same verified email joins the account you already have.

AsyncAPI Specification

htx-websocket-asyncapi.yml Raw ↑
asyncapi: 2.6.0
id: urn:com:htx:websocket-api
info:
  title: Huobi / HTX WebSocket API
  version: '1.0.0'
  description: |
    AsyncAPI 2.6 specification for Huobi (HTX) public WebSocket Market Data API
    and WebSocket v2 Asset & Order subscription API.

    ## Envelope conventions

    ### Market data (v1, /ws)
    - Subscribe:    `{ "sub": "<topic>", "id": "<client-id>" }`
    - Unsubscribe:  `{ "unsub": "<topic>", "id": "<client-id>" }`
    - One-shot req: `{ "req": "<topic>", "id": "<client-id>" }`
    - Push:         `{ "ch": "<topic>", "ts": <ms>, "tick": <object|array> }`
    - One-shot rsp: `{ "rep": "<topic>", "status": "ok", "id": "<client-id>", "data": <object|array> }`

    ### Asset & Order (v2, /ws/v2)
    - All frames use `{ "action": "sub"|"unsub"|"req"|"push"|"ping"|"pong", "ch": "<topic>", ... }`
    - Authentication is required before subscribing to private topics via
      `{ "action": "req", "ch": "auth", "params": { ... } }`.

    ## GZIP compression
    All inbound frames on `wss://api.huobi.pro/ws` and `wss://api.huobi.pro/feed`
    are GZIP-compressed binary. Clients MUST gunzip the payload before parsing
    JSON. Frames on `wss://api.huobi.pro/ws/v2` are sent as plain JSON text
    (no GZIP compression).

    ## Heartbeat
    - Market data (v1): server sends `{ "ping": <ts> }`; client replies `{ "pong": <ts> }` echoing the same timestamp.
    - Asset & Order (v2): server sends `{ "action": "ping", "data": { "ts": <ts> } }`;
      client replies `{ "action": "pong", "data": { "ts": <ts> } }`.
    Connections idle longer than the server timeout are closed.

    ## Authentication (v2)
    Authenticate with an HMAC-SHA256 signature over the canonical request string
    using `signatureVersion: 2.1` before subscribing to any private topic.
  termsOfService: https://www.htx.com/support/en-us/list/agreements
  contact:
    name: Huobi (HTX) Developer Support
    url: https://huobiapi.github.io/docs/spot/v1/en/
    email: support@huobigroup.com
  license:
    name: Proprietary
    url: https://www.htx.com/

defaultContentType: application/json

servers:
  market:
    url: api.huobi.pro/ws
    protocol: wss
    description: |
      Public market data WebSocket endpoint. GZIP-compressed binary frames.
      Mirror: `api-aws.huobi.pro/ws`.
  feed:
    url: api.huobi.pro/feed
    protocol: wss
    description: |
      Dedicated endpoint for Market By Price (MBP) incremental updates.
      GZIP-compressed binary frames. Mirror: `api-aws.huobi.pro/feed`.
  account:
    url: api.huobi.pro/ws/v2
    protocol: wss
    description: |
      WebSocket v2 endpoint for asset and order subscriptions. Plain JSON
      frames (no GZIP). Requires authentication for all private topics.
      Mirror: `api-aws.huobi.pro/ws/v2`.

tags:
  - name: market-data
    description: Public market data topics on /ws and /feed.
  - name: account
    description: Authenticated asset, order, and clearing topics on /ws/v2.


# --- truncated at 32 KB (37 KB total) ---
# Full source: https://raw.githubusercontent.com/api-evangelist/htx/refs/heads/main/asyncapi/htx-websocket-asyncapi.yml