Skip to main content

OpenClaw Heartbeat

The endpoint the OpenClaw daemon posts to on each heartbeat. It records gateway health and token usage for the connection the key is bound to. You normally don’t call this yourself — the daemon does — but it’s documented here for reference and debugging.
POST https://api.opsmatic.com/v1/openclaw/ingest
Requires a usage-ingestion API key scoped to the OpenClaw connection (generated when the connection is created — see OpenClaw setup).

Headers

Authorization
string
required
Bearer ops_... — must be a usage-ingestion key for this connection.

Body

type
string
required
Heartbeat type emitted by the daemon.
gateway
object
required
Gateway health: status (healthy / unhealthy), latencyMs, version.
system
object
Host signals, e.g. gatewayPidAlive.
tokens
object
Usage for the period: period totals (inputTokens, outputTokens, cacheReadTokens, cacheWriteTokens, requestCount, estimatedCostUsd, startedAt, endedAt) and an optional byModel breakdown.
Ingestion is idempotent — retrying the same heartbeat is safe and won’t double-count. When a byModel entry omits estimatedCostUsd, Opsmatic prices the token counts server-side using its pricing table.
curl -X POST https://api.opsmatic.com/v1/openclaw/ingest \
  -H "Authorization: Bearer ops_usage_ingestion_key" \
  -H "Content-Type: application/json" \
  -d '{
    "type": "heartbeat",
    "gateway": { "status": "healthy", "latencyMs": 42, "version": "1.4.0" },
    "system": { "gatewayPidAlive": true },
    "tokens": {
      "period": {
        "inputTokens": 128000,
        "outputTokens": 34000,
        "cacheReadTokens": 8000,
        "cacheWriteTokens": 0,
        "requestCount": 57,
        "estimatedCostUsd": 1.42,
        "startedAt": "2026-07-06T00:00:00Z",
        "endedAt": "2026-07-06T01:00:00Z"
      },
      "byModel": [
        { "model": "claude-sonnet-4-5", "inputTokens": 128000, "outputTokens": 34000 }
      ]
    }
  }'
{ "message": "Heartbeat recorded", "heartbeat_id": "hb_abc123" }