normbeat

Docs

Last updated:

Everything beyond the basics: pings, creating checks from code, importing past counts, and webhooks. Questions: hello@normbeat.com.

Pings

Each check has a ping URL, https://ping.normbeat.com/p/KEY. GET and POST both work.

The Python client sends these for you: with normbeat.run("KEY") as r: r.count(rows).

Create checks from code (API)

With many jobs, let each one create its own check. Create an API key on the Account page in the dashboard. It's shown once; keep it secret like a password.

curl -X POST https://ping.normbeat.com/api/v1/checks \
  -H "Authorization: Bearer $NORMBEAT_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"name": "orders load", "cron": "0 2 * * *", "tz": "Europe/Berlin"}'

If a check with exactly that name exists, it's returned unchanged (200). Otherwise it's created (201). The answer includes ping_url and ping_key, so a job can call this at start-up every run.

Fields:

In Python (version 0.2.0 or newer), with NORMBEAT_API_KEY set:

key = normbeat.check("orders load", cron="0 2 * * *", tz="Europe/Berlin")
with normbeat.run(key) as r:
    r.count(load_orders())

Errors come back as JSON with an error message: 401 for a missing or wrong key, 400 for invalid fields, 403 when your plan's checks are all in use, 429 above 60 requests a minute. The Python client logs these and never raises.

Import past counts

normbeat learns each job's normal range from three or more earlier runs on the same weekday, which normally takes three weeks. If you already have past counts, in logs or your warehouse, paste them on the check's page under Import past counts and the range works from the next run.

2026-11-03 02:05, 48211
2026-11-04T02:04:00Z, 47390
2026-11-08, 9814

A query like this produces the lines: SELECT loaded_at, row_count FROM load_log WHERE job = 'orders' AND loaded_at > now() - interval '10 weeks'.

Webhook alerts

Add a webhook on the Alerts page. normbeat POSTs each alert to your URL as JSON:

{
  "event": "low",
  "text": "[normbeat] orders load far fewer rows than usual ...",
  "content": "(same text, for Discord)",
  "subject": "[normbeat] orders load far fewer rows than usual",
  "check": {"id": "...", "name": "orders load", "url": "https://app.normbeat.com/checks/..."},
  "count": 312,
  "expected": {"low": 3800, "high": 4500},
  "run_at": "2026-12-06T02:03:00Z",
  "sent_at": "2026-12-06T02:03:04Z"
}

Checking it's really from normbeat. Each request has X-Normbeat-Timestamp (Unix seconds) and X-Normbeat-Signature: v1=<hex>, an HMAC-SHA256 of timestamp + "." + body with your webhook's signing secret (shown on the Alerts page). In Python:

import hashlib, hmac, time

def is_from_normbeat(secret, timestamp, signature, body: bytes) -> bool:
    if abs(time.time() - int(timestamp)) > 300:
        return False
    mac = hmac.new(secret.encode(), timestamp.encode() + b"." + body, hashlib.sha256)
    return hmac.compare_digest("v1=" + mac.hexdigest(), signature)