Find problems and solutions related to opening shifts, adding breaks, and closing shifts using the Labor API.
Labor API

Troubleshoot the Labor API

Find problems and solutions related to opening shifts, adding breaks, and closing shifts using the Labor API.

Square's error response says that the new Shift overlaps other shifts for a team member who has no other shifts on this day.

Cause

The team member has an open shift from a previous day that needs to be closed.

Solution

Find the previous shift and verify that the end_at field is null or missing. Close the shift by setting an end_at value and sending an UpdateShift request for the shift to be closed.

When checking for an open shift, use code like the following example and provide the ID of the team member associated with the open shift:

Search Shifts
  • 1
  • 2
  • 3
  • 4
  • 5
  • 6
  • 7
  • 8
  • 9
  • 10
  • 11
  • 12
  • 13
  • 14
  • 15
curl https://connect.squareupsandbox.com/v2/labor/shifts/search \
  -X POST \
  -H 'Square-Version: 2023-05-17' \
  -H 'Authorization: Bearer ACCESS_TOKEN' \
  -H 'Content-Type: application/json' \
  -d '{
    "query": {
      "filter": {
        "status": "OPEN",
        "team_member_ids": [
          "{A_TEAM_MEMBER_ID}"
        ]
      }
    }
  }'

The response to the shift search request is an empty object if the team member does not have an OPEN shift:

Cause

A new idempotency key was not generated for this operation.

Solution

Generate a new idempotency key and retry the operation.

There are no overlapping shifts for the employee and the body of the close request is formed correctly.

Cause

The Shift to be closed has an open Break.

Solution

Iterate the Break objects in the shift. When a Break with no end_at property is found, set the property to the current time.

Cause

A filter field is invalid (REST only) or an enum value is invalid (REST and SDK). When the search endpoint receives a filter field or enum value it does not recognize, the related filter criteria is ignored.

Solution

Enums and JSON field names are case-sensitive. Confirm that the field name is correct and lowercase (REST) and the provided enum values match their definition in the Technical Reference.

We've made improvements to our docs.
Prefer the old format?