Oh Dear
Docs/API

Uptime

The uptime endpoints let you query historical uptime percentages and downtime periods for any monitor with the uptime check enabled.

You'll need a monitor ID for these endpoints.

Example request:

$ OHDEAR_TOKEN="your API token"
$ curl "https://ohdear.app/api/monitors/1/uptime?filter[started_at]=20180101000000&filter[ended_at]=20180101235959&split=hour" \
    -H "Authorization: Bearer $OHDEAR_TOKEN" \
    -H 'Accept: application/json' \
    -H 'Content-Type: application/json'

All endpoints below follow the same authentication pattern.

Get uptime percentages #

GET /api/monitors/{monitorId}/uptime

Returns uptime percentages for a monitor over a given period, split into intervals.

Query parameters:

  • filter[started_at] (string, required) -- start of the period in YmdHis format, in UTC (e.g., 20180101000000)
  • filter[ended_at] (string, required) -- end of the period in YmdHis format, in UTC
  • split (string, required) -- how to group the results. Possible values: hour, day, month

All timestamps in the response are in UTC. Here's what the response looks like:

[
  {"datetime": "2018-01-01 00:00:00", "uptime_percentage": 100},
  {"datetime": "2018-01-01 01:00:00", "uptime_percentage": 99.76},
  {"datetime": "2018-01-01 02:00:00", "uptime_percentage": 100},
  {"datetime": "2018-01-01 03:00:00", "uptime_percentage": 98.34},
  "..."
]

Get downtime periods #

GET /api/monitors/{monitorId}/downtime

Returns a list of downtime periods for a monitor.

Query parameters:

  • filter[started_at] (string, required) -- start of the period in YmdHis format, in UTC
  • filter[ended_at] (string, required) -- end of the period in YmdHis format, in UTC

All timestamps in the response are in UTC. Here's what the response looks like:

{
  "data": [
    {
      "id": 1,
      "started_at": "2018-01-01 15:00:00",
      "ended_at": "2018-01-01 15:07:00",
      "notes_html": "We contacted our provider and they fixed the issue.",
      "notes_markdown": "We contacted our provider and they fixed the issue."
    }
  ]
}

Delete a downtime period #

DELETE /api/downtime/{downtimeId}

Deletes a specific downtime period. You can find the downtime id from the downtime endpoint above.

Returns 204 No Content on success.

Was this page helpful?

Feel free to reach out via support@ohdear.app or on X via @OhDearApp if you have any other questions. We'd love to help!