DEMO VERSION — this is not a production service. Prices and account data are sample data; no real trading or payments.
Developers

API documentation

Build trading bots, dashboards and integrations on top of Finight with a REST API for market data, balances and orders, plus a WebSocket stream for real-time updates.

Browse endpoints
Base URL
https://api.finight.example/v1
Version
v1
Format
REST + JSON, WebSocket

Introduction

The Finight API is organised around REST: requests use standard HTTP methods, parameters are sent as query strings or JSON bodies, and every response is JSON.

Public endpoints (market data) need no authentication. Private endpoints (account and trading) must be signed with your API key and secret.

Sample data

This documentation belongs to the demo website. The domain, keys and responses are examples only and no real API is available.

Authentication

Signed requests carry three headers. The signature is an HMAC-SHA256 hash, in lowercase hex, calculated with your API secret over the timestamp, the HTTP method, the request path (with query string) and the raw body.

Headers of a signed request
HeaderDescription
FN-API-KEYYour public API key.
FN-API-TIMESTAMPCurrent time in milliseconds since the Unix epoch. Requests older than 10 seconds are rejected.
FN-API-SIGNATUREHMAC-SHA256 signature of the pre-hash string, as hex.

How to sign a request

  1. Create the pre-hash string: timestamp + HTTP method (upper case) + path with query string + body (empty for GET).
  2. Hash it with HMAC-SHA256, using your API secret as the key.
  3. Send the result as lowercase hex in the signature header, together with the key and the same timestamp.
Node.js
import {createHmac} from 'node:crypto';

const timestamp = Date.now().toString();
const method = 'POST';
const path = '/v1/orders';
const body = JSON.stringify({
  symbol: 'BTC-USDT',
  side: 'buy',
  type: 'limit',
  quantity: '0.01',
  price: '60000.00',
});

// apiSecret: the secret shown once when the key was created
const signature = createHmac('sha256', apiSecret)
  .update(timestamp + method + path + body)
  .digest('hex');

Keep your API secret on your server only. Give each key the smallest set of permissions it needs and restrict it to your IP addresses.

Rate limits

Sample data

Limits are counted per IP address for public endpoints and per API key for private ones. When you go over a limit, the API answers with HTTP 429; wait until the window resets before retrying.

Sample rate limits
EndpointsLimit
Public market data20 requests per second
Account10 requests per second
Placing and cancelling orders5 requests per second
WebSocket connections5 connections per IP

Every response includes the remaining requests of the current window in the FN-RATELIMIT-REMAINING header.

Errors

Failed requests return a non-2xx HTTP status and a JSON body with a machine-readable code and a human-readable message.

Error codes
CodeMeaning
400INVALID_PARAMETERA parameter is missing or has an invalid value.
401INVALID_SIGNATUREThe signature does not match the request.
401TIMESTAMP_EXPIREDThe timestamp is outside the allowed window.
403PERMISSION_DENIEDThe API key lacks the required permission.
404ORDER_NOT_FOUNDNo order exists with this ID.
429RATE_LIMITEDToo many requests. Slow down and retry later.
500INTERNAL_ERRORSomething went wrong on our side. Retry later.

Sample error response

JSON
{
  "status": 401,
  "code": "INVALID_SIGNATURE",
  "message": "Signature does not match the request."
}

Market data

Ticker

Public
GET/v1/ticker

Last price, 24-hour change, high, low and volume of one market, or of all markets when no symbol is given.

Parameters

NameDescription
symbolstringOptionalMarket symbol, e.g. BTC-USDT. Leave empty for all markets.

Sample request

cURL
curl "https://api.finight.example/v1/ticker?symbol=BTC-USDT"

Sample response

JSON
{
  "symbol": "BTC-USDT",
  "last": "61234.20",
  "change24h": "2.24",
  "high24h": "61234.20",
  "low24h": "58921.60",
  "volume24h": "1824.51203",
  "timestamp": 1763812800000
}

Order book

Public
GET/v1/orderbook

Current bids and asks of a market, grouped by price level.

Parameters

NameDescription
symbolstringRequiredMarket symbol, e.g. BTC-USDT.
depthintegerOptionalNumber of levels per side: 5, 20 or 50. Default 20.

Sample request

cURL
curl "https://api.finight.example/v1/orderbook?symbol=BTC-USDT&depth=5"

Sample response

JSON
{
  "symbol": "BTC-USDT",
  "bids": [
    ["61234.10", "0.75300"],
    ["61232.80", "0.20000"],
    ["61230.30", "1.12000"]
  ],
  "asks": [
    ["61234.30", "0.42150"],
    ["61235.10", "0.10000"],
    ["61236.80", "1.25000"]
  ],
  "timestamp": 1763812800000
}
GET/v1/klines

