UptimeTea

API Documentation

The UptimeTea API is easy to use and free for all plans.

Update watcher

Changes a watcher and runs a fresh check. Only the fields you send change; they follow the same rules as in Create watcher.

PATCH https://api.uptimetea.com/watchers/:id

Headers

  • AuthorizationREQUIREDSTRING
    Bearer $TOKEN
  • Content-TypeREQUIREDSTRING
    application/json

Body parameters

  • titleSTRING

    Display name.

  • categorySTRING

    website and server check an http(s) URL; redirect checks a URL redirects where you expect; ssl_certificate and domain_expiration warn before the certificate or domain expires; blacklist checks a domain or IPv4 address against DNS blacklists; ping checks a host answers; port checks a TCP or UDP port; cron_job and heartbeat wait for your jobs to call their callback_url; rum measures real visitors through a script on your site.

  • urlSTRING

    Required except for cron_job and heartbeat. An http(s) URL for website, server, redirect, rum, ssl_certificate and domain_expiration; a domain or IPv4 address for blacklist; a host or IP for ping and port.

  • check_intervalINTEGER

    Seconds between checks: 60, 300, 1800, 14400, 43200, 86400 or 604800. Defaults to 60, or 86400 for ssl_certificate, domain_expiration and blacklist. blacklist allows 86400 or more only.

  • tagsARRAY

    Labels for filtering, such as ["production"].

  • notify_emailBOOLEAN

    Email alerts. Defaults to your alert preferences.

  • notify_smsBOOLEAN

    SMS alerts. Defaults to your alert preferences.

  • notify_callBOOLEAN

    Phone call alerts. Defaults to your alert preferences.

  • on_call_schedule_idSTRING

    Alert whoever is on call for this schedule.

  • escalation_policy_idSTRING

    Escalate unacknowledged incidents with this policy.

  • sla_targetSTRING

    Uptime target over 30 days: 99.0, 99.9 or 99.99. Not for cron_job, heartbeat or rum. sla_breached turns true when uptime drops below it.

  • expected_contentSTRING

    website and server only. Text the response body must contain, up to 1000 characters; a 2xx without it fails the check.

  • content_case_sensitiveBOOLEAN

    website and server only. Match expected_content case-sensitively. Defaults to false.

  • content_regexBOOLEAN

    website and server only. Treat expected_content as a regular expression. Defaults to false.

  • ssl_warning_thresholdINTEGER

    ssl_certificate only. Days before expiry to warn: 7, 14 or 30.

  • domain_warning_thresholdINTEGER

    domain_expiration only. Days before expiry to warn: 30 or 60.

  • expected_intervalINTEGER

    cron_job and heartbeat only, and required for them. Minutes between expected callbacks before the watcher goes down.

  • expected_redirect_codeINTEGER

    redirect only, and required for it. 301, 302, 307 or 308.

  • expected_redirect_urlSTRING

    redirect only, and required for it. http(s) URL the redirect must point to.

  • portINTEGER

    port only, and required for it. 1 to 65535.

  • protocolSTRING

    port only. tcp or udp. Defaults to tcp.

Response body

{
  "id": "uuid",
  "title": "Marketing site",
  "category": "website",
  "url": "https://example.com",
  "status": "success",
  "tags": ["production", "marketing"],
  "last_checked_at": "2024-01-15T10:30:00Z",
  "uptime_percentage": 99.5,
  "consecutive_failures": 0,
  "check_interval": 60,
  "notify_email": true,
  "notify_sms": false,
  "notify_call": false,
  "on_call_schedule_id": null,
  "escalation_policy_id": null,
  "in_maintenance": false,
  "created_at": "2024-01-01T00:00:00Z",
  "updated_at": "2024-01-15T10:30:00Z",
  "expected_content": "Welcome",
  "content_case_sensitive": false,
  "content_regex": false,
  "sla_target": 99.9,
  "sla_breached": false
}

