QHR Developers

Export payroll runs to Excel or CSV

GET/payroll/payrolls/export
Needs a read & write tokenExport Payslips, Payroll Runs, Loans, Deductions, Bonuses, Payments and Termination Packages to Excel/CSV exports/payroll_dataRequires feature payroll_runNot available in Claudepayroll_runs.export
  • It also needs: View payroll runs payroll_run/view

Builds a file of the company's payroll runs, newest first, one row per run and pay currency, with the columns you choose (reference, period, step, payment status, payslips, incomes, deductions, paid, due, pay date…) and a totals row per currency. It takes the same filters as payroll_runs.list.

When to use: to hand a year of payroll totals to finance or the auditors. To read the figures, payroll_runs.list is lighter; for one row per employee use payslips.export.

Prerequisites: column keys from payroll_runs.export_columns. You need "Export payroll data" as well as "View payroll runs" (x-permission.x-also).

Side effects: the export is recorded (it shows in exports.list) and in the audit log. Up to 10,000 rows the file comes back at once; above that it is built in the background (202) and QHR emails you when it is ready. One export of this page at a time per person; at most 20,000 rows. Returns a file, so it is not offered to Claude.

Not available in Claude: it returns a file, not JSON.

Before you call this

You will need ids that come from these operations:

Parameters

NameInTypeDescriptionExample
formatRequiredquerystringFile format: xlsx (Excel) or csv.
Allowed values: xlsx, csv
xlsx
columns[]Requiredqueryarray<string>Column keys, in file order, from the page's …export_columns operation.employee_no,employee_name
q[status_eq]querystringOnly runs at this step.
Allowed values: verify_info, verify_time, verify_earnings, verify_payments, pending_accounting, finalized
finalized
q[from_gteq]querystring (date)Period starts on or after this date.2026-01-01
q[to_lteq]querystring (date)Period ends on or before this date.2026-12-31
Accept-LanguageheaderstringLanguage of messages and translated labels. English when omitted.
Allowed values: ar, en
ar

Response

200 The file (`xlsx` or `csv`, as asked), named `QHR_<page>_<company>_<date>.<format>`.

Returns a file, not JSON: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

Errors

HTTPCodeMeaningHow to fix
400bad_formatformat is missing or is not xlsx or csv.Send format=xlsx or format=csv.
400no_columnsNo columns[] were sent.Send at least one column key from the page's …export_columns operation.
400unknown_columnA column key does not exist on this page, or your role may not see it.Use only keys returned by the page's …export_columns operation.
400bad_filtersA filter value is malformed.Send the same filters the page's list operation accepts.
401token_missingNo Authorization: Bearer … header, or it is malformed.Send Authorization: Bearer qhr_… with the full token.
401token_invalidThe token is unknown or wrong, or its owner's account is locked.Check the token was copied in full, or create a new one in QHR › Settings › API & Integrations.
401token_expiredThe token is past its expiry date.Create a new token.
401token_revokedThe token was revoked by its owner or an admin, or the owner was removed from the company (which revokes all their tokens).Create a new token, or ask your admin. If the owner was removed, they must be re-invited to the company first.
401tenant_inactiveThe company account is suspended.Contact QHR support.
403token_read_onlyThis token can only read; the operation makes changes.Use a token created with "Allow changes".
403forbiddenThe token owner's role lacks the permission this operation needs.Ask an admin to grant the permission shown on this operation (x-permission).
403employee_inactiveThe token owner's employee record is not active.HR must reactivate the employee record.
403tenant_access_revokedThe token's owner is no longer an active member of this company. Rare: removing a member normally revokes their tokens, which answers 401 token_revoked instead.The owner must be re-invited to the company, then create a new token. If the owner is still a member, contact QHR support.
409export_in_progressAn export of this page by the same person is still being built. export is that run.Wait for it: poll exports.show with export.id, then exports.download.
422no_dataNo record matches the filters, so there is nothing to export.Loosen the filters.
422too_largeThe file would have more than 20,000 rows. row_count and max_rows say by how much.Narrow the filters or the date range and export in parts.
This endpoint can also return the errors that can happen on any endpoint →402 / 412 / 425 entitlement_blocked · 429 rate_limited · 500 internal_error

See the full error catalogue →