Health

This doesn't belong to any resource. It's for whatever is watching your instance.

Check server health

Reports whether the API is up and whether it can reach its database. This is what you point an uptime monitor at.

In the app: Nothing in the app calls this. It's for monitoring, container health checks, and load balancer probes.

GET /api/health
HEAD /api/health

Auth: None. This is the only endpoint that skips authentication entirely, and it also sits outside monetr's normal request handling, so it doesn't open a database transaction or get traced. HEAD exists so uptime checkers that use it don't fill your logs with errors.

Example

curl --request GET \
  --url "https://my.monetr.local/api/health"
{
  "dbHealthy": true,
  "apiHealthy": true,
  "revision": "e3efd6c4b1a9f0d7c82b4e5a6f3d1c9b8a7e6f5d",
  "buildTime": "2024-08-27T04:11:52Z",
  "serverTime": "2024-08-29T18:22:07.441Z",
  "release": "v0.19.4"
}

Response attributes

AttributeTypeDescription
dbHealthybooleanWhether monetr could ping PostgreSQL just now. This is the field that actually tells you something.
apiHealthybooleanAlways true. If the API weren't healthy you wouldn't be getting a response at all.
releasestring, nullableThe release version. Null on builds made outside the release process, like local ones.
revisionstringThe git commit the running binary was built from.
buildTimestringWhen the running binary was built.
serverTimetimestampThe server's current time in UTC. Handy for spotting clock drift, which matters here because TOTP and recurrence rules both care about time.

Watch the status code, not only the body. When the database ping fails you get a 500, with dbHealthy set to false. A monitor checking only for 200 will catch that, but one parsing the body should check both.