How It Works

This topic provides an overview of the Labor API object model and call flows.

Link to section

Key functions of the Labor API

The Labor API enables the following key functions:

Other Labor API functions include the following:

  • Define a workweek for use in overtime calculations.
  • Create break types to define the name, duration, and paid status of a set of standard shift breaks.

To learn more about the features of the Labor API, see What It Does.

Link to section

Labor API object model

The Labor API provides primary data types used to capture shift start and end times, breaks taken, and the shift wage.

TypeDescription
ShiftA record of a team member's work period in a given day, which includes breaks, the hourly pay rate, and declared cash tips.
ShiftWageThe team member's job title, hourly rate, and tip eligibility for a shift. This object is embedded in the Shift.wage field and represents a snapshot of the team member's hourly rate at the time a shift is completed.
TeamMemberWageWage details (such as job title, hourly rate, and tip eligibility) that define how much a team member earns for a specific job. This object can be used to populate the wage for a shift. It captures the straight or computed hourly rate of a job assignment in the team member's WageSetting.
BreakRecords the start and end times for a break taken during a shift. These objects are embedded in the Shift.breaks field.
BreakTypeDefines the titles, expected durations, and paid status of breaks allowed at a location. This information can be used to standardize the breaks for a shift.

The following diagram shows the relationship between Shift, ShiftWage, Break, BreakType, TeamMemberWage, and TeamMember resources.

A diagram showing the relationship between objects that contribute to a shift record.

Link to section

Team members

The Labor API works with the Team API by assigning a TeamMember to a Shift. To use the Labor API, complete the following team member related tasks in the Square Dashboard:

  • Add location-specific salaried, hourly, or volunteer team members to a Square account.
  • Set timezone information for each business location. A location's timezone field can also be set using the Locations API.
  • Optionally, set hourly or annual wages for team members based on their job titles. If wage settings aren't assigned to a team member, shifts can still be recorded but wage hourly rates must be obtained from another source and then recorded in a shift.
Link to section

Labor API process flows

A client application, such as a virtual time clock in a restaurant POS application, completes process flows to start a shift, record breaks, and end a shift at the restaurant.

Note

The following process flows refer to open shifts. An open shift is a shift that a team member started but didn't end. This can happen when a team member doesn't clock out at the end of the previous shift, leaving it open.

Link to section

Step 1: Start a shift

A bartender uses the POS in the restaurant bar to start a shift:

  1. The time clock gets a list of team members by location and allows selection from the list.
  2. The time clock queries for an open shift for the selected team member. If an open shift is found, it must be closed before a new open shift can be created.
  3. The time clock gets a list of TeamMemberWage objects for the selected team member and chooses a wage rate for a shift based on the selected TeamMemberWage. For example, a team member is working as a bartender today and is paid the hourly rate for a bartender for the shift. Tomorrow, the team member might work as a cashier with a different hourly rate.
  4. The time clock sends a request to create a new shift associated with a business location, team member, hourly wage, and date/time stamp when the team member starts the shift.

Note

Field values set in the ShiftWage should come from a TeamMemberWage record. Optionally, the values can be set using values from another source such as a personnel datastore from another application.

The new shift is used to record any breaks that are taken during the work shift and record the end time of the shift.

Link to section

Step 2: Record a break on a shift

After starting a shift, the bartender takes a dinner break and uses the POS device at the front cashier station to record the dinner break and order a meal:

  1. The time clock gets a list of team members by location and lets the bartender choose their name.
  2. The time clock gets the open shift created in the previous process flow (Step 1: Start a shift).
  3. The time clock reads the state of any breaks that might have been recorded during the shift.
    • If there is an open break, it's closed by setting the Break.end_at field.
    • If there are no open breaks, a new break is created.
  4. The time clock creates and sends an update request with the updated shift to replace the current shift.

At the end of the break, the bartender ends the break from the bar POS device.

Link to section

Step 3: End a shift

The bartender uses the bar POS device to end the shift.

  1. The time clock gets a list of team members by location and lets the bartender choose their name.
  2. The time clock gets the shift created in the previous process flow (Step 1: Start a shift) by querying for the open shift for the selected team member.
  3. The time clock reads the state of any breaks that might have been recorded during the shift and closes any open breaks.
  4. The time clock sets the Shift.end_at field to close the shift.
  5. The time clock creates and sends an update request with the updated shift to replace the current shift.

Note

Declared cash tips for a shift can also be recorded using the declared_cash_tip_money field.

Link to section

Shift reporting endpoints

The Labor API includes several reporting endpoints:

  • SearchShifts - This endpoint is used to export historic shift data such as a week's worth of shifts from a Square account to a reporting or payroll application. The endpoint allows flexible filtering and sorting with the use of a ShiftQuery object provided in the body of the POST.
  • ListTeamMemberWages - This endpoint returns all the wage levels assigned to a given team member.
  • ListBreakTypes - This endpoint returns all the break templates for a given location or all of a seller's locations.
Link to section

Timecard management concepts

The Labor API includes timecard management concepts:

  • Team member - A person who works for a seller as an employee, contractor, or volunteer and whose work hours must be tracked for payroll applications.

  • Shift - The new canonical title for a time card.

  • Break - Either paid or unpaid time that a person isn't expected to be doing work during a shift.

  • Workweek - A payroll-specific and accounting-specific definition of the start of a week. It can be arbitrarily defined by the business owner. For many businesses (that are closed on weekends), Sunday night at midnight is the default. Businesses such as late night bars and clubs are open during these hours. They might shift the day or the time that a workweek starts (such as to Tuesday night at 4 AM). Overtime rules and pay periods follow the cadence of these defined workweeks.

  • Workday - 24-hour increments starting on the first minute of a new workweek. If the workweek starts at 4 AM, then every workday starts and ends at 4 AM.

Link to section

Labor API optimistic concurrency

The Labor API uses optimistic concurrency to ensure that write operations on Labor API resources are reliable when multiple endpoints might write the same Labor API resources at the same time.

Link to section

See also