Explore documentation

Bulk update on-call calendar events

Replace all current and future on-call events in a single on-call calendar:

  • Delete all events that start today at 0:00 UTC or later.
  • Create new events. All newly created events also must start today at 0:00 UTC or later.
PUT https://uptime.betterstack.com/api/v2/on-calls/{calendar_id}/events

URL parameters

calendar_id
required string

Headers

Authorization
required string

Body parameters

events
required array
200

Response body

{
  "events": [
    {
      "id": 12345,
      "users": ["tomas@betterstack.com"],
      "starts_at": "2024-09-04T22:00:00Z",
      "ends_at": "2024-09-05T22:00:00Z",
    },
    {
      "id": 23456,
      "users": ["simon@betterstack.com"],
      "starts_at": "2024-09-05T22:00:00Z",
      "ends_at": "2024-09-06T22:00:00Z",
    },
    {
      "id": 34567,
      "users": ["tomas@betterstack.com"],
      "starts_at": "2024-09-06T22:00:00Z",
      "ends_at": "2024-09-07T22:00:00Z",
    }
  ]
}
422

Response body

{
  "errors": "Sorry, these attributes have unsupported values",
  "allowed_values": {
    "event": {
      "starts_at": [
        "must be today at 00:00 UTC or later"
      ]
    }
  }
}

Example cURL

Example
curl --request PUT \
  --url "https://uptime.betterstack.com/api/v2/on-calls/default/events" \
  --header "Authorization: Bearer $TOKEN"
  --header "Content-Type: application/json"
  --data '{"events":[{"users":["tomas@betterstack.com"],"starts_at":"2024-09-04T22:00:00Z","ends_at":"2024-09-05T22:00:00Z"},{"users":["simon@betterstack.com"],"starts_at":"2024-09-05T22:00:00Z","ends_at":"2024-09-06T22:00:00Z"},{"users":["tomas@betterstack.com"],"starts_at":"2024-09-06T22:00:00Z","ends_at":"2024-09-07T22:00:00Z"}]}'