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.
https://api.uptimetea.com/watchers/:id
Headers
-
AuthorizationREQUIREDSTRINGBearer $TOKEN -
Content-TypeREQUIREDSTRINGapplication/json
Body parameters
-
titleSTRINGDisplay name.
-
categorySTRINGwebsite 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.
-
urlSTRINGRequired 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_intervalINTEGERSeconds 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.
-
tagsARRAYLabels for filtering, such as ["production"].
-
notify_emailBOOLEANEmail alerts. Defaults to your alert preferences.
-
notify_smsBOOLEANSMS alerts. Defaults to your alert preferences.
-
notify_callBOOLEANPhone call alerts. Defaults to your alert preferences.
-
on_call_schedule_idSTRINGAlert whoever is on call for this schedule.
-
escalation_policy_idSTRINGEscalate unacknowledged incidents with this policy.
-
sla_targetSTRINGUptime 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_contentSTRINGwebsite and server only. Text the response body must contain, up to 1000 characters; a 2xx without it fails the check.
-
content_case_sensitiveBOOLEANwebsite and server only. Match expected_content case-sensitively. Defaults to false.
-
content_regexBOOLEANwebsite and server only. Treat expected_content as a regular expression. Defaults to false.
-
ssl_warning_thresholdINTEGERssl_certificate only. Days before expiry to warn: 7, 14 or 30.
-
domain_warning_thresholdINTEGERdomain_expiration only. Days before expiry to warn: 30 or 60.
-
expected_intervalINTEGERcron_job and heartbeat only, and required for them. Minutes between expected callbacks before the watcher goes down.
-
expected_redirect_codeINTEGERredirect only, and required for it. 301, 302, 307 or 308.
-
expected_redirect_urlSTRINGredirect only, and required for it. http(s) URL the redirect must point to.
-
portINTEGERport only, and required for it. 1 to 65535.
-
protocolSTRINGport 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
-
statusSTRINGpending until the first check, then success, warning or error.
-
uptime_percentageNUMBERShare of successful checks over the last 24 hours; null before the first check.
-
in_maintenanceBOOLEANtrue while a maintenance window covers the watcher.
-
sla_target, sla_breachedNot on cron_job, heartbeat or rum watchers. The 30-day uptime target and whether uptime is below it.
-
expected_content, content_case_sensitive, content_regexOnly 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_expiryOnly on ssl_certificate watchers. The certificate found on the last check.
-
domain_warning_threshold, domain_expiry_date, domain_registrar, domain_days_until_expiryOnly on domain_expiration watchers. The registration found on the last check.
-
callback_url, callback_token, expected_interval, last_callback_at, recent_callbacksOnly 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_urlOnly on redirect watchers. The redirect the check expects.
-
callback_token, rum_script_urlOnly on rum watchers. Load rum_script_url on your pages with the token to report visits.
-
blacklist_resultsOnly on blacklist watchers. Results of the last blacklist lookup.
-
port, protocolOnly 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);