UptimeTea

API Documentation

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

Create escalation policy

Creates an empty escalation policy. Add levels with the rules endpoints. Requires the owner or manager role.

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

Headers

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

Body parameters

  • escalation_policy.nameREQUIREDSTRING

    Policy name.

Response body

{
  "id": "uuid",
  "name": "Production",
  "rules": [],
  "created_at": "2024-01-15T10:00:00Z"
}

Code examples

curl -X POST "https://api.uptimetea.com/escalation_policies" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "escalation_policy": {
      "name": "Production"
    }
  }'
// Create escalation policy
const response = await fetch('https://api.uptimetea.com/escalation_policies', {
  method: 'POST',
  headers: {
    'Authorization': 'Bearer ' + yourToken,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "escalation_policy": {
      "name": "Production"
    }
  })
});

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

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

response = requests.post(
    'https://api.uptimetea.com/escalation_policies',
    headers=headers,
    json={
        'escalation_policy': {
            'name': 'Production'
        }
    }
)

print(response.json())
// Create escalation policy
package main

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

func main() {
    body := strings.NewReader(`{
      "escalation_policy": {
        "name": "Production"
      }
    }`)
    req, _ := http.NewRequest("POST", "https://api.uptimetea.com/escalation_policies", 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 escalation policy
require 'net/http'
require 'uri'

uri = URI('https://api.uptimetea.com/escalation_policies')
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
  {
    "escalation_policy": {
      "name": "Production"
    }
  }
JSON

response = http.request(request)
puts response.code, response.body
<?php
// Create escalation policy
$ch = curl_init('https://api.uptimetea.com/escalation_policies');
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'
{
  "escalation_policy": {
    "name": "Production"
  }
}
JSON);

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