Retrieve Scheduled Shifts

Applies to: Labor API | Team API | Locations API

Use the Labor API to search and retrieve scheduled shifts with flexible filtering options.

Link to section

Overview

Applications can use the Labor API to search and retrieve scheduled shifts. You can search shifts using various filters, including date ranges, locations, team members, assignment status, and published status.

Note

The Labor API defines two types of shifts; be careful not to confuse them:

  • A ScheduledShift is used to manage team schedules.
  • A Shift is used for payroll time tracking. Shift is deprecated and replaced by Timecard.
Link to section

Requirements and limitations

The following requirements and limitations apply when retrieving scheduled shifts using the Labor API.

  • Square API version - Square API version 2025-05-21 or later is required to access or manage scheduled shifts.

  • Valid access token - Square API requests require an Authorization header with a bearer access token. The examples in this topic use the Square Sandbox, so you can test using your Sandbox access token.

    Applications using OAuth access tokens to authorize requests typically require the following permissions when working with team schedules:

    • MERCHANT_PROFILE_READ to retrieve location information.
    • EMPLOYEES_READ to retrieve team member and job information.
    • TIMECARDS_READ to retrieve scheduled shifts.
    • TIMECARDS_WRITE to create, update, and publish scheduled shifts.

    To call Square APIs in the production environment, change the base URL to https://connect.squareup.com and use your production (personal) access token.

Link to section

Retrieve a specific shift

To retrieve a specific scheduled shift, call RetrieveScheduledShift and provide the shift ID.

Retrieve scheduled shift

Link to section

Search scheduled shifts

To search for scheduled shifts, call SearchScheduledShifts with optional filter and sort settings. By default, results are sorted by start_at in ascending order.

To list all scheduled shifts, call SearchScheduledShifts without any filters:

Search scheduled shifts

Use the optional limit field to control the page size (default 50, maximum 50) and the cursor field to page through the results. For more information, see Pagination.

Link to section

Filter and sort options

The following filter options can be used in a search query. Multiple filters in a query are combined as an AND operation, which means shifts must match all specified filters to be included in the results. For information about how some filters interact, see Filter combinations.

Field Description
assignment_statusReturns shifts based on whether the team_member_id field is populated in the draft or published shift details. Valid values are ASSIGNED or UNASSIGNED. When omitted, it returns shifts with both statuses.
location_idsReturns shifts for the specified locations. When omitted, it returns shifts for all locations. If needed, call ListLocations to get location IDs.
scheduled_shift_statusesReturns shifts based on the draft or published status of the shift. A published shift has published_shift_details. Draft shifts either don't have that field or it differs from the draft details. Valid values are DRAFT or PUBLISHED. When omitted, it returns shifts with both statuses.
startReturns shifts whose start_at time is within the specified time range (inclusive).
endReturns shifts whose end_at time is within the specified time range (inclusive).
team_member_idsReturns shifts assigned to the specified team members. When omitted, it returns all assigned and unassigned shifts. If needed, call SearchTeamMembers to get team member IDs.
workdayReturns shifts based on a workday date range. For more information, see Workday filter.

Use the following fields to sort the query. By default, results are sorted by START_AT and ASC.

Field Description
fieldThe field to sort by. Valid values are START_AT (default), END_AT, CREATED_AT, or UPDATED_AT.
orderThe sort order. Valid values are DESC (default) or ASC.
Link to section

Workday filter

The workday filter provides a way to search scheduled shifts using YYYY-MM-DD calendar dates. You define whether to match shifts based on their start time, their end time, or either their start time or end time.

"query": { "filter": { "workday": { "match_shifts_by": "START_AT", "date_range": { "start_date": "2024-10-14", "end_date": "2024-10-27" } } } }

This filter has three components:

ComponentDescription
date_rangeSpecifies the start_date and end_date of the date range to match against.
match_shifts_byControls how shifts are matched against the date range. Valid values:
  • START_AT - Match shifts that start within the date range.
  • END_AT - Match shifts that end within the date range.
  • INTERSECTION - Match shifts that start or end within the date range.
default_timezoneThe time zone to use for date matching, in IANA format (for example, "America/Los_Angeles"). Required if the shift location doesn't define a time zone.
Link to section

Filter combinations

When combined in a query, certain filters might interact in ways that aren't immediately apparent. Understanding the interactions between the following combinations can help you create more effective queries:

  • Team member and assignment status:

    • Using team_member_ids alone returns shifts for the specified team members plus all unassigned shifts.
    • Add assignment_status: "ASSIGNED" to only get shifts assigned to the specified team members.
  • Shift status and assignment status:

    • The scheduled_shift_statuses filter affects which shift details are checked:
      • DRAFT - Evaluates draft_shift_details (includes unpublished shifts and shifts with modified drafts).
      • PUBLISHED - Evaluates published_shift_details.
      • DRAFT and PUBLISHED (default) - Evaluates both sets of details.
    • The assignment status is evaluated against the specified shift details.
    • Shifts marked for deletion (is_deleted: true) are ignored with the DRAFT status filter.
  • Date range filters:

    • The start and end filters use exact timestamps.
    • The workday filter uses calendar dates and can match shifts based on different criteria.
    • When both are specified, shifts must match both conditions.
Link to section

Example: Published shifts at a specified location and date range

The following example finds all published shifts that start during a specific time window at the specified location:

Search scheduled shifts

Link to section

Example: Workday matching START_AT

The following example gets all published and assigned shifts on the specified date at the specified location, matching shifts based on their start time:

Search scheduled shifts

Link to section

See also