Historical candles of a market. Each candle is an array of open time, open, high, low, close and volume.

Parameters

NameDescription
symbolstringRequiredMarket symbol, e.g. BTC-USDT.
intervalstringRequiredCandle interval: 1m, 5m, 15m, 1h, 4h or 1d.
startintegerOptionalStart time in milliseconds.
endintegerOptionalEnd time in milliseconds.
limitintegerOptionalNumber of candles, up to 500. Default 100.

Sample request

cURL
curl "https://api.finight.example/v1/klines?symbol=BTC-USDT&interval=1h&limit=3"

Sample response

JSON
[
  [1763805600000, "60740.5", "60979.8", "60702.7", "60937.5", "80.00"],
  [1763809200000, "60937.5", "60979.8", "60859.1", "60896.9", "86.37"],
  [1763812800000, "60896.9", "61276.5", "60859.1", "61234.2", "92.74"]
]

Account

Balances

Signed
GET/v1/balances

Available and locked balances of your account. Requires the “Read” permission.

Parameters

NameDescription
assetstringOptionalOnly return this asset, e.g. BTC.

Sample request

cURL
curl "https://api.finight.example/v1/balances" \
  -H "FN-API-KEY: $FN_API_KEY" \
  -H "FN-API-TIMESTAMP: $TIMESTAMP" \
  -H "FN-API-SIGNATURE: $SIGNATURE"

Sample response

JSON
{
  "balances": [
    {
      "asset": "BTC",
      "available": "0.25000000",
      "locked": "0.01000000"
    },
    {
      "asset": "ETH",
      "available": "3.10000000",
      "locked": "0.00000000"
    },
    {
      "asset": "USDT",
      "available": "1520.40",
      "locked": "600.00"
    }
  ]
}

Trading

POST/v1/orders

Places a limit or market order. Requires the “Trade” permission. Quantities and prices are sent as strings to keep their precision.

Parameters

NameDescription
symbolstringRequiredMarket symbol, e.g. BTC-USDT.
sidestringRequiredbuy or sell.
typestringRequiredlimit or market.
quantitydecimal stringRequiredAmount of the base asset.
pricedecimal stringOptionalLimit price. Required for limit orders.
clientOrderIdstringOptionalYour own ID for the order, up to 36 characters, to find it later.

Sample request

cURL
curl -X POST "https://api.finight.example/v1/orders" \
  -H "FN-API-KEY: $FN_API_KEY" \
  -H "FN-API-TIMESTAMP: $TIMESTAMP" \
  -H "FN-API-SIGNATURE: $SIGNATURE" \
  -H "Content-Type: application/json" \
  -d '{"symbol":"BTC-USDT","side":"buy","type":"limit","quantity":"0.01","price":"60000.00","clientOrderId":"my-order-1"}'

Sample response

JSON
{
  "id": "7f3c2a90-5b1e-4c8d-9a21-3e6f0b8d4c11",
  "symbol": "BTC-USDT",
  "side": "buy",
  "type": "limit",
  "quantity": "0.01",
  "price": "60000.00",
  "clientOrderId": "my-order-1",
  "status": "open",
  "filledQuantity": "0",
  "createdAt": 1763812800000
}
DELETE/v1/orders/:id

Cancels an open order. Requires the “Trade” permission.

Parameters

NameDescription
idstringRequiredID of the order, returned when it was placed (path parameter).

Sample request

cURL
curl -X DELETE "https://api.finight.example/v1/orders/7f3c2a90-5b1e-4c8d-9a21-3e6f0b8d4c11" \
  -H "FN-API-KEY: $FN_API_KEY" \
  -H "FN-API-TIMESTAMP: $TIMESTAMP" \
  -H "FN-API-SIGNATURE: $SIGNATURE"

Sample response

JSON
{
  "id": "7f3c2a90-5b1e-4c8d-9a21-3e6f0b8d4c11",
  "status": "cancelled",
  "cancelledAt": 1763812800000
}

Streaming

WS/v1/stream

Open one connection and subscribe to channels to receive ticker, order book and trade updates as they happen. The server sends a ping every 30 seconds; connections without a pong are closed.

Parameters

NameDescription
channelstringRequiredticker, orderbook or trades.
symbolstringRequiredMarket symbol, e.g. BTC-USDT.

Subscribe message

wscat
wscat -c "wss://api.finight.example/v1/stream"
> {"op":"subscribe","channel":"ticker","symbol":"BTC-USDT"}

Sample message from the server

JSON
{
  "channel": "ticker",
  "symbol": "BTC-USDT",
  "data": {
    "last": "61234.20",
    "change24h": "2.24",
    "timestamp": 1763812800000
  }
}

Ready to build?

Create an API key in your account settings, choose its permissions and start with the public market data endpoints.