Skip to main content

custom_shifts

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

Overview

Namecustom_shifts
TypeResource
Idpagerduty.schedules_v3.custom_shifts

Fields

The following fields are returned by SELECT queries:

Custom shift retrieved successfully

NameDatatypeDescription
idstring
assignmentsarrayExactly one assignment per custom shift
end_timestring (date-time) (example: 2025-03-15T17:00:00Z)
html_urlstring (uri)
selfstring (uri)
start_timestring (date-time) (example: 2025-03-15T09:00:00Z)
typestring (custom_shift)

Methods

The following methods are available for this resource:

NameAccessible byRequired ParamsOptional ParamsDescription
getselectid, custom_shift_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 />Retrieve a single custom shift by ID.<br />
listselectid, since, untiltime_zone, overflow, limit, 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 custom shifts for a schedule within a time range.<br /><br />since and until are required.<br />
createinsertid, custom_shifts<!-- 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 one or more custom shifts for a schedule. Custom shifts are<br />ad-hoc one-off coverage periods that exist outside of rotation events.<br /><br />Each custom shift requires exactly one assignment.<br />
updateupdateid, custom_shift_id, custom_shift<!-- 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 an existing custom shift.<br /><br />If the shift has already started, only end_time can be modified.<br />
deletedeleteid, custom_shift_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 custom shift by ID. When the shift is not started, it deletes the shift entirely. If the shift is already started, it sets the end_time to now. It returns Bad Request when shift is already ended.<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
custom_shift_idstringThe ID of the custom shift. (example: AGO4624VGZ44ZJDFTW5NSZ2CG4)
idstringThe ID of the schedule. (example: PSJUKNI)
sincestring (date-time)Start of time range (ISO 8601) (example: 2026-06-01T00:00:00Z)
untilstring (date-time)End of time range (ISO 8601) (example: 2026-06-28T23:59:59Z)
limitinteger
offsetinteger
overflowbooleanInclude shifts that extend beyond the requested time range boundaries
time_zonestringIANA timezone identifier for rendering shift times. Defaults to the schedule's configured time zone. (example: America/New_York)

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 single custom shift by ID.<br />

SELECT
id,
assignments,
end_time,
html_url,
self,
start_time,
type
FROM pagerduty.schedules_v3.custom_shifts
WHERE id = '{{ id }}' -- required
AND custom_shift_id = '{{ custom_shift_id }}' -- required
;

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 one or more custom shifts for a schedule. Custom shifts are<br />ad-hoc one-off coverage periods that exist outside of rotation events.<br /><br />Each custom shift requires exactly one assignment.<br />

INSERT INTO pagerduty.schedules_v3.custom_shifts (
custom_shifts,
id
)
SELECT
'{{ custom_shifts }}' /* required */,
'{{ id }}'
RETURNING
custom_shifts
;

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 an existing custom shift.<br /><br />If the shift has already started, only end_time can be modified.<br />

UPDATE pagerduty.schedules_v3.custom_shifts
SET
custom_shift = '{{ custom_shift }}'
WHERE
id = '{{ id }}' --required
AND custom_shift_id = '{{ custom_shift_id }}' --required
AND custom_shift = '{{ custom_shift }}' --required
RETURNING
custom_shift;

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 custom shift by ID. When the shift is not started, it deletes the shift entirely. If the shift is already started, it sets the end_time to now. It returns Bad Request when shift is already ended.<br />

DELETE FROM pagerduty.schedules_v3.custom_shifts
WHERE id = '{{ id }}' --required
AND custom_shift_id = '{{ custom_shift_id }}' --required
;