UptimeTea

API Documentation

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

Add escalation level

Appends a level to the policy. Each level alerts exactly one target: an on-call schedule or a user. Requires the owner or manager role.

POST https://api.uptimetea.com/escalation_policies/:escalation_policy_id/rules

Headers

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

Body parameters

  • rule.delay_minutesINTEGER

    Minutes to wait after the previous level, 0 to 1440.

  • rule.on_call_schedule_idSTRING

    Alert whoever is on call for this schedule. Set this or user_id, not both.

  • rule.user_idSTRING

    Alert this team member. Set this or on_call_schedule_id, not both.

Response body

{
  "id": "uuid",
  "level": 1,
  "delay_minutes": 15,
  "on_call_schedule_id": "uuid",
  "user_id": null
}

Code examples

curl -X POST "https://api.uptimetea.com/escalation_policies/$ESCALATION_POLICY_ID/rules" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "rule": {
      "delay_minutes": 15,
      "on_call_schedule_id": "uuid"
    }
  }'
// Add escalation level
const response = await fetch('https://api.uptimetea.com/escalation_policies/ESCALATION_POLICY_ID/rules', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer ' + yourToken,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "rule": {
      "delay_minutes": 15,
      "on_call_schedule_id": "uuid"
    }
  })
});

const data = await response.json();
console.log(data);
# Add escalation level
import requests

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

response = requests.post(
    'https://api.uptimetea.com/escalation_policies/ESCALATION_POLICY_ID/rules',
    headers=headers,
    json={
        'rule': {
            'delay_minutes': 15,
            'on_call_schedule_id': 'uuid'
        }
    }
)

print(response.json())
// Add escalation level
package main

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

func main() {
    body := strings.NewReader(`{
      "rule": {
        "delay_minutes": 15,
        "on_call_schedule_id": "uuid"
      }
    }`)
    req, _ := http.NewRequest("POST", "https://api.uptimetea.com/escalation_policies/ESCALATION_POLICY_ID/rules", 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))
}
# Add escalation level
require 'net/http'
require 'uri'

uri = URI('https://api.uptimetea.com/escalation_policies/ESCALATION_POLICY_ID/rules')
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
  {
    "rule": {
      "delay_minutes": 15,
      "on_call_schedule_id": "uuid"
    }
  }
JSON

response = http.request(request)
puts response.code, response.body
<?php
// Add escalation level
$ch = curl_init('https://api.uptimetea.com/escalation_policies/ESCALATION_POLICY_ID/rules');
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'
{
  "rule": {
    "delay_minutes": 15,
    "on_call_schedule_id": "uuid"
  }
}
JSON);

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