Query your payroll data with a single JSON report definition — run reports, export large result sets, save definitions, schedule recurring deliveries by email, and be told by webhook when a report is ready.
BetaThe Reports API is in beta. The contract is stable enough to build against, but endpoints and datasets may still change in response to feedback before general availability.
Report API overview
The Reports API lets you query your payroll data programmatically instead of downloading fixed reports. You describe the report you want as a single JSON report definition — which dataset, which columns, and how to filter, group, aggregate, and sort — and the same document drives everything the API can do: synchronous runs, large asynchronous exports, saved definitions, and recurring schedules.
Key concepts
- Report definition — the JSON document describing a report: the
dataset, 1–50selectentries, an optionalfilterstree,groupBy,orderBy, and alimit. One contract drives sync runs, exports, saved definitions, and schedules. - Run — one execution of a definition, in
SYNC,EXPORT, orSCHEDULEDmode. Every one is recorded in the history served byGET /runs.SYNCrows are kept for 90 days;EXPORTandSCHEDULEDrows have a file behind them and are kept indefinitely. - Export — an asynchronous CSV/JSONL run written to S3 (row cap 5,000,000); when complete the API returns a presigned download URL (12-hour expiry, refetch to re-issue).
- Schedule — a cron expression attached to a saved definition, with an output format and email recipients (
emailsas the To line, plus optionalccandbcc).
Reports on a pay run
Built-in reports (ids starting builtin., such as builtin.gross-to-net) and your saved reports can run over one pay run. GET /payroll-runs/{payrollConfigId}/{year}/{period}/{frequency}/reports/{definitionId}/rows reads a report over every payslip of the pay run (Preview, Final and Reopened), a page at a time: send the page's nextCursor as after for the next page. The first page also carries the run's row count and the total of each money column. POST .../reports/{definitionId}/run runs it in one call, and POST .../reports/run tries an unsaved definition on the pay run the same way.
A definition's runsOn says what it covers: payRun for the pay run it is opened from, or paySchedule for every pay run on that pay schedule, this tax year and the one before. Leave it out for a report run from its filters.
GET /report-settings/pay-run lists the reports your organisation shows on its pay runs, in order; until someone chooses, every built-in report. PUT /report-settings/pay-run sets that list, up to 30 reports, each once. The choice applies to everyone in the organisation.
Run history and audit
GET /runs returns this organisation's runs, most recent first, and is the audit trail for who read what.
mode—SYNC,EXPORTorSCHEDULED. Worth setting if you poll for an export: synchronous rows are far more numerous and would otherwise push the export you are waiting on off the first page.limit— defaults to 50, clamped to 200.requestedBy— the caller that started it, carrying the kind of principal with the identity:USER#…for a person,M2M#…for an API client, and the literalschedulerfor a run a schedule started. Null on runs made before the service recorded it.
A definition that fails validation (400) or is refused by the concurrency cap (429) is not recorded — neither reached your data. A run that times out (408) is.
Knowing a schedule is still delivering
GET /report-definitions/{definitionId}/schedules reports how each schedule's last report actually landed:
| Field | Meaning |
|---|---|
lastDeliveryStatus | DELIVERED or FAILED; absent until the schedule has fired once |
lastDeliveryAt | When that happened |
lastDeliveryError | What the recipient never got, and why |
consecutiveDeliveryFailures | Failures in a row, back to 0 on the first success |
consecutiveDeliveryFailures is the one to act on: one failure is a blip, a run of them is a dead endpoint, and a single timestamp cannot tell the two apart. A run that never produced a file records a FAILED delivery too, so a schedule can never show a stale success while its reports have been failing.
An email that is accepted and then refused is recorded here too. Handing the message to our email provider is not delivery: a suppressed address — one an earlier message bounced from, or that marked us as spam — is refused later and permanently. That comes back asynchronously, so lastDeliveryStatus can move from DELIVERED to FAILED minutes after the run finished. Treat a completed run as "the file exists", not "the recipient has it".
Poll this rather than waiting to hear that a report stopped arriving — nobody notices an email that does not turn up.
Being told a report is ready
Subscribe a webhook endpoint (see the Webhooks API) to report_export.completed and report_export.failed. Every export run sends one — a run a schedule started as much as one you queued with POST /exports — carrying the runId, mode (EXPORT or SCHEDULED), definitionId, scheduleId, format, status and rowCount. The event never carries a download link: its resourceUrl is GET /exports/{runId}, which answers your authenticated request with a fresh one. Route on scheduleId if you only want scheduled reports. Deliveries are signed, retried for about three days and logged like every other Flow Payroll webhook.
The schedule's own delivery.webhookUrl is deprecated since 1 October 2026 and stops being accepted as input on 30 December 2026. Until then a schedule that carries one still receives the legacy X-Flow-Signature POST exactly as before: an HMAC-SHA256 of the raw body with the webhookSecret returned once on creation, three attempts.
Limits
A single organisation may have 4 synchronous report runs in flight at once; beyond that POST /reports/run and POST /report-definitions/{id}/run return 429. Queue an export instead of retrying in a loop — exports are not subject to this limit.
