Skip to main content

K-Line API — Quick start

Quick integration flow

Before you start, prepare the X-API-Key assigned to your service and make sure your runtime can reach https://api.gelabs.org. See API reference for field descriptions, WebSocket protocol details, and error handling.

Query historical K-line data

Use GET /kline/api/v1/kline/ohlcv to load initial candlestick data:

curl -H "X-API-Key: $API_KEY" "https://api.gelabs.org/kline/api/v1/kline/ohlcv?interval=1h&from=1776679200&to=1776765600&limit=500&chain_type=evm&chain_id=1&pool_address=0xabc123def456&token=base"

Open a real-time connection

Use GET /kline/api/v1/kline/ws to establish a WebSocket connection and subscribe to real-time pushes. See API reference for connection requirements, message format, and subscription examples.

  1. Load initial chart data through the historical K-line API.
  2. Open a WebSocket subscription to update the latest candle.
  3. After reconnecting, use historical queries to fill any gap during the disconnection.