Skip to main content
POST
/
v2
/
schedules
/
{id}
/
actions
/
preview_entries
Preview
curl --request POST \
  --url https://api.incident.io/v2/schedules/{id}/actions/preview_entries \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "entry_window_end": "2021-01-08T00:00:00Z",
  "entry_window_start": "2021-01-01T00:00:00Z",
  "schedule": {
    "annotations": {
      "incident.io/terraform/version": "version-of-terraform"
    },
    "config": {
      "rotations": [
        {
          "effective_from": "2021-08-17T13:28:57.801578Z",
          "handover_start_at": "2021-08-17T13:28:57.801578Z",
          "handovers": [
            {
              "interval": 1,
              "interval_type": "hourly"
            }
          ],
          "id": "01G0J1EXE7AXZ2C93K61WBPYEH",
          "layers": [
            {
              "id": "01G0J1EXE7AXZ2C93K61WBPYEH",
              "name": "Layer 1"
            }
          ],
          "name": "My Rotation",
          "scheduling_mode": "fair",
          "users": [
            {
              "email": "bob@example.com",
              "id": "01G0J1EXE7AXZ2C93K61WBPYEH",
              "slack_user_id": "USER123"
            }
          ],
          "working_interval": [
            {
              "end_time": "17:00",
              "start_time": "09:00",
              "weekday": "monday"
            }
          ],
          "working_intervals": [
            {
              "end_time": "17:00",
              "start_time": "09:00",
              "weekday": "monday"
            }
          ]
        }
      ]
    },
    "holidays_public_config": {
      "country_codes": [
        "abc123"
      ]
    },
    "name": "Primary On-call Schedule",
    "team_ids": [
      "01JPQA75EPNEES4479P16P4XAB"
    ],
    "timezone": "America/Los_Angeles"
  }
}
'
import requests

url = "https://api.incident.io/v2/schedules/{id}/actions/preview_entries"

payload = {
"entry_window_end": "2021-01-08T00:00:00Z",
"entry_window_start": "2021-01-01T00:00:00Z",
"schedule": {
"annotations": { "incident.io/terraform/version": "version-of-terraform" },
"config": { "rotations": [
{
"effective_from": "2021-08-17T13:28:57.801578Z",
"handover_start_at": "2021-08-17T13:28:57.801578Z",
"handovers": [
{
"interval": 1,
"interval_type": "hourly"
}
],
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"layers": [
{
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"name": "Layer 1"
}
],
"name": "My Rotation",
"scheduling_mode": "fair",
"users": [
{
"email": "bob@example.com",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"slack_user_id": "USER123"
}
],
"working_interval": [
{
"end_time": "17:00",
"start_time": "09:00",
"weekday": "monday"
}
],
"working_intervals": [
{
"end_time": "17:00",
"start_time": "09:00",
"weekday": "monday"
}
]
}
] },
"holidays_public_config": { "country_codes": ["abc123"] },
"name": "Primary On-call Schedule",
"team_ids": ["01JPQA75EPNEES4479P16P4XAB"],
"timezone": "America/Los_Angeles"
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}

response = requests.post(url, json=payload, headers=headers)

print(response.text)
const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
entry_window_end: '2021-01-08T00:00:00Z',
entry_window_start: '2021-01-01T00:00:00Z',
schedule: {
annotations: {'incident.io/terraform/version': 'version-of-terraform'},
config: {
rotations: [
{
effective_from: '2021-08-17T13:28:57.801578Z',
handover_start_at: '2021-08-17T13:28:57.801578Z',
handovers: [{interval: 1, interval_type: 'hourly'}],
id: '01G0J1EXE7AXZ2C93K61WBPYEH',
layers: [{id: '01G0J1EXE7AXZ2C93K61WBPYEH', name: 'Layer 1'}],
name: 'My Rotation',
scheduling_mode: 'fair',
users: [
{
email: 'bob@example.com',
id: '01G0J1EXE7AXZ2C93K61WBPYEH',
slack_user_id: 'USER123'
}
],
working_interval: [{end_time: '17:00', start_time: '09:00', weekday: 'monday'}],
working_intervals: [{end_time: '17:00', start_time: '09:00', weekday: 'monday'}]
}
]
},
holidays_public_config: {country_codes: ['abc123']},
name: 'Primary On-call Schedule',
team_ids: ['01JPQA75EPNEES4479P16P4XAB'],
timezone: 'America/Los_Angeles'
}
})
};

