Docs

Monitor uptime

GET /api/v1/monitors/{id}/uptime

Availability of one monitor in a period: the same number as in the app and in client reports.

Parameters

Parameter Meaning
from, to The period. Without them, the last 30 days.

Example

September in the client's time zone (Central European Summer Time, +02:00):

cURL

curl -G http://pulsekeeper.io/api/v1/monitors/a81c27e05f3d9b64/uptime \
  -H "Authorization: Bearer $PULSEKEEPER_TOKEN" \
  --data-urlencode "from=2026-09-01T00:00:00+02:00" \
  --data-urlencode "to=2026-10-01T00:00:00+02:00"

PHP

<?php

// composer require guzzlehttp/guzzle
$client = new GuzzleHttp\Client([
    'base_uri' => 'http://pulsekeeper.io/api/v1/',
    'headers' => ['Authorization' => 'Bearer '.getenv('PULSEKEEPER_TOKEN')],
]);

$timezone = new DateTimeZone('Europe/Ljubljana');
$from = new DateTimeImmutable('first day of last month midnight', $timezone);

$uptime = json_decode($client->get('monitors/a81c27e05f3d9b64/uptime', ['query' => [
    'from' => $from->format(DATE_ATOM),
    'to' => $from->modify('+1 month')->format(DATE_ATOM),
]])->getBody(), true)['data'];

JavaScript

const query = new URLSearchParams({
  from: '2026-09-01T00:00:00+02:00',
  to: '2026-10-01T00:00:00+02:00',
});

const response = await fetch(`http://pulsekeeper.io/api/v1/monitors/a81c27e05f3d9b64/uptime?${query}`, {
  headers: { Authorization: `Bearer ${process.env.PULSEKEEPER_TOKEN}` },
});

const { data: uptime } = await response.json();

Go

loc, _ := time.LoadLocation("Europe/Ljubljana")
from := time.Date(2026, time.September, 1, 0, 0, 0, 0, loc)

query := url.Values{}
query.Set("from", from.Format(time.RFC3339))
query.Set("to", from.AddDate(0, 1, 0).Format(time.RFC3339))

req, _ := http.NewRequest("GET", "http://pulsekeeper.io/api/v1/monitors/a81c27e05f3d9b64/uptime?"+query.Encode(), nil)
req.Header.Set("Authorization", "Bearer "+os.Getenv("PULSEKEEPER_TOKEN"))

res, err := http.DefaultClient.Do(req)
if err != nil {
	log.Fatal(err)
}
defer res.Body.Close()

Response

{
  "data": {
    "monitor": "a81c27e05f3d9b64",
    "from": "2026-08-31T22:00:00Z",
    "to": "2026-09-30T22:00:00Z",
    "uptime": 99.961,
    "downtime_seconds": 1012,
    "observed_seconds": 2592000
  }
}

What counts

  • uptime is a percentage with three decimals: time without a confirmed outage, divided by the time we watched. A failed check from one location that nobody confirmed does not lower it.
  • Outages count from confirmed_at to resolved_at of each incident. Incidents during a maintenance window do not count.
  • Time before the first successful check is counted neither for nor against, so a monitor added mid-month is measured from that day: observed_seconds is then shorter than the period.
  • A monitor that has never answered has no uptime: uptime, downtime_seconds and observed_seconds are null, never 0.