Time tracking
The time tracking API provides endpoints to manage employee work hours through shifts and shift rates. Shifts record when employees work, including start times, end times, breaks, and compensation calculations. Shift rates define how different types of work are compensated based on hourly rates or multipliers.
Use the time tracking API to automate payroll calculations, maintain accurate work records, and ensure compliance with local labor regulations.
The time tracking API only works for Global Payroll employees. Independent contractors use timesheets to track their time. For more information, see Timesheets.
Overview
The time tracking API consists of two main resources:
Record employee work hours with detailed metadata including start times, end times, breaks, and approval dates.
Define compensation rules for different shift types using flat rates or percentage multipliers.
Prerequisites
Before using the time tracking API, ensure you have the following:
Contract ID
Shifts are linked to contracts. Retrieve contract IDs using the GET list of contracts endpoint.
Shift rates
Create shift rates before submitting shifts. Each shift must reference a valid shift rate for payroll calculations.
Authentication
All requests require a valid API token. Include it in the Authorization header as a Bearer token.
Key concepts
Payroll cycle processing
Shifts are processed and compensated at the end of each payroll cycle. Understanding the payroll cycle is essential for accurate time tracking:
- Shifts submitted for past payroll cycles are compensated in the current cycle
- The system does not validate whether shift dates fall within the current cycle
- Only unprocessed shifts can be updated or deleted
- Payroll cutoff dates can be configured in the Deel app
Compensation calculation
Shift compensation combines the employee base salary with the shift rate:
- Hourly contracts: Uses the hourly salary directly
- Non-hourly contracts: Calculates an equivalent hourly salary
- Total compensation:
Shift rate × Base salary × Total payable hours
Payable hours exclude unpaid breaks and include only approved work time.
Manage shifts
Shifts represent individual work periods for employees. Each shift includes timing information, break periods, and links to a shift rate for compensation calculations.
Create shifts
You can create multiple shifts for a single contract in one API call. Before creating shifts, ensure you have created the shift rates you want to reference.
Prepare shift data
Gather the contract ID, shift dates, work hours, break information, and the shift rate external ID.
Submit the request
Make a POST request to the Create a time tracking shift endpoint with your shift data.
Request parameters
The request body contains shift data organized into metadata and summary sections:
Shift object structure
Each shift in the array must include the following fields:
Required fields
Optional fields
Response
A successful response returns HTTP 200 with the created shift details:
List shifts
Retrieve all shifts in your organization with optional pagination. Results are sorted by creation time.
Make a GET request to the List time tracking shifts endpoint:
Query parameters
Retrieve a single shift
Retrieve detailed information about a specific shift using its external ID.
Make a GET request to the Retrieve a single time tracking shift endpoint:
Update a shift
Modify shift details for shifts that have not been processed for payroll. Once a shift is processed at the payroll cutoff date, it cannot be updated.
You can only update shifts that have not been processed for payroll. Shifts are processed for payroll at the cutoff date. Configure the cutoff date in the Deel app under payroll settings.
Make a PATCH request to the Update a time tracking shift endpoint:
Delete a shift
Remove a shift that has not been processed for payroll. Deletion is permanent and cannot be undone.
You can only delete shifts that have not been processed for payroll. Once processed at the payroll cutoff date, shifts cannot be deleted.
Make a DELETE request to the Delete a time tracking shift endpoint:
A successful deletion returns HTTP 204 with an empty response body.
Manage shift rates
Shift rates define compensation rules for different types of work. They specify how to calculate payment based on hours worked and employee base salary.
Shift rate types
The time tracking API supports two calculation methods:
Multiplier percentage
Flat rate
MULTIPLIER_PERCENTAGE: Multiplies the base hourly salary by a percentage factor.
Formula: Total amount = (MULTIPLIER_PERCENTAGE/100) × Base hourly salary × Total payable hours
Example: An employee with a base salary of $10/hour works a 5-hour shift with a 200% multiplier:
- Calculation:
2.0 × $10 × 5 = $100 - Total compensation: $100
Use cases:
- Overtime shifts (150% or 200% multiplier)
- Weekend work premiums
- Holiday compensation
Create a shift rate
Define shift rates before creating shifts. Each shift rate needs a unique external ID that you reference when creating shifts.
Request parameters
List shift rates
Retrieve all shift rates in your organization:
Retrieve a single shift rate
Get details for a specific shift rate using its external ID:
Update a shift rate
Modify shift rate details if the rate is not currently used in any shifts:
You can only update shift rates that are not assigned to any shifts. Once a shift rate is used, you must create a new rate with different values.
Delete a shift rate
Remove a shift rate that is not assigned to any shifts:
You can only delete shift rates that are not used in any shifts. Deletion is permanent and cannot be undone.
Best practices
Follow these guidelines to ensure accurate time tracking and payroll processing:
External ID management
- Use consistent naming conventions for external IDs across your system
- Include identifiable prefixes (e.g.,
shift_,rate_) to distinguish resource types - Store external IDs in your database to maintain mapping between systems
- Never reuse external IDs for different resources
Shift timing accuracy
- Verify all times are in the correct timezone for the employee location
- Use 24-hour format (HH:MM) for all time fields
- Ensure break periods fall within the shift start and end times
- Distinguish between paid and unpaid breaks based on local labor laws
Payroll cycle awareness
- Submit shifts before the payroll cutoff date for the current cycle
- Verify shifts have been created successfully before the cutoff
- Contact support if you need to modify processed shifts
- Configure payroll cutoff dates to align with your business processes
Rate calculation validation
- Test shift rate calculations in sandbox before production use
- Verify multiplier percentages produce expected compensation amounts
- Document which shift rates apply to different scenarios
- Review calculated payroll amounts before finalizing
Error handling
- Implement retry logic for temporary network failures
- Validate shift data client-side before API submission
- Log all API responses for troubleshooting
- Monitor for failed shift creations and resubmit as needed