API Documentation
The UptimeTea API is easy to use and free for all plans.
Update alert preferences
Turns alert channels on or off. SMS and phone calls need a number; quiet hours need both a start and an end.
PATCH
https://api.uptimetea.com/notification_preference
Headers
-
AuthorizationREQUIREDSTRINGBearer $TOKEN -
Content-TypeREQUIREDSTRINGapplication/json
Body parameters
-
email_enabledBOOLEANSend alerts by email.
-
email_addressSTRINGWhere email alerts go; defaults to your login email.
-
sms_enabledBOOLEANSend alerts by SMS.
-
sms_phone_numberSTRINGNumber for SMS alerts, required when SMS is on.
-
call_enabledBOOLEANPhone you when a watcher goes down.
-
call_phone_numberSTRINGNumber to call, required when calls are on.
-
quiet_hours_startSTRINGStart of quiet hours, as HH:MM.
-
quiet_hours_endSTRINGEnd of quiet hours, as HH:MM.
Response body
{
"email_enabled": true,
"email_address": "user@example.com",
"sms_enabled": false,
"sms_phone_number": null,
"call_enabled": true,
"call_phone_number": "+37060000000",
"quiet_hours_start": "2000-01-01T22:00:00.000Z",
"quiet_hours_end": "2000-01-01T07:00:00.000Z"
}
Code examples
curl -X PATCH "https://api.uptimetea.com/notification_preference" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"call_enabled": true,
"call_phone_number": "+37060000000",
"quiet_hours_start": "22:00",
"quiet_hours_end": "07:00"
}'
// Update alert preferences
const response = await fetch('https://api.uptimetea.com/notification_preference', {
method: 'PATCH',
headers: {
'Authorization': 'Bearer ' + yourToken,
'Content-Type': 'application/json'
},
body: JSON.stringify({
"call_enabled": true,
"call_phone_number": "+37060000000",
"quiet_hours_start": "22:00",
"quiet_hours_end": "07:00"
})
});
const data = await response.json();
console.log(data);
# Update alert preferences
import requests
headers = {'Authorization': f'Bearer {your_token}'}
response = requests.patch(
'https://api.uptimetea.com/notification_preference',
headers=headers,
json={
'call_enabled': True,
'call_phone_number': '+37060000000',
'quiet_hours_start': '22:00',
'quiet_hours_end': '07:00'
}
)
print(response.json())
// Update alert preferences
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader(`{
"call_enabled": true,
"call_phone_number": "+37060000000",
"quiet_hours_start": "22:00",
"quiet_hours_end": "07:00"
}`)
req, _ := http.NewRequest("PATCH", "https://api.uptimetea.com/notification_preference", 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 alert preferences
require 'net/http'
require 'uri'
uri = URI('https://api.uptimetea.com/notification_preference')
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
{
"call_enabled": true,
"call_phone_number": "+37060000000",
"quiet_hours_start": "22:00",
"quiet_hours_end": "07:00"
}
JSON
response = http.request(request)
puts response.code, response.body
<?php
// Update alert preferences
$ch = curl_init('https://api.uptimetea.com/notification_preference');
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'
{
"call_enabled": true,
"call_phone_number": "+37060000000",
"quiet_hours_start": "22:00",
"quiet_hours_end": "07:00"
}
JSON);
$response = curl_exec($ch);
print_r(json_decode($response, true));
curl_close($ch);