Applies to: Labor API | Team API | Locations API
Use the Labor API to search and retrieve scheduled shifts with flexible filtering options.
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 byTimecard
.
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.
To retrieve a specific scheduled shift, call RetrieveScheduledShift and provide the shift ID.
Retrieve scheduled shift
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.
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_status | Returns 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_ids | Returns shifts for the specified locations. When omitted, it returns shifts for all locations. If needed, call ListLocations to get location IDs. |
scheduled_shift_statuses | Returns 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. |
start | Returns shifts whose start_at time is within the specified time range (inclusive). |
end | Returns shifts whose end_at time is within the specified time range (inclusive). |
team_member_ids | Returns 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. |
workday | Returns 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 |
---|---|
field | The field to sort by. Valid values are START_AT (default), END_AT , CREATED_AT , or UPDATED_AT . |
order | The sort order. Valid values are DESC (default) or ASC . |
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:
Component | Description |
---|---|
date_range | Specifies the start_date and end_date of the date range to match against. |
match_shifts_by | Controls how shifts are matched against the date range. Valid values:
|
default_timezone | The 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. |
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.
- Using
Shift status and assignment status:
- The
scheduled_shift_statuses
filter affects which shift details are checked:DRAFT
- Evaluatesdraft_shift_details
(includes unpublished shifts and shifts with modified drafts).PUBLISHED
- Evaluatespublished_shift_details
.DRAFT
andPUBLISHED
(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 theDRAFT
status filter.
- The
Date range filters:
- The
start
andend
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.
- The
The following example finds all published shifts that start during a specific time window at the specified location:
Search scheduled shifts
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