Skip to content

Uptime from the API

The API gives the same uptime figure as a Monitor’s Uptime card, worked out the same way. It also gives what the figure leaves out, so your own page can say it too. The uptime percentage explains the figure itself.

This answers the figure over the last 24 hours, 7 days, 30 days and 90 days:

Terminal window
curl -H "Authorization: Bearer $UUP_API_TOKEN" \
"https://api.uup.dev/v1/projects/prj_01J9Z3K8X4M2N6P8Q0R2S4T6V8/monitors/mon_01J9Z3K8X4M2N6P8Q0R2S4T6V8/uptime"

Each window in windows reads like this one:

{
"window": "30d",
"asOf": "2026-11-01T09:00:00.000Z",
"percentage": 0.9995118549511854,
"coveredSeconds": 2581200,
"incidentSeconds": 1260,
"notMeasuredSeconds": 10800,
"notMeasuredHours": 3
}
  • percentage is the share of the time we were watching that the target was up, from 0 to 1, unrounded. It is null when nothing was measured in the window.
  • coveredSeconds is the time we were watching and could measure: the figure is worked out over it.
  • incidentSeconds is the part of it inside an Incident: the time it was down.
  • notMeasuredHours counts the hours we could not measure, and notMeasuredSeconds gives them in seconds. They are left out of both sides of the figure: neither up nor down.

Time the Monitor was paused, Suspended or not created yet is on neither side either. A window we watched for only a short time has a figure over that short time, so coveredSeconds says how much the figure stands on.

The dashboard shows the figure above as 99.95%, with 3 hours not measured beside it. To show it the same way:

  1. Two decimals, rounded half up. Multiply percentage by 100.
  2. Never 100 while there was downtime. While incidentSeconds is above 0, show at most 99.99: 20 seconds down in 30 days prints as 99.99%, and not 100%.
  3. A dash when there is nothing. When percentage is null, show “—”, never 0 or 100.
  4. The hours not measured beside it. When notMeasuredHours is above 0, say so next to the figure, as the card does with 3 h not measured. The figure leaves them out, so a reader who sees only the figure would take them for good hours.

This answers each day of the last week, cut at midnight in the Project’s timezone, oldest first. Ask for up to 90 days with days:

Terminal window
curl -H "Authorization: Bearer $UUP_API_TOKEN" \
"https://api.uup.dev/v1/projects/prj_01J9Z3K8X4M2N6P8Q0R2S4T6V8/monitors/mon_01J9Z3K8X4M2N6P8Q0R2S4T6V8/uptime/days?days=7"

Each day has its own percentage, worked out over measuredSeconds, with notMeasuredSeconds and notMeasuredHours beside it, and notCoveredSeconds, the time we were not watching, by why: paused, suspended, not_yet_monitored or deleted. Its incidents are the Incidents that touched it.

The bar under the Uptime card colours each day in this order:

  • Down when incidentSeconds is above 0, however little of the day was measured.
  • Up when it was measured for at least 50% of the day so far.
  • Grey otherwise, with the reason the day was not watched, or the hours not measured.

This answers each Monitor’s figure over the last 30 days, with its days, a page at a time:

Terminal window
curl -H "Authorization: Bearer $UUP_API_TOKEN" \
"https://api.uup.dev/v1/projects/prj_01J9Z3K8X4M2N6P8Q0R2S4T6V8/uptime"