---
title: Exporting absences to payroll
description: Turn a month of approved leave into a payroll import file - the absence CSV, leave-type codes and a copy-paste agent prompt
order: 7
---

A payroll handoff is three columns - who, which absence code in the payroll system's own
vocabulary, and how many days fall inside the month. SquadBear produces those figures as a
CSV download or over MCP.

## The monthly numbers

**Reports → Leave → Absence** is the source; [Leave reports](/docs/leave/reports/) covers the
report and its CSV. Two properties matter for payroll:

- **Approved only.** Pending requests never appear. Run the export once the month's
  approvals have settled; an agent can list the pending requests that overlap the month.
- **The month boundary is exact.** Leave is counted per date, so Tomasz's vacation of
  28 July – 7 August 2026 lands 4 working days in Northlake's July file and the remaining
  5 in August's.

Amounts are working days against each person's own schedule: a half day shows as 0.5, and a
week off for someone on a four-day week counts 4. Minutes are the canonical amount and the
CSV rounds every day figure to two decimals. Where payroll works in hours, read the report as
JSON - each row carries `totalMinutes`, `byTypeMinutes` and that person's `dailyNormMinutes`.

## Leave type codes

Every leave type carries a short code - **Workspace settings → Leave policies** shows it at
the head of the category's actions menu, and read-only in **Edit category**. A fresh
workspace ships with Vacation (`PTO`), Sick leave (`SICK`) and Unpaid leave (`UNPAID`). The
code is fixed for the life of the category, so exports and integrations can refer to it. Map
each type onto its payroll code once - `PTO → UW`, `SICK → ZLA` in a Polish setup - and keep
the mapping where the export happens: the accountant's runbook, or the agent prompt below.
The CSV heads its columns with the type's name; the code is what `list_leave_types` and
`GET /api/v1/leave-types` return.

## For agents

A connected agent ([Connect Claude to SquadBear](/docs/getting-started/connect-an-agent/))
pulls the same figures and applies the mapping in one message. The prompt below runs
`absence_summary`, which covers the whole tenant for an admin and managed people only for a
manager.

> [!AGENT]
> Pull approved absences for last month for the whole company and give me CSV text I can
> save as a file: one row per person per leave type, columns employee, code, days. Map the
> leave types to payroll codes as follows: Vacation → UW, Sick leave → ZLA, Unpaid
> leave → NB. Flag anyone whose rows don't add up to their total.

When payroll needs date ranges rather than monthly totals - sick-leave documentation, say -
`get_absence_calendar` returns each request's full range alongside a per-day grid, over a
window of at most 92 days. For scheduled pulls, `GET /api/v1/reports/absence-summary` serves
the same aggregate to an API key with the `reports:read` scope
([the developer API](/docs/agents/api/)).

## Export properties

- **Late approvals.** A sick leave approved after the cutoff lands in the next export; a
  re-run of the previous month alongside the current one shows the difference in totals.
- **Row totals reconcile.** A row's per-type columns sum to `totalDays`, up to two-decimal
  rounding.
- **Reasons stay private.** The export carries types and day counts, never a request's
  reason or its attachments.

## Related

- [Leave reports - absence, liability and Bradford](/docs/leave/reports/)
- [How leave works in SquadBear](/docs/leave/concepts/)
- [Prompts to run through your connected agent](/docs/agents/recipes/)
