Skip to main content

schedules

Creates, updates, deletes, gets or lists a schedules resource.

Overview

Nameschedules
TypeResource
Idpagerduty.schedules_v3.schedules

Fields

The following fields are returned by SELECT queries:

Schedule retrieved successfully

NameDatatypeDescription
idstring (example: PL5FQHC)
namestring (example: Engineering On-Call)
descriptionstring (example: Primary engineering on-call rotation)
escalation_policiesarrayEscalation policies that reference this schedule
final_scheduleobjectComputed on-call assignments for the requested time range. Only present when include[]=final_schedule is specified and since/until are provided.
html_urlstring (uri)
http_cal_urlstring (uri)iCal HTTP feed URL for this schedule
rotationsarrayRotations in this schedule
selfstring (uri)
teamsarray
time_zonestring (example: America/New_York)
typestringAlways "schedule_v3" for schedules created with this API. Schedules created with the legacy /schedules API use "schedule". (schedule_v3)
usersarrayAll users referenced in this schedule (only present when include[]=users)
web_cal_urlstring (uri)iCal webcal URL for this schedule

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectidsince, until, time_zone, overflow, include[]<!-- theme: info --><br /><br />> Important note: Shift-based schedules use the V3 API and are not compatible with V2 automations. To create automations for Shift-Based Schedules, you need to:<br />><br />> 1. Update your automations to use the V3 API for all new shift-based schedules<br />> 2. Keep the V2 endpoint for your existing schedules<br />><br />> An upgrade tool for existing schedules is coming soon; your legacy schedules will keep working in the meantime. [Learn more](https:​//support.pagerduty.com/main/docs/shift-based-schedules-api-upgrade-examples).<br /><br />Retrieve a schedule by ID including rotations and events. Optionally<br />include the computed final schedule for a time range.<br /><br />Use include&#91;&#93;=final_schedule to get computed on-call assignments.<br />Use since and until to specify the time range.<br />
listselectlimit, offset, query, total, team_ids[]<!-- theme: info --><br /><br />> Important note: Shift-based schedules use the V3 API and are not compatible with V2 automations. To create automations for Shift-Based Schedules, you need to:<br />><br />> 1. Update your automations to use the V3 API for all new shift-based schedules<br />> 2. Keep the V2 endpoint for your existing schedules<br />><br />> An upgrade tool for existing schedules is coming soon; your legacy schedules will keep working in the meantime. [Learn more](https:​//support.pagerduty.com/main/docs/shift-based-schedules-api-upgrade-examples).<br /><br />Retrieve a paginated list of schedule references. Returns lightweight<br />objects without embedded rotations or events.<br /><br />Each result is filtered by the caller's read permission; schedules the<br />caller cannot read are silently excluded.<br />
createinsertschedule<!-- theme: info --><br /><br />> Important note: Shift-based schedules use the V3 API and are not compatible with V2 automations. To create automations for Shift-Based Schedules, you need to:<br />><br />> 1. Update your automations to use the V3 API for all new shift-based schedules<br />> 2. Keep the V2 endpoint for your existing schedules<br />><br />> An upgrade tool for existing schedules is coming soon; your legacy schedules will keep working in the meantime. [Learn more](https:​//support.pagerduty.com/main/docs/shift-based-schedules-api-upgrade-examples).<br /><br />Create a new on-call schedule with basic metadata. Rotations and events<br />must be added via separate API calls after creation.<br /><br />Rejected fields: rotations and escalation_policies are not<br />accepted in the request body and will result in a 400 error.<br />
updateupdateid, schedule<!-- theme: info --><br /><br />> Important note: Shift-based schedules use the V3 API and are not compatible with V2 automations. To create automations for Shift-Based Schedules, you need to:<br />><br />> 1. Update your automations to use the V3 API for all new shift-based schedules<br />> 2. Keep the V2 endpoint for your existing schedules<br />><br />> An upgrade tool for existing schedules is coming soon; your legacy schedules will keep working in the meantime. [Learn more](https:​//support.pagerduty.com/main/docs/shift-based-schedules-api-upgrade-examples).<br /><br />Update schedule metadata (name, description, time zone). All fields are<br />optional — only provided fields are updated.<br /><br />To modify rotations or events, use their respective endpoints.<br /><br />Rejected fields: rotations and escalation_policies are not<br />accepted and will result in a 400 error.<br />
deletedeleteid<!-- theme: info --><br /><br />> Important note: Shift-based schedules use the V3 API and are not compatible with V2 automations. To create automations for Shift-Based Schedules, you need to:<br />><br />> 1. Update your automations to use the V3 API for all new shift-based schedules<br />> 2. Keep the V2 endpoint for your existing schedules<br />><br />> An upgrade tool for existing schedules is coming soon; your legacy schedules will keep working in the meantime. [Learn more](https:​//support.pagerduty.com/main/docs/shift-based-schedules-api-upgrade-examples).<br /><br />Delete a schedule and all associated rotations and events.<br /><br />If the schedule is referenced by an active escalation policy, the<br />deletion will be rejected.<br />

Parameters

Parameters can be passed in the WHERE clause of a query. Check the Methods section to see which parameters are required or optional for each operation.

NameDatatypeDescription
idstringThe ID of the schedule. (example: PSJUKNI)
include[]arrayAdditional data to include in the schedule response: - final_schedule: computed on-call assignments for the time range (example: [final_schedule])
limitintegerMaximum number of schedules to return
offsetinteger
overflowbooleanInclude shifts that extend beyond the requested time range boundaries
querystringFilters the result, showing only the records whose name matches the query.
sincestring (date-time)Start of time range (ISO 8601) (example: 2025-01-01T00:00:00Z)
team_ids[]arrayAn array of team IDs. Only results related to these teams will be returned. Account must have the teams ability to use this parameter.
time_zonestringIANA timezone identifier for rendering shift times. Defaults to the schedule's configured time zone. (example: America/New_York)
totalbooleanBy default the total field in pagination responses is set to null to provide the fastest possible response times. Set total to true for this field to be populated. See our [Pagination Docs](https:​//developer.pagerduty.com/docs/rest-api-v2/pagination/) for more information.
untilstring (date-time)End of time range (ISO 8601) (example: 2025-01-31T23:59:59Z)

SELECT examples

<!-- theme: info --><br /><br />> Important note: Shift-based schedules use the V3 API and are not compatible with V2 automations. To create automations for Shift-Based Schedules, you need to:<br />><br />> 1. Update your automations to use the V3 API for all new shift-based schedules<br />> 2. Keep the V2 endpoint for your existing schedules<br />><br />> An upgrade tool for existing schedules is coming soon; your legacy schedules will keep working in the meantime. [Learn more](https:​//support.pagerduty.com/main/docs/shift-based-schedules-api-upgrade-examples).<br /><br />Retrieve a schedule by ID including rotations and events. Optionally<br />include the computed final schedule for a time range.<br /><br />Use include&#91;&#93;=final_schedule to get computed on-call assignments.<br />Use since and until to specify the time range.<br />

SELECT
id,
name,
description,
escalation_policies,
final_schedule,
html_url,
http_cal_url,
rotations,
self,
teams,
time_zone,
type,
users,
web_cal_url
FROM pagerduty.schedules_v3.schedules
WHERE id = '{{ id }}' -- required
AND since = '{{ since }}'
AND until = '{{ until }}'
AND time_zone = '{{ time_zone }}'
AND overflow = '{{ overflow }}'
AND include[] = '{{ include[] }}'
;

INSERT examples

<!-- theme: info --><br /><br />> Important note: Shift-based schedules use the V3 API and are not compatible with V2 automations. To create automations for Shift-Based Schedules, you need to:<br />><br />> 1. Update your automations to use the V3 API for all new shift-based schedules<br />> 2. Keep the V2 endpoint for your existing schedules<br />><br />> An upgrade tool for existing schedules is coming soon; your legacy schedules will keep working in the meantime. [Learn more](https:​//support.pagerduty.com/main/docs/shift-based-schedules-api-upgrade-examples).<br /><br />Create a new on-call schedule with basic metadata. Rotations and events<br />must be added via separate API calls after creation.<br /><br />Rejected fields: rotations and escalation_policies are not<br />accepted in the request body and will result in a 400 error.<br />

INSERT INTO pagerduty.schedules_v3.schedules (
schedule
)
SELECT
'{{ schedule }}' /* required */
RETURNING
schedule
;

UPDATE examples

<!-- theme: info --><br /><br />> Important note: Shift-based schedules use the V3 API and are not compatible with V2 automations. To create automations for Shift-Based Schedules, you need to:<br />><br />> 1. Update your automations to use the V3 API for all new shift-based schedules<br />> 2. Keep the V2 endpoint for your existing schedules<br />><br />> An upgrade tool for existing schedules is coming soon; your legacy schedules will keep working in the meantime. [Learn more](https:​//support.pagerduty.com/main/docs/shift-based-schedules-api-upgrade-examples).<br /><br />Update schedule metadata (name, description, time zone). All fields are<br />optional — only provided fields are updated.<br /><br />To modify rotations or events, use their respective endpoints.<br /><br />Rejected fields: rotations and escalation_policies are not<br />accepted and will result in a 400 error.<br />

UPDATE pagerduty.schedules_v3.schedules
SET
schedule = '{{ schedule }}'
WHERE
id = '{{ id }}' --required
AND schedule = '{{ schedule }}' --required
RETURNING
schedule;

DELETE examples

<!-- theme: info --><br /><br />> Important note: Shift-based schedules use the V3 API and are not compatible with V2 automations. To create automations for Shift-Based Schedules, you need to:<br />><br />> 1. Update your automations to use the V3 API for all new shift-based schedules<br />> 2. Keep the V2 endpoint for your existing schedules<br />><br />> An upgrade tool for existing schedules is coming soon; your legacy schedules will keep working in the meantime. [Learn more](https:​//support.pagerduty.com/main/docs/shift-based-schedules-api-upgrade-examples).<br /><br />Delete a schedule and all associated rotations and events.<br /><br />If the schedule is referenced by an active escalation policy, the<br />deletion will be rejected.<br />

DELETE FROM pagerduty.schedules_v3.schedules
WHERE id = '{{ id }}' --required
;