Skip to content

Sync approved leave to an HRIS or payroll system

Payroll mistakes often start with a stale copy. Leave is approved in one system, then typed into another, and a later cancellation never reaches the second copy. The reliable pattern is to treat the leave system as the record of truth and let the HRIS or payroll system hold only approved leave, keyed by leave id.

How the sync works

A complete sync has two paths. A backfill loads approved leave for a date range and is run at the start and after any gap. Webhooks then report changes. The receiver does not trust the event type or arrival order. For each event it reads the current leave and makes the HRIS or payroll copy match: approved leave is created or updated by id, anything else is removed.

Choose the right tool

Use the REST API and webhooks when payroll depends on the copy, because that path supports past leave and recovery after downtime. Zapier suits small teams and simple flows where only new events matter. The MCP server is for asking questions by hand, not for keeping two systems in step.

What can change an approved leave

An approved leave is not final. A user who edits their own approved leave sends it back to OPEN for approval, and the receiver removes it while it waits. An administrator, the user's approver or a location admin can edit it and keep it APPROVED. Cancellations and deletions can also happen after leave was taken, which may require a correction if payroll is already closed. A leave type change is another reason to remap the pay code on every upsert.

Set up the API key and webhook

Create an administrator-owned key with leaves:read and users:read. Add leave-types:read to map pay codes, and webhooks:read and webhooks:write only if the webhook is created through the API. The key and webhook see only the people their owner can see, so choose an owner who will remain an administrator. A webhook is revoked if its owner loses the access it needs. Subscribe to the leave.* events and store the signing secret, which is shown once.

Map people and leave types

Match each user to an HRIS employee once. employeeId is the best key when it is set; email works when both systems share the same work email. Add expand=user to leave requests to read the user with the leave. Map each leaveTypeId to a pay code using the ID, not the name, because names can change.

Backfill approved leave

Start the webhook before the backfill so changes made during the load arrive as events; the upsert by id makes the overlap harmless. List leaves for the date range, page with nextToken until it is missing, and upsert every leave by id. The public contract module code0002 shows the request shape.

Handle each event safely

Every event carries the leave in data. Verify the signature, answer 200 within 10 seconds, and process afterwards. Skip an event whose id was already handled, because deliveries are at least once. For leave.deleted, remove the leave. For any other event, read the leave again: if it is APPROVED, upsert it; otherwise, or on 404, remove it. Reading again costs one request per event and keeps the result correct when events arrive out of order. Process events for the same leave one at a time, for example with a lock per leave id around the read and the write, and run the backfill through the same path. The public contract module code0003 shows the Node.js handler.

Read durations and part-day times

startDate and endDate are inclusive and use YYYY-MM-DD. durationWorkingDays is the working-day count and can be a fraction such as 0.5. durationCalendarDays includes weekends. isFullDayLeave is false for half-day and hourly leave, and the start and end hour and minute fields apply only then, in the person's time zone. For an hourly payroll, use the part-day times and the location's working hours for full days.

Catch up after downtime

Each delivery is retried for about 3 days. If the endpoint keeps failing, the webhook is paused and events from the pause onward are not delivered later. Watch the webhook status and lastDelivery, not only the endpoint. Fix the endpoint, resume the webhook, then run the backfill again over every period that may have changed. Upsert approved leaves and remove leaves that are no longer in the APPROVED list. For a few missed events, the delivery log can resend deliveries from the last 30 days. The date filters match leave dates, not change dates, so catch-up compares whole periods.

Zapier path

The Zapier app forwards leave events to connected apps, including HRIS and payroll tools that offer a Zapier app. A Zap fires on one trigger only, so covering the full lifecycle takes a set of Zaps: Leave Request Approved and New Leave Added create the absence; Leave Updated updates when status is APPROVED and otherwise removes it; Leave Cancelled and Leave Deleted remove it. Payloads include userEmail, leaveTypeName, workingDays and per-day hours in daysList. Use the leave id to find the absence again. Zapier sends new events only, has no backfill, and does not retry failed deliveries.

Worked example: a cancellation after payroll closed

