Skip to main content

rotations

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

Overview

Namerotations
TypeResource
Idpagerduty.schedules_v3.rotations

Fields

The following fields are returned by SELECT queries:

Rotation retrieved successfully

NameDatatypeDescription
idstring (example: ABCDEFGHIJKLMNOPQRSTUVWXY2)
eventsarrayEvents in this rotation
html_urlstring (uri)
selfstring (uri)
typestring (schedule_rotation)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectid, rotation_idsince, until<!-- 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 rotation by ID including all its events.<br />
listselectidlimit, offset<!-- 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 all rotations for a schedule.<br />
createinsertid<!-- 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 empty rotation for a schedule. After creating a rotation,<br />add events to define the on-call pattern.<br /><br />Note: Rotations have no configuration of their own — all scheduling<br />logic (recurrence, assignment strategy, members) is specified on events.<br />The request body must be empty or &#123;&#125;.<br />
deletedeleteid, rotation_id<!-- 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 rotation and all its events.<br /><br />On deletion, past events are preserved in the audit history, the current<br />active event is truncated to the deletion time, and future events are<br />removed.<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)
rotation_idstringThe ID of the rotation. (example: AGO462IDT5ZMNFBVSROUDT6B4M)
limitinteger
offsetinteger
sincestring (date-time)Start of time range (ISO 8601) (example: 2025-01-01T00:00:00Z)
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 rotation by ID including all its events.<br />

SELECT
id,
events,
html_url,
self,
type
FROM pagerduty.schedules_v3.rotations
WHERE id = '{{ id }}' -- required
AND rotation_id = '{{ rotation_id }}' -- required
AND since = '{{ since }}'
AND until = '{{ until }}'
;

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 empty rotation for a schedule. After creating a rotation,<br />add events to define the on-call pattern.<br /><br />Note: Rotations have no configuration of their own — all scheduling<br />logic (recurrence, assignment strategy, members) is specified on events.<br />The request body must be empty or &#123;&#125;.<br />

INSERT INTO pagerduty.schedules_v3.rotations (
id
)
SELECT
'{{ id }}'
RETURNING
rotation
;

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 rotation and all its events.<br /><br />On deletion, past events are preserved in the audit history, the current<br />active event is truncated to the deletion time, and future events are<br />removed.<br />

DELETE FROM pagerduty.schedules_v3.rotations
WHERE id = '{{ id }}' --required
AND rotation_id = '{{ rotation_id }}' --required
;