Skip to content
Docs

Heartbeat endpoints

The check-in URLs a job calls to report success, failure, or a start, and what they return.

A heartbeat monitor expects your job to call its URL on a schedule. If the call doesn't arrive in time, or the job reports a failure, you get a push. To create a heartbeat and choose its schedule, see Heartbeats.

Endpoints

PathSignalEffect
/hb/{check_id}SuccessRecords a check-in. If the heartbeat was late or failing, you get a Back to normal push.
/hb/{check_id}/failFailureYou get a push right away.
/hb/{check_id}/startStartMarks the start of a run. The next success records how long the run took.
  • Methods: GET, POST, and HEAD all work.
  • No authentication. The check ID (22 letters and digits) is the secret. You find the full URL on the heartbeat's page in the app or web console.
  • With POST, the first 1,000 characters of the body are saved as a message. For /fail, it shows up in the push. Send it as plain text.
# Success
curl -fsS -m 10 --retry 3 https://opu.sh/hb/CHECK_ID

# Start
curl -fsS -m 10 --retry 3 https://opu.sh/hb/CHECK_ID/start

# Failure with a message
curl -fsS -m 10 --retry 3 --data-binary "pg_dump: connection refused" https://opu.sh/hb/CHECK_ID/fail

Responses

StatusBodyWhen
200ok (plain text)The check-in was recorded
404not found (plain text)Unknown check ID, a deleted heartbeat, or an unknown signal after the ID
503busy, try again (plain text)Rare: many check-ins for the same heartbeat arrived at once. Retry

The response doesn't say whether the heartbeat is up or late. It only confirms the check-in. Use -f with curl so a 404 makes your script fail loudly.

How signals change the state

Current stateSignalNew statePush
New (never checked in)successUpNone
UpsuccessUpNone
New or upfailFailingReported a failure, with your message
Late or failingfailNo changeNone
Late or failingsuccessUpBack to normal, with how long it was down
Upnone before the deadlineLateNo check-in
  • A heartbeat starts watching after its first check-in. It never alerts before that.
  • The deadline is the last check-in plus the interval and the grace period. With a cron schedule, it's the next scheduled time after the last check-in, plus the grace period.
  • Pushes only go out when the state changes. While a job stays late, you don't get more pushes.
  • start doesn't change the state. It only starts the timer for the next success.

Tips

  • Call the URL at the very end of the job, after the work succeeded. For example: backup.sh && curl -fsS https://opu.sh/hb/CHECK_ID.
  • Add a timeout and retries (-m 10 --retry 3) so a slow network doesn't hang your job.
  • Report failures with /fail instead of staying silent. You hear about them right away, without waiting for the deadline.
  • Keep the URL in a secret store, like a CI secret. Anyone who has it can check in for your job.

More examples for crontab, GitHub Actions, and systemd are in Heartbeats.