🔹 Overview
This guide covers the end-to-end Paid Time Off (PTO) flow using the Time Off APIs. It includes:- Policy setup
- Policy assignment
- Employee request lifecycle
- Approval workflow
🔹 1. Create a Time Off Policy
Use addTimeOffPolicy to create a policy. Required base fields for policy creation:- companyId
- policyType
- policyName
- maxAccumulatedHours
- canCarryoverHours
- waitingPeriod
- whenTimeOffReceived (required for non-Unpaid Leave policies)
- earningMethod (required for non-Unpaid Leave policies)
- Lump Sum:
- lumpSumHoursEarned is required.
- Accrual:
- accrualRatePerHour is required.
- proratedByStartDate is required.
- If canCarryoverHours is true, maximumCarryoverHours is required.
🔹 2. Update an Existing Policy
Use updateTimeOffPolicy when you need to adjust a policy.- Include timeOffPolicyId.
- If updating earningMethod, include the required conditional fields for that method in the same request.
🔹 3. Assign a Policy to an Employee
Use addTimeOffPolicyAssignment to assign a policy. Inputs:- companyId
- timeOffPolicyId
- userId
🔹 4. Employee Submits a PTO Request
Use addTimeOffRequest. Inputs:- companyId
- userId
- timeOffPolicyId
- startDate
- endDate
- requestReason
🔹 5. Employee Cancels or Deletes a Request
Use cancelTimeOffRequest and deleteTimeOffRequest for different lifecycle scenarios.When to use cancelTimeOffRequest
- Use this when a request has already been approved and needs to be reversed.
- This keeps the request in history and changes status to
Cancelled.
When to use deleteTimeOffRequest
- Use this when a request is still pre-approval and should be removed from active workflows.
- Approved requests cannot be deleted; use
cancelTimeOffRequestinstead.
⚠️ Quick Rule
- Approved request: cancel it.
- Pending/denied draft-style request you want removed: delete it.
🔹 6. Approve a PTO Request
Use approveTimeOffRequest to approve or change request status. 📝 Note: SendisApproved: false in approveTimeOffRequest to deny a PTO request.
📝 End-to-End Sequence
- Create policy (addTimeOffPolicy)
- Assign policy (addTimeOffPolicyAssignment)
- Employee submits request (addTimeOffRequest)
- Admin reviews/approves (approveTimeOffRequest)
