Skip to content

Run it

Heartbeat jobs

On this page

Add a scheduled job from the console

Open Monitors › New monitor › Fill in the form yourself. Under What to check, choose Scheduled job (heartbeat). Enter a name, the expected interval in seconds (30 seconds to 31 days) and a grace period in seconds (zero to 24 hours), then choose Save monitor.

The monitor page shows Connect your job, with this installation's real Check-in URL and a Copy command button. Add the curl -fsS line after the successful end of your job. Save the URL privately before leaving the page: it is shown only for that visit and stored hashed on the server. After reloading, choose Create or replace check-in URL… to issue another; the previous URL and key stop working immediately. Anyone holding this replay-unprotected URL can send repeated check-ins.

A successful check-in is read by the next scheduled evaluation and marks the monitor Healthy (up). If the interval plus grace passes with no success, scheduled evaluation marks it Failing (down); a later success recovers it. Until the first success and before its deadline it stays Unknown. Keep the private runner running: receipts alone do not change health. Console-created jobs use one scheduled result to confirm failure or recovery and follow the installation's existing runner and external-check settings.

Open the monitor's Heartbeat › Job schedule and runs panel for cron schedules, a maximum run duration and run history. The existing one-time key dialog also offers protected header commands and scheduler wrappers.

API and definitions alternatives

A heartbeat job reports its start, success or failure to Uptime. Use either the sequence-protected header key or the separately issued, replay-unprotected URL capability. GET, HEAD and POST work with both forms. The key is shown once and stored hashed. Receipts request evaluation; only a signed scheduled result can confirm an incident or recovery.

You can also create a heartbeat through the monitor API or a definitions file. Its heartbeat configuration accepts:

JSON
{"maxAgeMs":86400000,"graceMs":900000,"maxRunDurationMs":1800000,"outputMasks":["customer-private-phrase"]}

maxAgeMs is the expected period between successes, up to 31 days. Existing five-second periods remain accepted; use at least 30 seconds for ordinary jobs. Grace is added explicitly, from zero to 24 hours. The first deadline starts at the current revision's creation; each success starts a new period. A start never extends that deadline. Before the first deadline, absent success is Unknown; at the deadline it becomes missed evidence. A maximum run duration of zero disables the running-too-long check. A second start before a finish returns 409; this header form supports one active run per monitor.

An owner can save these settings at POST /api/monitors/MONITOR_ID/heartbeat-settings with the JSON above. Saving creates an immutable revision and retires the old key; issue a new key afterward. The attached Job schedule and runs panel uses this same configuration door. Failure and recovery still follow the monitor's configured scheduled confirmation thresholds and independent-vantage/external-check coverage. For the first confirming evaluation to open an incident, configure confirmation and recovery to one. An unavailable private runner or external check cannot establish Healthy or a confirmed outage. Hosted scheduling latency and the scale and alert-timing limits are not established by this implementation.

Set the receipt URL and key privately, then send POST requests. The sequence-protected key belongs in a header. The separately issued URL capability carries its own authority in its path. Replace the example URL and monitor ID. Each request needs a sequence greater than every earlier accepted request for this key.

Shell
export UPTIME_HEARTBEAT_URL='https://your-uptime.example/api/heartbeats/MONITOR_ID'
# Set UPTIME_HEARTBEAT_TOKEN privately from the one-time key dialog.
curl --fail --silent --show-error --request POST "$UPTIME_HEARTBEAT_URL/start" \
  --header 'Content-Type: application/json' \
  --header "Authorization: Bearer $UPTIME_HEARTBEAT_TOKEN" \
  --header 'X-Heartbeat-Sequence: 1' --data '{}'
curl --fail --silent --show-error --request POST "$UPTIME_HEARTBEAT_URL/success" \
  --header 'Content-Type: application/json' \
  --header "Authorization: Bearer $UPTIME_HEARTBEAT_TOKEN" \
  --header 'X-Heartbeat-Sequence: 2' --data '{}'
curl --fail --silent --show-error --request POST "$UPTIME_HEARTBEAT_URL/fail/3" \
  --header 'Content-Type: application/json' \
  --header "Authorization: Bearer $UPTIME_HEARTBEAT_TOKEN" \
  --header 'X-Heartbeat-Sequence: 3' --data '{"output":"Backup command exited before writing its final archive"}'