Response fields

  • statusSTRING

    pending until the first check, then success, warning or error.

  • uptime_percentageNUMBER

    Share of successful checks over the last 24 hours; null before the first check.

  • in_maintenanceBOOLEAN

    true while a maintenance window covers the watcher.

  • sla_target, sla_breached

    Not on cron_job, heartbeat or rum watchers. The 30-day uptime target and whether uptime is below it.

  • expected_content, content_case_sensitive, content_regex

    Only on website and server watchers. The response body check.

  • ssl_warning_threshold, ssl_cert_expiry_date, ssl_cert_issuer, ssl_cert_common_name, ssl_days_until_expiry

    Only on ssl_certificate watchers. The certificate found on the last check.

  • domain_warning_threshold, domain_expiry_date, domain_registrar, domain_days_until_expiry

    Only on domain_expiration watchers. The registration found on the last check.

  • callback_url, callback_token, expected_interval, last_callback_at, recent_callbacks

    Only on cron_job and heartbeat watchers. POST to callback_url from your job; recent_callbacks lists the last 20 calls.

  • expected_redirect_code, expected_redirect_url

    Only on redirect watchers. The redirect the check expects.

  • callback_token, rum_script_url

    Only on rum watchers. Load rum_script_url on your pages with the token to report visits.

  • blacklist_results

    Only on blacklist watchers. Results of the last blacklist lookup.

  • port, protocol

    Only on port watchers. The port and protocol checked.

Code examples

curl -X PATCH "https://api.uptimetea.com/watchers/$WATCHER_ID" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "title": "Marketing site",
    "check_interval": 60,
    "tags": ["production", "marketing"]
  }'
// Update watcher
const response = await fetch('https://api.uptimetea.com/watchers/WATCHER_ID', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer ' + yourToken,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "title": "Marketing site",
    "check_interval": 60,
    "tags": ["production", "marketing"]
  })
});

const data = await response.json();
console.log(data);
# Update watcher
import requests

headers = {'Authorization': f'Bearer {your_token}'}

response = requests.patch(
    'https://api.uptimetea.com/watchers/WATCHER_ID',
    headers=headers,
    json={
        'title': 'Marketing site',
        'check_interval': 60,
        'tags': ['production', 'marketing']
    }
)

print(response.json())
// Update watcher
package main

import (
    "fmt"
    "io"
    "net/http"
    "strings"
)

func main() {
    body := strings.NewReader(`{
      "title": "Marketing site",
      "check_interval": 60,
      "tags": ["production", "marketing"]
    }`)
    req, _ := http.NewRequest("PATCH", "https://api.uptimetea.com/watchers/WATCHER_ID", body)
    req.Header.Set("Authorization", "Bearer "+yourToken)
    req.Header.Set("Content-Type", "application/json")

    resp, err := http.DefaultClient.Do(req)
    if err != nil {
        panic(err)
    }
    defer resp.Body.Close()

    data, _ := io.ReadAll(resp.Body)
    fmt.Println(resp.Status, string(data))
}
# Update watcher
require 'net/http'
require 'uri'

uri = URI('https://api.uptimetea.com/watchers/WATCHER_ID')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true

request = Net::HTTP::Patch.new(uri)
request['Authorization'] = "Bearer #{your_token}"
request['Content-Type'] = 'application/json'
request.body = <<~JSON
  {
    "title": "Marketing site",
    "check_interval": 60,
    "tags": ["production", "marketing"]
  }
JSON

response = http.request(request)
puts response.code, response.body
<?php
// Update watcher
$ch = curl_init('https://api.uptimetea.com/watchers/WATCHER_ID');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'PATCH');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    'Authorization: Bearer ' . $yourToken,
    'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, <<<'JSON'
{
  "title": "Marketing site",
  "check_interval": 60,
  "tags": ["production", "marketing"]
}
JSON);

$response = curl_exec($ch);
print_r(json_decode($response, true));
curl_close($ch);