Suppose an employee cancels two vacation days after the payroll period is closed. The leave system sends leave.cancelled. The receiver reads the leave, sees it is no longer APPROVED, and removes it from the HRIS copy. Because the period is closed, the payroll system records a correction in the next run rather than rewriting the closed period. This is the same failure the manual copy creates, but the sync catches it automatically.

Decision checklist

Use the REST API and webhooks when payroll must be exact, when past leave must be loaded, or when downtime recovery matters. Use Zapier when the team is small, only new leave matters, and a missed event is acceptable. Use MCP only to answer questions such as who was off in March. In every case, keep the API key and webhook secret in configuration or secrets, never in code.

Temporary error versus real removal

A 404 from the leave read means the leave is gone, so remove it. A temporary error such as a 5xx or a rate-limit response is different: do not remove the leave. Fail the event so the queue retries it. Treating a temporary failure as a removal would delete a valid absence and hide the real problem.

Tool choice by need
You want toUse
A reliable sync that also loads past leave and survives downtimeREST API v2 and webhooks
Apply your own logic without coding, sending new leave from now on to an HRIS that has a Zapier appZapier
Check a few leaves by hand, for example "who was off in March?"MCP server, by asking your AI assistant

Tool fit depends on whether past leave and downtime recovery are required.

API key scopes
ScopeWhy
leaves:readRead leaves
users:readMatch people to employees in your system
leave-types:readMap leave types to your pay codes
webhooks:read, webhooks:writeOnly if you create the webhook with the API instead of the dashboard

Use an administrator as the owner of the key and the webhook.

Webhook events
EventWhy it matters
leave.addedA manager added an approved leave, or a request was approved automatically
leave.approvedA request was approved. With multi-level approval, it is sent once, after the last level.
leave.updatedDates, times or leave type changed. The leave may no longer be approved.
leave.deniedA request was denied, including an edited leave that was sent back for approval
leave.cancelledAn open or approved leave was cancelled, also after it was taken
leave.deletedA manager deleted a leave. data has only id and userId.
leave.expiredA request expired without a decision, including an edited leave that was waiting for re-approval

The receiver reads the current leave on every event rather than trusting the event type.

Duration fields
FieldUse
startDate, endDateThe first and last day, in YYYY-MM-DD. Both are inclusive.
durationWorkingDaysWorking days the leave takes. A fraction for part-day leave, for example 0.5.
durationCalendarDaysCalendar days, weekends included
isFullDayLeavefalse for half-day and hourly leave
startHour, startMinute, endHour, endMinuteThe times of a part-day leave, in the person's time zone. Only when isFullDayLeave is false.

For an hourly payroll, combine part-day times with the location's working hours for full days.

Zapier triggers and actions
TriggerAction in your HRIS app
Leave Request ApprovedCreate the absence
New Leave AddedCreate the absence (a manager added an approved leave)
Leave UpdatedUpdate the absence when status is APPROVED, otherwise remove it (use a Paths or Filter step)
Leave CancelledRemove the absence
Leave DeletedRemove the absence

Zapier sends new events only and does not retry failed deliveries.

Frequently asked questions

How does PTO get into payroll?

A webhook fires when leave changes, and the sync writes approved leave into the payroll system, matched by employeeId or email. Payroll then pays it as PTO like any other entry.

What happens when an employee cancels approved leave?

The leave system sends leave.cancelled. The sync reads the leave, sees it is no longer APPROVED, and removes it from payroll. If the payroll period is already closed, correct it in the next run.

Can an approved leave change after it is approved?

Yes. Leave can be edited, cancelled or deleted. When an employee edits their own approved leave, it returns to OPEN and needs approval again. That is why the sync re-reads the leave on every event rather than acting on the event label alone.

Do I need to code this, or can I use Zapier?

Zapier handles simple flows through its leave triggers. It cannot load existing leave and does not retry failed deliveries, so pick the API when payroll accuracy is critical.

Does this sync leave balances too?

No. This guide covers approved leave only. Balances need a separate sync.

curl --get "$API_BASE_URL/v2/leaves" \
  --data-urlencode "startDate=2026-01-01" \
  --data-urlencode "endDate=2026-12-31" \
  --data-urlencode "limit=1000" \
  --data-urlencode "expand=user" \
  -H "Authorization: Bearer vt_live_..."