UptimeTea

API Documentation

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

Update on-call schedule

Changes a schedule's name, timezone or rotation. Requires the owner or manager role.

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

Headers

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

Body parameters

  • on_call_schedule.nameSTRING

    Schedule name.

  • on_call_schedule.timezoneSTRING

    IANA timezone the handoff time is in. Defaults to UTC.

  • on_call_schedule.rotation_typeSTRING

    daily, weekly or custom. Defaults to weekly.

  • on_call_schedule.rotation_hoursINTEGER

    Shift length in hours for custom rotations, up to 672 (four weeks).

  • on_call_schedule.handoff_timeSTRING

    Time of day shifts change, as HH:MM. Defaults to 09:00.

  • on_call_schedule.starts_onSTRING

    Date of the first shift, as YYYY-MM-DD.

Response body

{
  "id": "uuid",
  "name": "Primary",
  "timezone": "Europe/Vilnius",
  "rotation_type": "custom",
  "rotation_hours": 12,
  "handoff_time": "09:00",
  "starts_on": "2024-01-15",
  "participants": [
    {
      "id": "uuid",
      "user_id": "uuid",
      "position": 0,
      "first_name": "Jane",
      "last_name": "Doe",
      "email": "jane@example.com"
    },
    {
      "id": "uuid",
      "user_id": "uuid",
      "position": 1,
      "first_name": "John",
      "last_name": "Doe",
      "email": "john@example.com"
    }
  ],
  "created_at": "2024-01-15T10:00:00Z",
  "on_call_user": {
    "id": "uuid",
    "first_name": "Jane",
    "last_name": "Doe",
    "email": "jane@example.com"
  },
  "next_on_call_user": {
    "id": "uuid",
    "first_name": "John",
    "last_name": "Doe",
    "email": "john@example.com"
  },
  "next_handoff_at": "2024-01-22T07:00:00Z"
}

Code examples

curl -X PATCH "https://api.uptimetea.com/on_call_schedules/$ON_CALL_SCHEDULE_ID" \
  -H "Authorization: Bearer $TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
    "on_call_schedule": {
      "rotation_type": "custom",
      "rotation_hours": 12
    }
  }'
// Update on-call schedule
const response = await fetch('https://api.uptimetea.com/on_call_schedules/ON_CALL_SCHEDULE_ID', {
  method: 'PATCH',
  headers: {
    'Authorization': 'Bearer ' + yourToken,
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    "on_call_schedule": {
      "rotation_type": "custom",
      "rotation_hours": 12
    }
  })
});

const data = await response.json();
console.log(data);
# Update on-call schedule
import requests

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

response = requests.patch(
    'https://api.uptimetea.com/on_call_schedules/ON_CALL_SCHEDULE_ID',
    headers=headers,
    json={
        'on_call_schedule': {
            'rotation_type': 'custom',
            'rotation_hours': 12
        }
    }
)

print(response.json())
// Update on-call schedule
package main

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

func main() {
    body := strings.NewReader(`{
      "on_call_schedule": {
        "rotation_type": "custom",
        "rotation_hours": 12
      }
    }`)
    req, _ := http.NewRequest("PATCH", "https://api.uptimetea.com/on_call_schedules/ON_CALL_SCHEDULE_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 on-call schedule
require 'net/http'
require 'uri'

uri = URI('https://api.uptimetea.com/on_call_schedules/ON_CALL_SCHEDULE_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
  {
    "on_call_schedule": {
      "rotation_type": "custom",
      "rotation_hours": 12
    }
  }
JSON

response = http.request(request)
puts response.code, response.body
<?php
// Update on-call schedule
$ch = curl_init('https://api.uptimetea.com/on_call_schedules/ON_CALL_SCHEDULE_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'
{
  "on_call_schedule": {
    "rotation_type": "custom",
    "rotation_hours": 12
  }
}
JSON);

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