API: on-call and alert channels
Rotations, teams, escalation policies, Slack, Microsoft Teams and webhook channels, and alert sources, managed from code.
On-call is an admin’s work: these calls need an admin token (reading them, a read token). On-call itself comes with Team and Business (402 with limit: "on_call" on the others).
Rotations
curl -sS -X POST "$HEIMDALL/rotations" \
-H "Authorization: Bearer $HEIMDALL_API_TOKEN" -H "Content-Type: application/json" \
-d '{
"name": "Primary on-call",
"starts_at": "2026-11-02T09:00:00+03:00",
"shift_hours": 168,
"contact_ids": ["email:ayse@example.com", "email:mehmet@example.com"]
}'{
"id": "01JC4QD1F4J7M0Q3T6W9Z2C5G8",
"name": "Primary on-call",
"starts_at": "2026-11-02T06:00:00Z",
"shift_hours": 168,
"contact_ids": ["01JC4Q7T2W5Z8C1F4J7M0Q3S6V", "01JC4Q7T3A6D9G2K5N8R1U4X7Z"],
"primary_id": "01JC4Q7T2W5Z8C1F4J7M0Q3S6V",
"secondary_id": "01JC4Q7T3A6D9G2K5N8R1U4X7Z",
"next_handover_at": "2026-11-09T06:00:00Z"
}starts_at is when the first shift starts, shift_hours the length of a shift (168 is a week), contact_ids the order; primary_id is on call now, secondary_id next. Before the first shift starts the first person is on call already, through the end of that shift: next_handover_at is then starts_at plus one shift, as above. team_id makes it a team’s rotation. PUT /rotations/{id} replaces it, DELETE removes it.
Teams
{
"name": "Platform",
"member_ids": ["email:ayse@example.com", "email:mehmet@example.com"],
"lead_ids": ["email:ayse@example.com"],
"escalation_policy_id": "01JC4QD9K2N5Q8T1W4Z7C0F3J6"
}A monitor with team_id sends its alerts to that team; escalation_policy_id is what the team’s monitors follow when they name no policy of their own; lead_ids (among the members) may manage the team without being admins.
Escalation policies
curl -sS -X POST "$HEIMDALL/escalation-policies" \
-H "Authorization: Bearer $HEIMDALL_API_TOKEN" -H "Content-Type: application/json" \
-d '{
"name": "Platform on-call",
"rotation_id": "01JC4QD1F4J7M0Q3T6W9Z2C5G8",
"repeat": 1,
"steps": [
{ "after_seconds": 0, "targets": ["primary"], "channels": ["sms", "email"] },
{ "after_seconds": 600, "targets": ["primary"], "channels": ["call"], "phone_from": "critical" },
{ "after_seconds": 1200, "targets": ["secondary", "email:cto@example.com", "integration:01JC4QF3H6L9P2S5V8Y1B4E7H0"],
"channels": ["sms", "call"] }
]
}'| In a step | What it is |
|---|---|
after_seconds | Seconds after the incident opened (0–86400); steps run in that order while nobody acknowledges. |
targets | primary and secondary (of rotation_id), all (everybody alerted here — for a team’s monitor, the team — and the channels in the incident’s scope, which hear the first step anyway: on a later step all posts that step to them too), email:<address> (answered as contact:<id>), team:<id>, integration:<id>. |
channels | For people: sms, call, email, telegram. push is accepted too, but sends nothing until the Heimdall app receives push notifications (“soon”). A channel target uses its own kind. |
phone_from | critical, major or minor: SMS and calls in this step only for incidents at least that serious (the other channels go out anyway). Left out: every incident. |
repeat(0–10): how many times the whole policy runs again while nobody acknowledges.- A monitor follows the policy in its
escalation_policy_id, or its team’s, or the organisation’s default. - A change applies to incidents opened from then on; open ones keep the policy they started with.
- The default:
GET /default-escalation-policyreads it,PUTsaves it (the same body),DELETEgoes back to the built-in rule.
Alert channels
# Slack: an incoming-webhook address
{ "kind": "slack", "name": "#ops", "url": "https://hooks.slack.com/services/T000/B000/XXXX" }
# Microsoft Teams: a channel's Workflows webhook address
{ "kind": "teams", "name": "Ops channel", "url": "https://prod-00.westeurope.logic.azure.com/workflows/…" }
# your own receiver: any public https address
{ "kind": "webhook", "name": "Our incident bot", "url": "https://bots.example.com/heimdall" }{
"id": "01JC4QF3H6L9P2S5V8Y1B4E7H0",
"kind": "webhook",
"name": "Our incident bot",
"url_hint": "bots.example.com/…",
"enabled": true,
"all_teams": true,
"secret": "whsec_TDG4UEHJORclu-5djRTmmeff-3NmcZM_oLqguB0RipM",
"created_at": "2026-10-27T20:13:43Z"
}- The address is never shown again (
url_hintonly). A webhook’s signingsecretis in this answer only: keep it, your receiver checks every request with it (Alerts, on-call and escalation). team_idmakes it a team’s channel; an organisation’s channel hears every team’s incidents too unlessall_teamsisfalse.PATCH /integrations/{id}changesname,enabled,team_id,all_teams; to change the address, make a new channel and delete the old one.POST /integrations/{id}/testsends a test message now and says what the destination answered.
Alert sources
An alert source is the address your own tools send their alerts to (Alert sources). Sources are managed with an admin token; their alerts arrive at the address itself, which needs no token of the API.
curl -sS -X POST "$HEIMDALL/alert-sources" \
-H "Authorization: Bearer $HEIMDALL_API_TOKEN" -H "Content-Type: application/json" \
-d '{
"name": "Prometheus production",
"format": "alertmanager",
"team_id": "01JC4QE2G5K8N1R4U7X0A3D6G9",
"default_severity": "major"
}'{
"source": {
"id": "01JC6B3M8P1S4V7Y0B3E6H9K2N",
"name": "Prometheus production",
"team_id": "01JC4QE2G5K8N1R4U7X0A3D6G9",
"team_name": "Platform",
"format": "alertmanager",
"token_prefix": "hin_Qm7c…",
"default_severity": "major",
"paused": false,
"over_plan": false,
"open_incidents": 0,
"ignored_count": 0,
"created_at": "2026-11-10T09:12:44Z"
},
"token": "hin_Qm7c…",
"url": "https://heimdall.warewave.tech/in/hin_Qm7c…"
}url(and itstoken) are in this answer only: give it to your tool, or keep it in your secret store.POST /alert-sources/{id}/tokengives the source a new one and stops the old one at once.format:generic(Heimdall JSON),alertmanager,grafanaorzabbix; it stays.team_idis required.escalation_policy_idis the source’s own policy; without one it follows its team’s, else the organisation’s default.max_severity(critical,major,minor;nonetakes it off) lowers every alert of the source to it.paused: truemakes it answer202and open nothing.PUT /alert-sources/{id}changes the name, team, policy, severities and pause;DELETEstops its address and closes its open incidents.GET /alert-sourceslists them, with each one’s last request and the last body it could not read (last_error).- Before the account’s first source its owner accepts the Alert Sources terms in the app — never with a token: until then
POSTanswers409 terms_required. How many sources the account may have is the plan’s (402,limit: "alert_sources").
A webhook receiver
A webhook channel POSTs JSON to your address when an incident it hears opens, escalates, is acknowledged, is resolved, or reminds; and test from the test button. The incident’s severity (critical, major, minor) is in it, so your receiver can decide for itself what to do with which.
POST /your/receiver HTTP/1.1
Content-Type: application/json
User-Agent: Heimdall-Webhook/1
X-Heimdall-Signature: t=1793134980,v1=5f0c2a…
{
"event": "incident.opened",
"sent_at": "2026-10-28T07:43:00Z",
"incident": {
"id": "01JC5A2K7N4P8Q3R6S9T1V5WXY",
"ref": "INC-0142",
"title": "API is down",
"severity": "critical",
"monitor": "API",
"target": "https://api.example.com/health",
"reason": "HTTP 503 (expected 200)",
"failing_regions": 3,
"total_regions": 3,
"opened_at": "2026-10-28T07:42:51Z",
"url": "https://heimdall.warewave.tech/app/incidents/01JC5A2K7N4P8Q3R6S9T1V5WXY"
}
}event:incident.opened,incident.escalated,incident.acknowledged,incident.resolved,incident.reminderortest(which has noincident). New fields may be added; ignore the ones you do not know.X-Heimdall-Signatureist=<unix seconds>,v1=<hex>: the HMAC-SHA256 of<t>.<body>with the channel’s secret. Check it against the raw body, before parsing, and refuse atmore than five minutes away — that stops a replay.- Answer with a 2xx within 10 seconds and do the work afterwards. A timeout,
408,429or5xxis tried again later; any other answer is not, and the incident’s timeline says so. - A delivery may come twice (an answer lost on the way).
incident.openedandincident.resolvedcome once per incident,incident.escalatedonce per step and round, andincident.acknowledgedonce per run of alerts: again when a snooze ran out (incident.reminder) and it was acknowledged or snoozed anew. - A snooze is an acknowledgement until it ends: snoozed while open, the incident’s
incident.acknowledgedcarriesincident.snoozed_until, and the alerts start again then (incident.reminder) if it is still down. incident.resolvedcarriesincident.resolution:howisrecovered(the monitor is back),by_hand(somebody resolved it;bynames them) orstopped(its monitoring stopped:stopispaused,deletedorplan_limit), andstill_downsays whether the monitor was down when it closed. Onlyrecoveredis an all-clear; a monitor closed by hand while still down opens a new incident — a newincident.opened— at its next failed check.- An incident’s acknowledgement and resolution never arrive before its opening, even when the opening had to be tried again; if it failed for good, they come all the same.
- An alert source’s incident has an empty
monitorand no regions; it carriessource(the source’s name) and what its tool sent last:details(key → text) andlinks(text,url).
import hashlib, hmac, json, time
SECRET = b"whsec_…" # from the answer that made the channel
def verified(raw_body: bytes, header: str) -> dict:
parts = dict(p.split("=", 1) for p in header.split(","))
t, sig = int(parts["t"]), parts["v1"]
if abs(time.time() - t) > 300:
raise ValueError("too old: a replay")
mac = hmac.new(SECRET, f"{t}.".encode() + raw_body, hashlib.sha256).hexdigest()
if not hmac.compare_digest(mac, sig):
raise ValueError("not from Heimdall")
return json.loads(raw_body)
event = verified(request_body, request_headers["X-Heimdall-Signature"])
if event["event"] == "incident.opened" and event["incident"]["severity"] == "critical":
page_the_on_call_room(event["incident"])