fetch('https://api.incident.io/v2/schedules/{id}/actions/preview_entries', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));
<?php

$curl = curl_init();

curl_setopt_array($curl, [
CURLOPT_URL => "https://api.incident.io/v2/schedules/{id}/actions/preview_entries",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'entry_window_end' => '2021-01-08T00:00:00Z',
'entry_window_start' => '2021-01-01T00:00:00Z',
'schedule' => [
'annotations' => [
'incident.io/terraform/version' => 'version-of-terraform'
],
'config' => [
'rotations' => [
[
'effective_from' => '2021-08-17T13:28:57.801578Z',
'handover_start_at' => '2021-08-17T13:28:57.801578Z',
'handovers' => [
[
'interval' => 1,
'interval_type' => 'hourly'
]
],
'id' => '01G0J1EXE7AXZ2C93K61WBPYEH',
'layers' => [
[
'id' => '01G0J1EXE7AXZ2C93K61WBPYEH',
'name' => 'Layer 1'
]
],
'name' => 'My Rotation',
'scheduling_mode' => 'fair',
'users' => [
[
'email' => 'bob@example.com',
'id' => '01G0J1EXE7AXZ2C93K61WBPYEH',
'slack_user_id' => 'USER123'
]
],
'working_interval' => [
[
'end_time' => '17:00',
'start_time' => '09:00',
'weekday' => 'monday'
]
],
'working_intervals' => [
[
'end_time' => '17:00',
'start_time' => '09:00',
'weekday' => 'monday'
]
]
]
]
],
'holidays_public_config' => [
'country_codes' => [
'abc123'
]
],
'name' => 'Primary On-call Schedule',
'team_ids' => [
'01JPQA75EPNEES4479P16P4XAB'
],
'timezone' => 'America/Los_Angeles'
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}
package main

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

func main() {

url := "https://api.incident.io/v2/schedules/{id}/actions/preview_entries"

payload := strings.NewReader("{\n \"entry_window_end\": \"2021-01-08T00:00:00Z\",\n \"entry_window_start\": \"2021-01-01T00:00:00Z\",\n \"schedule\": {\n \"annotations\": {\n \"incident.io/terraform/version\": \"version-of-terraform\"\n },\n \"config\": {\n \"rotations\": [\n {\n \"effective_from\": \"2021-08-17T13:28:57.801578Z\",\n \"handover_start_at\": \"2021-08-17T13:28:57.801578Z\",\n \"handovers\": [\n {\n \"interval\": 1,\n \"interval_type\": \"hourly\"\n }\n ],\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"layers\": [\n {\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"name\": \"Layer 1\"\n }\n ],\n \"name\": \"My Rotation\",\n \"scheduling_mode\": \"fair\",\n \"users\": [\n {\n \"email\": \"bob@example.com\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"slack_user_id\": \"USER123\"\n }\n ],\n \"working_interval\": [\n {\n \"end_time\": \"17:00\",\n \"start_time\": \"09:00\",\n \"weekday\": \"monday\"\n }\n ],\n \"working_intervals\": [\n {\n \"end_time\": \"17:00\",\n \"start_time\": \"09:00\",\n \"weekday\": \"monday\"\n }\n ]\n }\n ]\n },\n \"holidays_public_config\": {\n \"country_codes\": [\n \"abc123\"\n ]\n },\n \"name\": \"Primary On-call Schedule\",\n \"team_ids\": [\n \"01JPQA75EPNEES4479P16P4XAB\"\n ],\n \"timezone\": \"America/Los_Angeles\"\n }\n}")

req, _ := http.NewRequest("POST", url, payload)

req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")

res, _ := http.DefaultClient.Do(req)

defer res.Body.Close()
body, _ := io.ReadAll(res.Body)

fmt.Println(string(body))

}
HttpResponse<String> response = Unirest.post("https://api.incident.io/v2/schedules/{id}/actions/preview_entries")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"entry_window_end\": \"2021-01-08T00:00:00Z\",\n \"entry_window_start\": \"2021-01-01T00:00:00Z\",\n \"schedule\": {\n \"annotations\": {\n \"incident.io/terraform/version\": \"version-of-terraform\"\n },\n \"config\": {\n \"rotations\": [\n {\n \"effective_from\": \"2021-08-17T13:28:57.801578Z\",\n \"handover_start_at\": \"2021-08-17T13:28:57.801578Z\",\n \"handovers\": [\n {\n \"interval\": 1,\n \"interval_type\": \"hourly\"\n }\n ],\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"layers\": [\n {\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"name\": \"Layer 1\"\n }\n ],\n \"name\": \"My Rotation\",\n \"scheduling_mode\": \"fair\",\n \"users\": [\n {\n \"email\": \"bob@example.com\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"slack_user_id\": \"USER123\"\n }\n ],\n \"working_interval\": [\n {\n \"end_time\": \"17:00\",\n \"start_time\": \"09:00\",\n \"weekday\": \"monday\"\n }\n ],\n \"working_intervals\": [\n {\n \"end_time\": \"17:00\",\n \"start_time\": \"09:00\",\n \"weekday\": \"monday\"\n }\n ]\n }\n ]\n },\n \"holidays_public_config\": {\n \"country_codes\": [\n \"abc123\"\n ]\n },\n \"name\": \"Primary On-call Schedule\",\n \"team_ids\": [\n \"01JPQA75EPNEES4479P16P4XAB\"\n ],\n \"timezone\": \"America/Los_Angeles\"\n }\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.incident.io/v2/schedules/{id}/actions/preview_entries")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"entry_window_end\": \"2021-01-08T00:00:00Z\",\n \"entry_window_start\": \"2021-01-01T00:00:00Z\",\n \"schedule\": {\n \"annotations\": {\n \"incident.io/terraform/version\": \"version-of-terraform\"\n },\n \"config\": {\n \"rotations\": [\n {\n \"effective_from\": \"2021-08-17T13:28:57.801578Z\",\n \"handover_start_at\": \"2021-08-17T13:28:57.801578Z\",\n \"handovers\": [\n {\n \"interval\": 1,\n \"interval_type\": \"hourly\"\n }\n ],\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"layers\": [\n {\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"name\": \"Layer 1\"\n }\n ],\n \"name\": \"My Rotation\",\n \"scheduling_mode\": \"fair\",\n \"users\": [\n {\n \"email\": \"bob@example.com\",\n \"id\": \"01G0J1EXE7AXZ2C93K61WBPYEH\",\n \"slack_user_id\": \"USER123\"\n }\n ],\n \"working_interval\": [\n {\n \"end_time\": \"17:00\",\n \"start_time\": \"09:00\",\n \"weekday\": \"monday\"\n }\n ],\n \"working_intervals\": [\n {\n \"end_time\": \"17:00\",\n \"start_time\": \"09:00\",\n \"weekday\": \"monday\"\n }\n ]\n }\n ]\n },\n \"holidays_public_config\": {\n \"country_codes\": [\n \"abc123\"\n ]\n },\n \"name\": \"Primary On-call Schedule\",\n \"team_ids\": [\n \"01JPQA75EPNEES4479P16P4XAB\"\n ],\n \"timezone\": \"America/Los_Angeles\"\n }\n}"

response = http.request(request)
puts response.read_body
{
  "schedule_entries": {
    "final": [
      {
        "end_at": "2021-08-17T13:28:57.801578Z",
        "entry_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
        "fingerprint": "01G0J1EXE7AXZ2C93K61WBPYEH",
        "layer_id": "01G0J1EXE7AXZ2C93K61WBPYNH",
        "rotation_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
        "start_at": "2021-08-17T13:28:57.801578Z",
        "user": {
          "email": "lisa@incident.io",
          "id": "01FCNDV6P870EA6S7TK1DSYDG0",
          "name": "Lisa Karlin Curtis",
          "role": "owner",
          "slack_user_id": "U02AYNF2XJM"
        }
      }
    ],
    "overrides": [
      {
        "end_at": "2021-08-17T13:28:57.801578Z",
        "entry_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
        "fingerprint": "01G0J1EXE7AXZ2C93K61WBPYEH",
        "layer_id": "01G0J1EXE7AXZ2C93K61WBPYNH",
        "rotation_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
        "start_at": "2021-08-17T13:28:57.801578Z",
        "user": {
          "email": "lisa@incident.io",
          "id": "01FCNDV6P870EA6S7TK1DSYDG0",
          "name": "Lisa Karlin Curtis",
          "role": "owner",
          "slack_user_id": "U02AYNF2XJM"
        }
      }
    ],
    "scheduled": [
      {
        "end_at": "2021-08-17T13:28:57.801578Z",
        "entry_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
        "fingerprint": "01G0J1EXE7AXZ2C93K61WBPYEH",
        "layer_id": "01G0J1EXE7AXZ2C93K61WBPYNH",
        "rotation_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
        "start_at": "2021-08-17T13:28:57.801578Z",
        "user": {
          "email": "lisa@incident.io",
          "id": "01FCNDV6P870EA6S7TK1DSYDG0",
          "name": "Lisa Karlin Curtis",
          "role": "owner",
          "slack_user_id": "U02AYNF2XJM"
        }
      }
    ]
  }
}
🔑 Requires the schedules.view scope.

Authorizations

Authorization
string
header
required

API key from your incident.io dashboard (Settings → API keys)

Path Parameters

id
string
required

The ID of the schedule to preview entries for.

Example:

"01FDAG4SAP5TYPT98WGR2N7W91"

Body

application/json
schedule
object
required
Example:
{
"annotations": {
"incident.io/terraform/version": "version-of-terraform"
},
"config": {
"rotations": [
{
"effective_from": "2021-08-17T13:28:57.801578Z",
"handover_start_at": "2021-08-17T13:28:57.801578Z",
"handovers": [
{ "interval": 1, "interval_type": "hourly" }
],
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"layers": [
{
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"name": "Layer 1"
}
],
"name": "My Rotation",
"scheduling_mode": "fair",
"users": [
{
"email": "bob@example.com",
"id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"slack_user_id": "USER123"
}
],
"working_interval": [
{
"end_time": "17:00",
"start_time": "09:00",
"weekday": "monday"
}
],
"working_intervals": [
{
"end_time": "17:00",
"start_time": "09:00",
"weekday": "monday"
}
]
}
]
},
"holidays_public_config": { "country_codes": ["abc123"] },
"name": "Primary On-call Schedule",
"team_ids": ["01JPQA75EPNEES4479P16P4XAB"],
"timezone": "America/Los_Angeles"
}
entry_window_end
string<date-time>

The end of the window to preview entries for. Defaults to four weeks after entry_window_start.

Example:

"2021-01-08T00:00:00Z"

entry_window_start
string<date-time>

The start of the window to preview entries for. Defaults to now.

Example:

"2021-01-01T00:00:00Z"

Response

200 - application/json

OK response.

schedule_entries
object
required

The schedule entries for a window of time, grouped by where they come from.

scheduled are the entries produced by the schedule's rotation rules before any overrides are taken into account. overrides are the one-off changes that apply within the window. final is the effective schedule after overrides have been merged in — this is normally the list to use when working out who is on-call.

Example:
{
"final": [
{
"end_at": "2021-08-17T13:28:57.801578Z",
"entry_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"fingerprint": "01G0J1EXE7AXZ2C93K61WBPYEH",
"layer_id": "01G0J1EXE7AXZ2C93K61WBPYNH",
"rotation_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"start_at": "2021-08-17T13:28:57.801578Z",
"user": {
"email": "lisa@incident.io",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Lisa Karlin Curtis",
"role": "owner",
"slack_user_id": "U02AYNF2XJM"
}
}
],
"overrides": [
{
"end_at": "2021-08-17T13:28:57.801578Z",
"entry_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"fingerprint": "01G0J1EXE7AXZ2C93K61WBPYEH",
"layer_id": "01G0J1EXE7AXZ2C93K61WBPYNH",
"rotation_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"start_at": "2021-08-17T13:28:57.801578Z",
"user": {
"email": "lisa@incident.io",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Lisa Karlin Curtis",
"role": "owner",
"slack_user_id": "U02AYNF2XJM"
}
}
],
"scheduled": [
{
"end_at": "2021-08-17T13:28:57.801578Z",
"entry_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"fingerprint": "01G0J1EXE7AXZ2C93K61WBPYEH",
"layer_id": "01G0J1EXE7AXZ2C93K61WBPYNH",
"rotation_id": "01G0J1EXE7AXZ2C93K61WBPYEH",
"start_at": "2021-08-17T13:28:57.801578Z",
"user": {
"email": "lisa@incident.io",
"id": "01FCNDV6P870EA6S7TK1DSYDG0",
"name": "Lisa Karlin Curtis",
"role": "owner",
"slack_user_id": "U02AYNF2XJM"
}
}
]
}