> ## Documentation Index
> Fetch the complete documentation index at: https://absentify.com/docs/llms.txt
> Use this file to discover all available pages before exploring further.

# Exports

> Use the absentify API to start an Excel, payroll, or leave balances export, then poll until the file is ready to download.

An administrator starts an export with `POST /exports`. The response is `202 Accepted` with a `Location` URL. Poll that URL with `GET /exports/{id}/file` until it returns `200` and the file. Send the API key on every request. It is not part of the `Location` URL.

Only an administrator can start or download an export. The REST API requires Plus. A period without absences produces a file.

The job also appears under **Recent exports** on [Settings > Export](/docs/en/roles/hr_admins/settings/export#recent-exports), with **via API** next to the requester. Any admin can select **Download** there when the file is **Ready**.

## Formats

Send `format` as one of these values. They match the formats on Settings > Export for a **Range**.

| `format` | File |
| - | - |
| `EXCEL` | **Allowances and absences (Excel)** |
| `PAYROLL_EXCEL` | **Absences for payroll (Excel)** |
| `PAYROLL_CSV` | **Absences for payroll (CSV)** |
| `LEAVE_BALANCE_EXCEL` | **Leave balances (Excel)** |

## Start an export

```bash theme={null}
curl -X POST "https://api.absentify.com/api/v1/exports" \
  -H "x-api-key: your_api_key_here" \
  -H "Content-Type: application/json" \
  -d '{"format":"EXCEL","start":"2026-01-01","end":"2026-01-31"}'
```

`start` is the first day. `end` is the last day, inclusive. Only the UTC date is used. The range may span at most **1826 days (5 years)**. Wider or inverted ranges return `400`.

Optional `department_id` limits the file to one department. Omit it for all departments. For `PAYROLL_CSV`, optional `csv_separator` is `comma` or `semicolon`.

Send the key as `X-API-KEY` or as `Authorization: Bearer <key>`. In a Power Automate HTTP action, set Authentication to Raw with `Bearer <key>`, so the same header is sent on the poll requests.

The JSON body of a `202` is `{ "id": "...", "status": "processing" }`. Poll the `Location` URL. Wait the number of seconds in `Retry-After` (15) between requests. If `POST /exports` returns `429`, see [API limits](./limits).

## Download the file

`GET /exports/{id}/file` uses the same credentials.

| Status | What to do |
| - | - |
| `202` | The export is running. Wait `Retry-After` seconds and request the same URL again. |
| `200` | Save the file. It remains available for 24 hours. |
| `422` | The export failed. See `error` in the JSON body. |
| `410` | The file has expired. Start a new export. |
| `404` | The export is unknown or older than 30 days. |
| `403` | Only an administrator can download the file. |


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.