The original POST /api/heartbeats/MONITOR_ID remains a success receipt. /fail accepts an unspecified exit code; /fail/0 through /fail/255 retain the supplied code. A failure atomically makes scheduled evaluation due immediately, without changing health at ingress. A completed start/success or start/fail pair retains server-time duration. A success after its deadline or maximum run duration is labelled a late run. Trigger and recovery notices retain the evaluated cause, original cause, confirmed times and downtime; notice times remain UTC.

Failure JSON takes only an output string. The whole request body is limited to 10 KiB, and at most 1 KiB of the sanitized output is retained. Owner literal masks, the current heartbeat key, authorization values, credential-like assignments, common API/JWT tokens, private keys and URL passwords are masked before storage. Control characters and ANSI escapes are removed. Set masks before running a job; changes do not rewrite immutable history. Do not send a complete log or rely on pattern matching to recognize arbitrary private data. A bounded excerpt accompanies failure evidence and notices.

For a real Bash command, use the supplied wrapper from the checkout root. It requires Bash, curl and Node 22 or later (or rer on your PATH, which brings its own Node). Use a fresh private absolute state directory for each monitor/key, and only one host writing that directory:

Shell
export UPTIME_HEARTBEAT_STATE="$PWD/data/backup-heartbeat"
bash scripts/heartbeat/run-job.sh bash -c 'your-backup-command --your-option'

The wrapper sends start, runs the command, and sends success or failure with its exit code. It drains command output, retaining a bounded failure excerpt rather than printing the output. It persists the next sequence before each send and holds a directory lock across the command. It does not retry an uncertain send: a failed start prevents command execution; a failed finish is reported locally. Failure preserves the job's exit code; successful jobs whose success receipt failed return 69. After key rotation, use a new state directory. After a killed wrapper leaves run.lock, verify that no job is active before removing that lock. A missing finish remains visible as a missed/overlong run.

GET /api/monitors/MONITOR_ID/heartbeat-runs returns immutable receipt history in pages of 50, with a nextCursor for ?before=CURSOR. Completed durations also appear as jobRuns in the monitor period report's JSON and job_run rows in its CSV. Reports refuse more than 10,000 receipts instead of truncating. These records travel in archives and are counted and removed by monitor erasure. Restored monitors remain paused, and run history never restores token, sequence, active-run or scheduled claim authority.

Choose Cron in a time zone for a five-field numeric cron expression, such as 0 2 * * * in America/New_York, with a 900-second grace. Numeric lists, ranges and steps are supported. Day-of-month and day-of-week use conventional cron OR semantics when both are restricted. Nonexistent spring local times are skipped, and repeated fall times use only their first occurrence. A success before the expected time does not cover the upcoming run; one during grace does. Load run history to see the next three expected times and deadlines in the saved zone. Before that deadline, missing success stays Unknown. The signed evaluation due at the deadline supplies failure evidence; receipts alone never change health.

Issuing a key also shows a separate capability URL once. Its hash is stored alongside revision authority; rotation or a settings revision retires it immediately. Anyone with that URL can send receipts repeatedly: this form is explicitly replay-unprotected. It shares the monitor's durable ingress limit with the protected form. Keep it out of logs, source repositories, public scheduler configuration and screenshots. Archives carry neither form of authority. POST failure accepts bounded plain text or the documented JSON output object.

The one-time dialog offers executable sample wrappers for curl, wget, Bash, crontab, systemd, Kubernetes CronJob, GitHub Actions, PowerShell and Windows Task Scheduler. The sample command succeeds without doing work; replace it with the actual job. All wrappers report start and success/failure while preserving the job exit code. Cron and Kubernetes receive the saved expression and zone. systemd, GitHub Actions and Windows examples explicitly require schedule alignment rather than guessing a cron conversion; GitHub uses UTC and Windows uses the host zone. These examples do not promise the host scheduler's punctuality or its DST behavior. The sequence-protected Bash wrapper above remains available for jobs needing replay protection.

Saved UptimeRobot period/grace settings now remain separate, without shortening grace to fit the old one-day bound. Saved Better Stack heartbeat pages import documented period and grace through Definitions. They arrive paused with a fresh local URL required. Calendar/source fields outside that mapping are named for review. Pingdom's documented check-detail API has no established heartbeat period/grace schema; that source mapping remains unimplemented. Hosted scheduling timing and execution on native Windows/systemd/Kubernetes/GitHub scheduler hosts remain unmeasured.