Signals the WebSocket connection to send and request heartbeats. Heartbeats are used to detect stale or broken connections.
Heartbeat & Disconnect Lifecycle:
- When no message has been sent to the client for interval seconds, the server sends a heartbeat notification ("params": {"type": "heartbeat"}).
- When no message has been received from the client for interval seconds (plus 500 ms), the server sends a heartbeat notification with "params": {"type": "test_request"}. Respond by sending a /api/v2/public/test request.
- Any JSON text message from the client counts as activity and restarts this timer; WebSocket-level ping/pong frames and the plain-text ping / PING messages do not.
- If the connection stays silent until (2 * interval) + 500 ms after the last client message, the server closes the WebSocket with close code 4000 (heartbeat close).
- If Cancel on Disconnect is enabled for the connection (connection or account scope), orders created over this connection are cancelled when it is closed.
- Calling this method again replaces the previous interval.
Validation: interval must be an integer between 10 and 300 seconds inclusive. Any other value (including fractional numbers) returns JSON-RPC error -32602.
WebSocket Only: This method is designed exclusively for WebSocket connections. Calling it over REST/HTTP returns error 10030 (must_be_websocket_request).
Request
- Base URLhttps://test.deribit.com/api/v2
- URLhttps://test.deribit.com/api/v2/public/set_heartbeat
- Authnone declared
Query parameters
The heartbeat interval in seconds (allowed range: 10 to 300)
Response
Success response
Changes
- breaking
for the
queryrequest parameterinterval, the type changed fromnumbertointeger - warning
for the
queryrequest parameterinterval, the max was set to300.00 - warning
for the
queryrequest parameterinterval, the min was set to10.00
- breaking