Skip to main content

Documentation Index

Fetch the complete documentation index at: https://docs.4casters.io/llms.txt

Use this file to discover all available pages before exploring further.

The heartbeat keeps your session alive. Send a heartbeat with a requestTimeout (in seconds) — if the server does not receive another heartbeat before that timeout elapses, all of your open orders are automatically cancelled. You typically send heartbeats on a recurring interval (e.g. every 5s with a 10s timeout) for the lifetime of your connection.

Request

[
  "heartbeat",
  {
    "requestID": "YOUR_REQUEST_ID",
    "requestTimeout": 10
  }
]
requestID
string
A client-generated identifier; echoed back on the response. If omitted, the server generates one.
requestTimeout
number
required
Number of seconds the server should wait for the next heartbeat before cancelling all of your open orders. Must be greater than 0.

Response

The server replies with a heartbeatAck containing the server’s clock and the active timeout.
{
  "requestID": "YOUR_REQUEST_ID",
  "data": {
    "type": "heartbeatAck",
    "serverTime": "2026-04-22T15:30:00.123456789Z",
    "timeoutSec": 10
  }
}
data.type
string
Always heartbeatAck.
data.serverTime
string
Current server time as RFC 3339 with nanosecond precision.
data.timeoutSec
number
Echoes the requestTimeout you sent.

Errors

If requestTimeout is missing or <= 0, the server returns:
{
  "requestID": "YOUR_REQUEST_ID",
  "error": "Invalid heartbeat timeout"
}