UptimeTea

API Documentation

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

Update webhook

Changes a webhook's URL, events or enabled flag. The secret never changes.

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

Headers

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

Body parameters

  • webhook.urlSTRING

    http(s) URL that receives the events.

  • webhook.eventsARRAY

    One or more of: watcher_down, watcher_up, incident_opened, incident_resolved.

  • webhook.enabledBOOLEAN

    Pauses deliveries when false.

Response body

{
  "id": "uuid",
  "url": "https://example.com/hooks/uptimetea",
  "secret": "3f9c...e41a",
  "events": ["watcher_down", "watcher_up"],
  "enabled": false,
  "created_at": "2024-01-15T10:00:00Z"
}

Code examples

curl -X PATCH "https://api.uptimetea.com/webhooks/$WEBHOOK_ID" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "webhook": {
      "enabled": false
    }
  }'
// Update webhook
const response = await fetch('https://api.uptimetea.com/webhooks/WEBHOOK_ID', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer ' + yourToken,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "webhook": {
      "enabled": false
    }
  })
});

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

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

response = requests.patch(
    'https://api.uptimetea.com/webhooks/WEBHOOK_ID',
    headers=headers,
    json={
        'webhook': {
            'enabled': False
        }
    }
)

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

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

func main() {
    body := strings.NewReader(`{
      "webhook": {
        "enabled": false
      }
    }`)
    req, _ := http.NewRequest("PATCH", "https://api.uptimetea.com/webhooks/WEBHOOK_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 webhook
require 'net/http'
require 'uri'

uri = URI('https://api.uptimetea.com/webhooks/WEBHOOK_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
  {
    "webhook": {
      "enabled": false
    }
  }
JSON

response = http.request(request)
puts response.code, response.body
<?php
// Update webhook
$ch = curl_init('https://api.uptimetea.com/webhooks/WEBHOOK_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'
{
  "webhook": {
    "enabled": false
  }
}
JSON);

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