UptimeTea

API Documentation

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

Create notification

Creates a notification for yourself, in both HTML and plain text.

POST https://api.uptimetea.com/notifications

Headers

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

Body parameters

  • notification.htmlREQUIREDSTRING

    HTML version of the message.

  • notification.txtREQUIREDSTRING

    Plain-text version of the message.

Response body

{
  "id": "uuid",
  "html": "<p>Watcher <strong>My Website</strong> is down</p>",
  "txt": "Watcher My Website is down",
  "read_at": null,
  "created_at": "2024-01-15T10:00:00Z"
}

Code examples

curl -X POST "https://api.uptimetea.com/notifications" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "notification": {
      "html": "<p>Deploy finished</p>",
      "txt": "Deploy finished"
    }
  }'
// Create notification
const response = await fetch('https://api.uptimetea.com/notifications', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer ' + yourToken,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "notification": {
      "html": "<p>Deploy finished</p>",
      "txt": "Deploy finished"
    }
  })
});

const data = await response.json();
console.log(data);
# Create notification
import requests

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

response = requests.post(
    'https://api.uptimetea.com/notifications',
    headers=headers,
    json={
        'notification': {
            'html': '<p>Deploy finished</p>',
            'txt': 'Deploy finished'
        }
    }
)

print(response.json())
// Create notification
package main

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

func main() {
    body := strings.NewReader(`{
      "notification": {
        "html": "<p>Deploy finished</p>",
        "txt": "Deploy finished"
      }
    }`)
    req, _ := http.NewRequest("POST", "https://api.uptimetea.com/notifications", 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 notification
require 'net/http'
require 'uri'

uri = URI('https://api.uptimetea.com/notifications')
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
  {
    "notification": {
      "html": "<p>Deploy finished</p>",
      "txt": "Deploy finished"
    }
  }
JSON

response = http.request(request)
puts response.code, response.body
<?php
// Create notification
$ch = curl_init('https://api.uptimetea.com/notifications');
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'
{
  "notification": {
    "html": "<p>Deploy finished</p>",
    "txt": "Deploy finished"
  }
}
JSON);

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