HTTP check-in API for scheduled jobs
The Alert51 cron monitoring API: one authenticated POST per run reports the result and schedule of a cron job, backup or CI pipeline. Examples cover curl, Node.js fetch and GitLab CI. Every example reads the API base URL from $ALERT51_URL, which is https://api.alert51.com.
New to Alert51? Start with how to monitor cron jobs, backup job monitoring, or see how it works and plans.
Quickstart
- Create an account and verify your email address.
- Create an API token in the dashboard under API tokens. Copy the secret; it is shown once.
- Set two environment variables where your job runs.
- Add the check-in request after the command you want to watch.
export ALERT51_URL="https://api.alert51.com"
export ALERT51_TOKEN="a51_xxxxxxxx_your-secret"./backup.sh && curl --fail-with-body --silent --show-error \
--max-time 10 \
-H "Authorization: Bearer $ALERT51_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"project": "production",
"job": "db-backup",
"status": "success",
"cron": "0 */12 * * *",
"timezone": "Europe/Moscow",
"graceSeconds": 900
}' \
"$ALERT51_URL/v1/check-ins"The first check-in creates the project production and the monitor db-backup, stores the schedule and starts watching. Run it once by hand to see the monitor appear. Because of &&, a failed backup sends nothing, and Alert51 opens a missed incident after the deadline. To alert at once instead, report "status": "failure" (see the examples below).
AI Instructions
A self-contained integration guide for coding agents. Give an agent the raw file at /ai-instructions.md or paste the copied text into its prompt. This chapter is rendered from the same file.
What Alert51 does
a run reports "status": "failure"(the incident opens at once), orno check-in arrives before the deadline: the next scheduled time plus the grace period (a missed run).
project and job pair. That request creates the project and the monitor; nothing has to be set up in the dashboard first, and nothing is watched before that request succeeds. Notifications go to the channels configured in the dashboard (email, Telegram, webhooks).
Rules for agents
Inspect the existing job before changing anything: where it is scheduled (crontab, systemd timer, Kubernetes CronJob, CI schedule, an in-process scheduler), its exact schedule and time zone, how long it usually runs, and how it reports failure (exit code, exception, return value). Make the smallest integration change: one check-in after the job's work finishes, in the code path that already knows the outcome. Do not refactor the job, rename it or change its schedule. Never change the job's outcome. Keep its exit code and re-raise its original exception, even if the check-in request fails. Log reporting errors and continue. Use a finite HTTP timeout of about 10 seconds for the check-in request. Read the token from the ALERT51_TOKENenvironment variable or the project's existing secret store. Never hard-code, commit, print or log a real token. Use placeholders such asa51_xxxxxxxx_your-secretin examples and addALERT51_TOKEN=to.env.exampleif the project keeps one.Use the HTTP client the project already has. Do not add a dependency just for Alert51. Send the check-in after the work completes, not when it starts. Alert51 has no start signal. Choose stable slugs: projectfor the environment or system (for exampleproduction),jobfor the task (for exampledb-backup). The same pair must be used on every run.
Get an API token
Sign up at https://alert51.com/signup and verify the email address. Open the dashboard page API tokens (https://alert51.com/app/tokens) and create a token. Name it after where it runs, for example backup-server-1orgitlab-ci.Copy the secret. It is shown once and looks like a51_xxxxxxxx_your-secret.Store it as ALERT51_TOKENin the place where the job runs: a CI masked variable, a Kubernetes Secret, a vault, a systemdEnvironmentFile, or an uncommitted.envfile.
Endpoint
POST https://api.alert51.com/v1/check-insPOST https://alert51.com/api/v1/check-ins. Examples in this guide build the URL as $ALERT51_URL/v1/check-ins with ALERT51_URL defaulting to https://api.alert51.com. Set ALERT51_URL=https://alert51.com/api, or https://your-host/api for a self-hosted instance, to use the web origin.
Authorization: Bearer <token>(required)Content-Type: application/json(required)Idempotency-Key: <key>(optional, see Idempotency)
Request fields
project(required): slug matching^[a-z0-9][a-z0-9_.-]{0,62}$. Input is trimmed and lowercased.job(required): slug with the same pattern, unique inside the project.status(required):successorfailure. No other values are accepted.cron(required on the first check-in): five-field cron expression, for example0 3 * * *. Omit it later to keep the stored schedule; a different value updates the schedule.timezone(optional): IANA time zone such asEurope/Berlin. DefaultUTC.graceSeconds(optional): integer from 0 to 604800 (7 days). Default 300.scheduledAt(optional): ISO 8601 date-time with an offset, the scheduled time this run belongs to. Must be within 7 days in the past and 5 minutes in the future.name(optional): display name, 1 to 120 characters. Defaults to the job slug.message(optional): up to 1000 characters, for example the error text of a failed run. Truncate longer text and never include secrets.durationMs(optional): run duration in milliseconds, a non-negative integer.
cron; without it the API answers 422 cron_required. Send timezone and graceSeconds on the first check-in too, because the defaults (UTC, 300 seconds) are stored when the monitor is created. Later check-ins may send only project, job and status. Sending the same cron, timezone and graceSeconds on every run is also fine and keeps the schedule in code; Alert51 only records a schedule change when a value differs.
Minimal curl example
curl --fail-with-body --silent --show-error --max-time 10 \
-X POST "${ALERT51_URL:-https://api.alert51.com}/v1/check-ins" \
-H "Authorization: Bearer $ALERT51_TOKEN" \
-H "Content-Type: application/json" \
-d '{"project":"production","job":"db-backup","status":"success","cron":"0 3 * * *","timezone":"UTC","graceSeconds":1800}'curl --fail-with-body --silent --show-error --max-time 10 \
-X POST "${ALERT51_URL:-https://api.alert51.com}/v1/check-ins" \
-H "Authorization: Bearer $ALERT51_TOKEN" \
-H "Content-Type: application/json" \
-d '{"project":"production","job":"db-backup","status":"success"}'Match the job's schedule
cronmust be the expression that actually triggers the job, with exactly five fields: minute, hour, day of month, month, day of week. Macros such as@dailyand six-field expressions with seconds are rejected (422 invalid_cron). Write0 0 * * *instead of@daily, and drop the leading seconds field of Spring or Quartz expressions.timezonemust be the zone the scheduler evaluates the expression in. Crontab uses the server's local zone unlessCRON_TZis set; Kubernetes CronJobs use.spec.timeZoneor the controller's zone (usually UTC); GitHub Actions schedules are UTC; GitLab pipeline schedules have their own time zone setting. A wrong zone produces false missed-run alerts.graceSecondsis how long after the scheduled time the check-in may arrive. The check-in is sent when the job ends, so set it above the job's longest normal duration plus any start delay, for example 1800 for a backup that takes up to 20 minutes.If a schedule cannot be expressed in cron (for example some systemd OnCalendarvalues), use the closest cron expression and a larger grace period.Each check-in is assigned to the latest scheduled time at or before the time it is received plus 60 seconds of early tolerance. If runs can start late (queues, retries), send scheduledAtwith the intended scheduled time so the run is matched to the right slot. Reports older than the latest applied one are stored asstaleand do not change the monitor.The deadline is the next scheduled time after the run's slot plus graceSeconds. The response returnsnextRunAtanddeadlineAt; check them after the first check-in.
Failures and missed runs
Explicit failure: when the job fails and can still run code, send "status": "failure"with a shortmessage. Alert51 opens an incident with causefailureat once. The nextsuccessresolves it.Missed run: if no check-in arrives by deadlineAt, Alert51 opens an incident with causemissed. This covers crashes, killed processes, stopped servers and disabled schedulers, so a job that dies without reporting is still detected.Do not report successfrom a code path that also runs after a failure, and do not report at the start of the job.
Integration patterns
#!/bin/sh
started=$(date +%s)
/opt/scripts/backup.sh
code=$?
if [ "$code" -eq 0 ]; then status=success; else status=failure; fi
duration_ms=$(( ($(date +%s) - started) * 1000 ))
curl --fail-with-body --silent --show-error --max-time 10 \
-X POST "${ALERT51_URL:-https://api.alert51.com}/v1/check-ins" \
-H "Authorization: Bearer $ALERT51_TOKEN" \
-H "Content-Type: application/json" \
-d "{\"project\":\"production\",\"job\":\"db-backup\",\"status\":\"$status\",\"cron\":\"0 3 * * *\",\"timezone\":\"UTC\",\"graceSeconds\":1800,\"durationMs\":$duration_ms}" \
|| echo "Alert51 check-in failed" >&2
exit "$code"fetch:
async function reportToAlert51(status, startedAt, message) {
try {
const response = await fetch(`${process.env.ALERT51_URL ?? 'https://api.alert51.com'}/v1/check-ins`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.ALERT51_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
project: 'production',
job: 'db-backup',
status,
cron: '0 3 * * *',
timezone: 'UTC',
graceSeconds: 1800,
durationMs: Date.now() - startedAt,
message: message?.slice(0, 1000),
}),
signal: AbortSignal.timeout(10_000),
});
if (!response.ok) console.error(`Alert51 check-in rejected: ${response.status} ${await response.text()}`);
} catch (error) {
console.error(`Alert51 check-in failed: ${error}`);
}
}
const startedAt = Date.now();
try {
await runBackup();
} catch (error) {
await reportToAlert51('failure', startedAt, String(error));
throw error;
}
await reportToAlert51('success', startedAt);import json
import os
import sys
import time
import urllib.request
def report_to_alert51(status, started, message=None):
try:
body = {
"project": "production",
"job": "db-backup",
"status": status,
"cron": "0 3 * * *",
"timezone": "UTC",
"graceSeconds": 1800,
"durationMs": int((time.monotonic() - started) * 1000),
}
if message:
body["message"] = message[:1000]
request = urllib.request.Request(
os.environ.get("ALERT51_URL", "https://api.alert51.com") + "/v1/check-ins",
data=json.dumps(body).encode(),
headers={"Authorization": "Bearer " + os.environ["ALERT51_TOKEN"], "Content-Type": "application/json"},
method="POST",
)
with urllib.request.urlopen(request, timeout=10):
pass
except Exception as error:
print(f"Alert51 check-in failed: {error}", file=sys.stderr)
started = time.monotonic()
try:
run_backup()
except Exception as error:
report_to_alert51("failure", started, str(error))
raise
report_to_alert51("success", started)after_script with $CI_JOB_STATUS, GitHub Actions if: always() with job.status) and end the command with || true so reporting never changes the pipeline result.
SDKs
Responses
201 Created means this check-in created the monitor. 200 OK means it was recorded for an existing monitor. Both return the same JSON:
{
"monitorId": "0b7f3c52-6f1e-4c55-9a1d-3b8c2e9d4f10",
"project": "production",
"job": "db-backup",
"created": true,
"checkIn": {
"id": "c6a1e0d4-2b9f-4c1a-8e57-91f0a3d2b6e8",
"status": "success",
"receivedAt": "2026-11-23T03:07:12.000Z",
"slotAt": "2026-11-23T03:00:00.000Z",
"outcome": "applied",
"late": false
},
"schedule": { "cron": "0 3 * * *", "timezone": "UTC", "graceSeconds": 1800, "changed": false },
"monitorStatus": "up",
"nextRunAt": "2026-11-24T03:00:00.000Z",
"deadlineAt": "2026-11-24T03:30:00.000Z",
"incident": null
}checkIn.outcomeisapplied,stale(older than the latest applied report) orpaused(the monitor is paused in the dashboard).checkIn.lateis true when the check-in arrived after its slot's grace period.monitorStatusisup,downorpaused;incidentdescribes the open incident, if any.
Errors
{ "error": { "code": "...", "message": "...", "details": ... }, "requestId": "..." }. Log the status, code and requestId, never the token.
400 validation_failed: the body or theIdempotency-Keyheader is invalid.detailslists{ "path", "message" }per field. Fix the payload; do not retry.401 unauthorized: the token is missing, invalid or revoked. Do not retry; ask the user to checkALERT51_TOKEN.403 quota_exceeded: the account's plan limit for monitors or projects is reached. Do not retry; ask the user to remove a monitor or upgrade.409 idempotency_key_reuse: theIdempotency-Keywas already used with a different body.413 payload_too_large: the body is larger than 16 KB.422 cron_required,invalid_cron,invalid_timezone,scheduled_at_out_of_range: the schedule fields are wrong. Fix them; do not retry.429 rate_limited: too many requests. The API allows 3 requests per second per token, and the edge may also limit by client IP. Wait the number of seconds in theRetry-Afterheader (the API also returns it aserror.details.retryAfterSeconds); a 429 from the edge may not have a JSON body.5xx, timeouts and network errors are temporary. Retry at most once or twice with a short backoff and the sameIdempotency-Key, within the job's own time budget, and then give up and log. Never block or fail the job because Alert51 is unreachable.
Idempotency
Idempotency-Key header (1 to 255 visible ASCII characters) to make retries safe. The same key with the same body within 24 hours returns the original response with the header Idempotent-Replayed: true and records nothing new. The same key with a different body returns 409 idempotency_key_reuse. Build the key from something unique per run, such as the job name plus the scheduled time or the CI run ID, for example db-backup-2026-11-23T03:00Z.
Verification checklist
project staging or job db-backup-test) and a test token, a test notification destination, or a local Alert51 instance, so simulated failures do not page anyone.
Send the first check-in with cron,timezoneandgraceSeconds. Expect201and"created": true.Check that scheduleechoes the intended values and thatnextRunAtanddeadlineAtmatch the job's next scheduled time and that time plus the grace period. A check-in sent by hand outside the scheduled window is matched to the previous scheduled time and reported with"late": true; that is expected for a manual test.Send a later check-in without cron. Expect200and"created": false.Simulate a failure (make the test job exit non-zero or raise). Expect a failurecheck-in, an open incident in the response, and the job's original exit code or exception unchanged.Send a check-in with an invalid token. Expect 401, and confirm the job still finishes with its own result.Point ALERT51_URLat an unreachable address and confirm the job ends within the timeout with its own result.Delete or pause the test monitor in the dashboard when done, and confirm the real job's monitor appears after its first real run.
Authentication
Every developer API request carries an API token in the Authorization header:
Authorization: Bearer a51_xxxxxxxx_your-secret- Tokens belong to your account, not to a project. One token can report any project and any job.
- Create several named tokens, for example one per developer, server or deployment, so you can revoke one without touching the others.
- The secret is shown once, when you create the token. Alert51 stores only a hash; the dashboard shows the prefix to tell tokens apart.
- Revoked tokens stop working immediately and get 401 unauthorized.
- Each token shows when it was last used, which helps find tokens nobody needs.
Keep tokens in a secret store or CI variable, never in the repository.
Token management
Manage tokens in the dashboard on the API tokens page. Creating a token requires a verified email address. The number of tokens is limited by your plan.
- Create: give the token a name that says where it lives, such as backup-server-1 or gitlab-ci.
- Rotate: create a new token, deploy it, check that the old token’s last-used time stops moving, then revoke the old one.
- Revoke: takes effect immediately. Revoked tokens stay in the list for reference.
SDKs
Small clients for Node.js, Java, PHP, Python and Go wrap POST /v1/check-ins: configure the API token once and report a run with one call. Each SDK sends the token as a Bearer header, uses a 10 second timeout by default, makes one attempt per call, and never puts the token in errors or logs. success and failure are shortcuts over the same check-in call, which also accepts graceSeconds, scheduledAt, name, durationMs and an idempotency key.
The first check-in for a job must include cron: it creates the project and monitor. Later check-ins can omit the schedule. Errors expose the HTTP status and the API error code, for example 401 unauthorized or 429 rate_limited with the retry delay.
Node.js 18+, built-in fetch, TypeScript declarations included, no runtime dependencies. Source: sdks/node (npm package @alert51/sdk). baseUrl defaults to https://api.alert51.com/v1. For a self-hosted origin use https://your-host/api/v1.
Install from the repository
npm --prefix sdks/node install && npm --prefix sdks/node run build
npm install ./path/to/alert51/sdks/nodeConfigure
Set ALERT51_TOKEN where the job runs; keep the token out of code and logs.
import { Alert51Client } from '@alert51/sdk';
const alert51 = new Alert51Client({
token: process.env.ALERT51_TOKEN,
timeoutMs: 10_000,
});Report success
await alert51.success({
project: 'production',
job: 'db-backup',
cron: '0 3 * * *',
timezone: 'Europe/Moscow',
});Report failure
await alert51.failure({
project: 'production',
job: 'db-backup',
message: 'pg_dump exited with code 1',
});Report a backup's real outcome
Reports success or failure from the backup result. If reporting the failure also fails, the original backup error is still raised, so the job keeps its own exit status.
const started = Date.now();
try {
await runBackup();
} catch (jobError) {
await alert51
.failure({ project: 'production', job: 'db-backup', message: String(jobError), durationMs: Date.now() - started })
.catch((reportError) => console.error('Alert51 failure report was not delivered:', reportError.message));
throw jobError;
}
await alert51.success({ project: 'production', job: 'db-backup', cron: '0 3 * * *', durationMs: Date.now() - started });Handle errors
import { Alert51ApiError, Alert51TimeoutError } from '@alert51/sdk';
try {
await alert51.success({ project: 'production', job: 'db-backup' });
} catch (error) {
if (error instanceof Alert51ApiError) console.error(error.status, error.code, error.requestId, error.retryAfterSeconds);
if (error instanceof Alert51TimeoutError) console.error('Timed out after', error.timeoutMs, 'ms');
}Check-in request
POST /v1/check-ins with a JSON body up to 16 KB. Send one per run, when the run finishes.
| Field | Required | Description |
|---|---|---|
| project | Yes | Project slug. Created on first use if your plan allows another project. Pattern ^[a-z0-9][a-z0-9_.-]{0,62}$. |
| job | Yes | Job slug, unique within the project. Same pattern as project. |
| status | Yes | success or failure. A failure opens an incident right away. |
| cron | First check-in | Standard 5-field cron expression of the job’s schedule. Required when the monitor does not exist yet; optional afterwards. |
| timezone | No | IANA time zone the cron expression runs in, such as Europe/Moscow. Default UTC. |
| graceSeconds | No | How long after the scheduled time to wait before the run counts as missed. Default 300, maximum 604800 (7 days). |
| scheduledAt | No | ISO-8601 time the run was scheduled for. Gives exact slot attribution for slow or retried runs. Up to 5 minutes in the future and 7 days in the past. |
| name | No | Human-readable monitor name shown in the dashboard and alerts. |
| message | No | Up to 1000 characters, such as the last error line or a pipeline URL. Included in alerts. |
| durationMs | No | How long the run took, in milliseconds. Shown in check-in history. |
Response
A successful request returns the stored check-in, the schedule now in effect, the next run, the deadline and any open incident. checkIn.outcome is applied, stale or paused.
{
"monitorId": "0b7f3c52-6f1e-4c55-9a1d-3b8c2e9d4f10",
"project": "production",
"job": "db-backup",
"created": true,
"checkIn": {
"id": "c6a1e0d4-2b9f-4c1a-8e57-91f0a3d2b6e8",
"status": "success",
"receivedAt": "2026-11-22T21:07:12.000Z",
"slotAt": "2026-11-22T21:00:00.000Z",
"outcome": "applied",
"late": false
},
"schedule": {
"cron": "0 */12 * * *",
"timezone": "Europe/Moscow",
"graceSeconds": 900,
"changed": true
},
"monitorStatus": "up",
"nextRunAt": "2026-11-23T09:00:00.000Z",
"deadlineAt": "2026-11-23T09:15:00.000Z",
"incident": null
}Schedules and timing
- Monitoring starts with the first check-in. Before that, Alert51 does not know the job exists and cannot miss it.
- Slot. Each check-in is attributed to a slot: the latest cron fire time at or before (scheduledAt ?? received time) + 60 s, in the monitor’s time zone. The 60 seconds cover jobs that report a moment before their scheduled time.
- Next run is the next cron fire time after the slot. Deadline is next run plus the grace period.
Example: 0 */12 * * * with 900 s grace. The midnight run reports at 00:07. Its slot is 00:00, the next run is due at 12:00, and if nothing arrives Alert51 opens a missed incident at 12:15.
Late, stale and changed reports
- Late reports are accepted. A success after the deadline resolves the open incident.
- A report with an earlier effective time than the latest applied one is recorded as stale. It shows in history but never changes the monitor state, the schedule or incidents.
- Sending a different cron, timezone or graceSeconds updates the schedule from that check-in. Leaving them out keeps the stored schedule.
- Daylight saving time is handled through IANA time zones, so the schedule follows local wall-clock time.
- A missed deadline opens one incident per outage, not one per missed slot. Check-ins to a paused monitor are recorded as paused.
Idempotency
Retrying a check-in after a timeout is safe when you send an Idempotency-Key header (up to 255 characters). Keys are remembered for 24 hours.
- Same key, same body: you get the original response with the header Idempotent-Replayed: true. Nothing is recorded twice.
- Same key, different body: 409 idempotency_key_reuse.
curl --fail-with-body --silent --show-error --max-time 10 \
-H "Authorization: Bearer $ALERT51_TOKEN" \
-H 'Content-Type: application/json' \
-H "Idempotency-Key: db-backup-$(date -u +%Y%m%dT%H)" \
-d '{"project":"production","job":"db-backup","status":"success"}' \
"$ALERT51_URL/v1/check-ins"Errors
Errors return JSON: { "error": { "code", "message", "details" }, "requestId" }. Branch on code; quote requestId when you contact support.
| Status | Code | What to do |
|---|---|---|
| 400 | validation_failed | A field is missing or malformed. details lists the fields. |
| 401 | unauthorized | Missing, malformed or revoked token. Check the Authorization header. |
| 403 | email_not_verified | Verify the account email address, then retry. |
| 403 | quota_exceeded | A plan limit was reached, such as active monitors or projects. Upgrade or remove unused ones. |
| 403 | plan_feature_unavailable | The feature is not part of your plan. |
| 404 | not_found | The project, monitor or resource does not exist for this account. |
| 409 | idempotency_key_reuse | The Idempotency-Key was already used with a different body. Use a new key. |
| 413 | — | The body is over 16 KB. Shorten the message. |
| 422 | cron_required | First check-in for this job: include cron. |
| 422 | invalid_cron | The cron expression is not a valid 5-field expression. |
| 422 | invalid_timezone | Use an IANA name such as Europe/Berlin. |
| 422 | scheduled_at_out_of_range | scheduledAt must be at most 5 minutes ahead and 7 days back. |
| 429 | rate_limited | Too many requests: the public API allows 3 per second per token. Wait the Retry-After seconds (also in error.details.retryAfterSeconds), then retry. |
Read endpoints
Use the same Bearer token to read monitoring state, for example from a status page or a deployment check. {project} and {job} are slugs.
- GET /v1/projects
- GET /v1/projects/{project}/monitors
- GET /v1/projects/{project}/monitors/{job}
- GET /v1/projects/{project}/check-ins?job&status&since&until&limit&cursor
- GET /v1/projects/{project}/incidents?job&status&since&until&limit&cursor
Lists are paginated with a cursor. limit defaults to 50, maximum 200. Pass nextCursor as cursor until it is null. since and until take ISO-8601 times.
{
"data": [
"…"
],
"nextCursor": "eyJpZCI6IjEyMyJ9"
}curl -sS -H "Authorization: Bearer $ALERT51_TOKEN" \
"$ALERT51_URL/v1/projects/production/monitors/db-backup"
curl -sS -H "Authorization: Bearer $ALERT51_TOKEN" \
"$ALERT51_URL/v1/projects/production/check-ins?job=db-backup&status=failure&limit=20"The full schema is in the OpenAPI spec.
Plan limits
A check-in that would create a monitor or project over your plan’s limit is rejected with 403 quota_exceeded; existing monitors keep working. See Pricing for prices.
| Limit | Free | Startup | Basic | Pro | Max |
|---|---|---|---|---|---|
| Active monitors | 3 | 15 | 50 | 250 | 500 |
| Projects | 1 | 3 | 7 | 10 | 30 |
| API tokens | 2 | 5 | 10 | 20 | 50 |
| Check-in history | 7 days | 30 days | 60 days | 90 days | 365 days |
| Alert channels | Email, Telegram | Email, Telegram, Webhook | Email, Telegram, Webhook | Email, Telegram, Webhook | Email, Telegram, Webhook |
| Webhook destinations | Not included | 2 | 4 | 10 | 30 |
Notifications
Alert51 notifies every enabled channel when an incident opens and when it resolves. Configure channels on the Notifications page.
- Email goes to your account address and is turned on when you verify it.
- Telegram: generate a link code, send /start CODE to the Alert51 bot, and the chat is linked.
- Webhooks (Startup and above) send signed JSON to an HTTPS endpoint.
Failed deliveries retry after 5 s, 30 s, 2 min and 10 min. After 5 attempts the delivery is marked failed and the error is shown in the dashboard. Use the Test button on a channel to check it end to end.
Scheduled reports send a daily or weekly summary of every job in scope (all jobs, chosen projects including jobs added later, or a list of jobs) to Email or Telegram, at a local time in your profile time zone (18:00 by default). Each job shows 🟢 OK, 🔴 Failed or Missed, or 🟡 Paused or No check-in yet, with failures that happened during the period. Long Telegram reports are split into numbered messages.
Webhook signatures
Each webhook is a POST with a JSON body and three headers:
- Alert51-Event-Id: unique event id. Delivery is at least once, so dedupe on it.
- Alert51-Timestamp: Unix time in seconds when the delivery was signed.
- Alert51-Signature: v1=<hex>, where hex is HMAC-SHA256 with the signing secret string (whsec_…) as key and ${timestamp}.${rawBody} as message.
Event types: incident.opened, incident.resolved and channel.test.
{
"id": "5d0f8f5e-8c1b-4f7e-a3a4-2f0b6c9e1d77",
"type": "incident.opened",
"createdAt": "2026-11-23T09:15:04.000Z",
"data": {
"incident": {
"id": "9e2b7a10-4d3c-4b8e-b1f6-6a5d0c3e2f19",
"cause": "missed",
"status": "open",
"openedAt": "2026-11-23T09:15:04.000Z",
"resolvedAt": null,
"slotAt": "2026-11-23T09:00:00.000Z"
},
"monitor": {
"id": "0b7f3c52-6f1e-4c55-9a1d-3b8c2e9d4f10",
"name": "db-backup",
"job": "db-backup",
"project": "production",
"projectName": "Production",
"cron": "0 */12 * * *",
"timezone": "Europe/Moscow"
},
"checkIn": null,
"dashboardUrl": "https://alert51.com/app/incidents/9e2b7a10-4d3c-4b8e-b1f6-6a5d0c3e2f19"
}
}Verifying
- Compute the HMAC over the raw body bytes, before any JSON parsing, and compare in constant time.
- Reject timestamps older than 5 minutes.
- Respond with 2xx within 10 seconds; do slow work in the background.
- Redirects are not followed, and only HTTPS endpoints on public addresses are accepted.
- If the secret leaks, rotate it from the dashboard and update your receiver.
import { createHmac, timingSafeEqual } from 'node:crypto';
import express from 'express';
const signingSecret = process.env.ALERT51_WEBHOOK_SECRET;
const toleranceSeconds = 300;
const app = express();
function isValidSignature(timestamp, rawBody, header) {
const expected = createHmac('sha256', signingSecret).update(`${timestamp}.${rawBody}`).digest();
const received = Buffer.from(header.startsWith('v1=') ? header.slice(3) : '', 'hex');
return received.length === expected.length && timingSafeEqual(received, expected);
}
app.post('/hooks/alert51', express.raw({ type: 'application/json', limit: '256kb' }), async (req, res) => {
const eventId = req.get('Alert51-Event-Id');
const timestamp = req.get('Alert51-Timestamp') ?? '';
const signature = req.get('Alert51-Signature') ?? '';
const rawBody = req.body.toString('utf8');
const age = Math.abs(Date.now() / 1000 - Number(timestamp));
if (!Number.isFinite(age) || age > toleranceSeconds) return res.status(400).send('Timestamp outside tolerance');
if (!isValidSignature(timestamp, rawBody, signature)) return res.status(401).send('Invalid signature');
if (await alreadyProcessed(eventId)) return res.sendStatus(200);
const event = JSON.parse(rawBody);
await enqueue(event);
res.sendStatus(204);
});Examples
Report a failure
After the first check-in the schedule is stored, so later requests can omit cron.
curl --fail-with-body --silent --show-error --max-time 10 \
-H "Authorization: Bearer $ALERT51_TOKEN" \
-H 'Content-Type: application/json' \
-d '{
"project": "production",
"job": "db-backup",
"status": "failure",
"message": "pg_dump: connection refused",
"durationMs": 4210
}' \
"$ALERT51_URL/v1/check-ins"crontab
Reports success or failure based on the script’s exit code.
SHELL=/bin/bash
ALERT51_URL=https://api.alert51.com
ALERT51_TOKEN=a51_xxxxxxxx_your-secret
0 */12 * * * if /opt/scripts/backup.sh; then s=success; else s=failure; fi; curl -fsS --max-time 10 -H "Authorization: Bearer $ALERT51_TOKEN" -H 'Content-Type: application/json' -d "{\"project\":\"production\",\"job\":\"db-backup\",\"status\":\"$s\",\"cron\":\"0 */12 * * *\",\"timezone\":\"Europe/Moscow\",\"graceSeconds\":900}" "$ALERT51_URL/v1/check-ins"NestJS
A scheduled service with @nestjs/schedule that reports each run, including failures, without letting reporting errors break the job.
import { Injectable, Logger } from '@nestjs/common';
import { Cron } from '@nestjs/schedule';
type TCheckInStatus = 'success' | 'failure';
@Injectable()
export class DatabaseBackupJob {
private readonly logger = new Logger(DatabaseBackupJob.name);
@Cron('0 */12 * * *', { timeZone: 'Europe/Moscow' })
public async run(): Promise<void> {
const startedAt = Date.now();
try {
await this.backup();
await this.report('success', startedAt);
} catch (error) {
await this.report('failure', startedAt, error instanceof Error ? error.message : String(error));
throw error;
}
}
private async backup(): Promise<void> {
await Promise.resolve();
}
private async report(status: TCheckInStatus, startedAt: number, message?: string): Promise<void> {
try {
const response = await fetch(`${process.env.ALERT51_URL}/v1/check-ins`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.ALERT51_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
project: 'production',
job: 'db-backup',
status,
cron: '0 */12 * * *',
timezone: 'Europe/Moscow',
graceSeconds: 900,
durationMs: Date.now() - startedAt,
message: message?.slice(0, 1000),
}),
signal: AbortSignal.timeout(10_000),
});
if (!response.ok) this.logger.warn(`Alert51 check-in rejected: ${response.status} ${await response.text()}`);
} catch (error) {
this.logger.warn(`Alert51 check-in failed: ${String(error)}`);
}
}
}Node.js fetch
A standalone worker script that reports success or failure with the built-in fetch. Reporting errors are logged and never fail the job; a job failure sets a non-zero exit code. Schedule: runs every 15 minutes: */15 * * * *.
import { syncInvoices } from './jobs/sync-invoices.mjs';
const startedAt = Date.now();
async function checkIn(status, message) {
try {
const response = await fetch(`${process.env.ALERT51_URL}/v1/check-ins`, {
method: 'POST',
headers: {
Authorization: `Bearer ${process.env.ALERT51_TOKEN}`,
'Content-Type': 'application/json',
},
body: JSON.stringify({
project: 'production',
job: 'invoice-sync',
status,
cron: '*/15 * * * *',
timezone: 'UTC',
graceSeconds: 300,
durationMs: Date.now() - startedAt,
message: message?.slice(0, 1000),
}),
signal: AbortSignal.timeout(10_000),
});
if (!response.ok) console.error(`Alert51 check-in rejected: ${response.status} ${await response.text()}`);
} catch (error) {
console.error(`Alert51 check-in failed: ${error}`);
}
}
try {
await syncInvoices();
await checkIn('success');
} catch (error) {
await checkIn('failure', error instanceof Error ? error.message : String(error));
process.exitCode = 1;
}GitLab CI
after_script runs even when the job fails, and CI_JOB_STATUS tells which way it went. The job keeps its own exit status. Set the cron in the check-in to the pipeline schedule: pipeline schedule: 30 2 * * * (UTC).
nightly-e2e:
image: node:22
rules:
- if: $CI_PIPELINE_SOURCE == "schedule"
script:
- npm ci
- npm run test:e2e
after_script:
- |
if [ "$CI_JOB_STATUS" = "success" ]; then STATUS=success; else STATUS=failure; fi
curl --fail-with-body --silent --show-error --max-time 10 \
-H "Authorization: Bearer $ALERT51_TOKEN" \
-H 'Content-Type: application/json' \
-d "{\"project\":\"production\",\"job\":\"nightly-e2e\",\"status\":\"$STATUS\",\"cron\":\"30 2 * * *\",\"timezone\":\"UTC\",\"graceSeconds\":3600,\"message\":\"$CI_PIPELINE_URL\"}" \
"$ALERT51_URL/v1/check-ins" || trueBackup script
Reports the pg_dump result either way and exits with the backup status. Walkthrough: backup job monitoring.
#!/bin/sh
set -u
started=$(date +%s)
if pg_dump --format=custom --file=/var/backups/app.dump "$DATABASE_URL"; then
status=success
else
status=failure
fi
duration_ms=$(( ($(date +%s) - started) * 1000 ))
curl --fail-with-body --silent --show-error --max-time 10 \
-H "Authorization: Bearer $ALERT51_TOKEN" \
-H 'Content-Type: application/json' \
-d "{\"project\":\"production\",\"job\":\"db-backup\",\"status\":\"$status\",\"cron\":\"0 3 * * *\",\"timezone\":\"UTC\",\"graceSeconds\":1800,\"durationMs\":$duration_ms}" \
"$ALERT51_URL/v1/check-ins"
[ "$status" = success ]