API Documentation
The UptimeTea API is easy to use and free for all plans.
Create webhook
Creates a webhook. Each event is POSTed to the URL as JSON with an X-UptimeTea-Event header and an X-UptimeTea-Signature header (sha256= followed by the HMAC-SHA256 of the raw body, keyed with the webhook secret). Failed deliveries are retried.
POST
https://api.uptimetea.com/webhooks
Headers
-
AuthorizationREQUIREDSTRINGBearer $TOKEN -
Content-TypeREQUIREDSTRINGapplication/json
Body parameters
-
webhook.urlREQUIREDSTRINGhttp(s) URL that receives the events.
-
webhook.eventsREQUIREDARRAYOne or more of: watcher_down, watcher_up, incident_opened, incident_resolved.
-
webhook.enabledBOOLEANPauses deliveries when false. Defaults to true.
Response body
{
"id": "uuid",
"url": "https://example.com/hooks/uptimetea",
"secret": "3f9c...e41a",
"events": ["watcher_down", "watcher_up"],
"enabled": true,
"created_at": "2024-01-15T10:00:00Z"
}
Code examples
curl -X POST "https://api.uptimetea.com/webhooks" \
-H "Authorization: Bearer $TOKEN" \
-H "Content-Type: application/json" \
-d '{
"webhook": {
"url": "https://example.com/hooks/uptimetea",
"events": ["watcher_down", "watcher_up"]
}
}'
// Create webhook
const response = await fetch('https://api.uptimetea.com/webhooks', {
method: 'POST',
headers: {
'Authorization': 'Bearer ' + yourToken,
'Content-Type': 'application/json'
},
body: JSON.stringify({
"webhook": {
"url": "https://example.com/hooks/uptimetea",
"events": ["watcher_down", "watcher_up"]
}
})
});
const data = await response.json();
console.log(data);
# Create webhook
import requests
headers = {'Authorization': f'Bearer {your_token}'}
response = requests.post(
'https://api.uptimetea.com/webhooks',
headers=headers,
json={
'webhook': {
'url': 'https://example.com/hooks/uptimetea',
'events': ['watcher_down', 'watcher_up']
}
}
)
print(response.json())
// Create webhook
package main
import (
"fmt"
"io"
"net/http"
"strings"
)
func main() {
body := strings.NewReader(`{
"webhook": {
"url": "https://example.com/hooks/uptimetea",
"events": ["watcher_down", "watcher_up"]
}
}`)
req, _ := http.NewRequest("POST", "https://api.uptimetea.com/webhooks", 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))
}
# Create webhook
require 'net/http'
require 'uri'
uri = URI('https://api.uptimetea.com/webhooks')
http = Net::HTTP.new(uri.host, uri.port)
http.use_ssl = true
request = Net::HTTP::Post.new(uri)
request['Authorization'] = "Bearer #{your_token}"
request['Content-Type'] = 'application/json'
request.body = <<~JSON
{
"webhook": {
"url": "https://example.com/hooks/uptimetea",
"events": ["watcher_down", "watcher_up"]
}
}
JSON
response = http.request(request)
puts response.code, response.body
<?php
// Create webhook
$ch = curl_init('https://api.uptimetea.com/webhooks');
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_CUSTOMREQUEST, 'POST');
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Authorization: Bearer ' . $yourToken,
'Content-Type: application/json'
]);
curl_setopt($ch, CURLOPT_POSTFIELDS, <<<'JSON'
{
"webhook": {
"url": "https://example.com/hooks/uptimetea",
"events": ["watcher_down", "watcher_up"]
}
}
JSON);
$response = curl_exec($ch);
print_r(json_decode($response, true));
curl_close($ch);