Export payroll runs to Excel or CSV
/payroll/payrolls/exportexports/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
| Name | In | Type | Description | Example |
|---|---|---|---|---|
formatRequired | query | string | File format: xlsx (Excel) or csv.Allowed values: xlsx, csv | xlsx |
columns[]Required | query | array<string> | Column keys, in file order, from the page's …export_columns operation. | employee_no,employee_name |
q[status_eq] | query | string | Only runs at this step. Allowed values: verify_info, verify_time, verify_earnings, verify_payments, pending_accounting, finalized | finalized |
q[from_gteq] | query | string (date) | Period starts on or after this date. | 2026-01-01 |
q[to_lteq] | query | string (date) | Period ends on or before this date. | 2026-12-31 |
Accept-Language | header | string | Language 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
| HTTP | Code | Meaning | How to fix |
|---|---|---|---|
| 400 | bad_format | format is missing or is not xlsx or csv. | Send format=xlsx or format=csv. |
| 400 | no_columns | No columns[] were sent. | Send at least one column key from the page's …export_columns operation. |
| 400 | unknown_column | A 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. |
| 400 | bad_filters | A filter value is malformed. | Send the same filters the page's list operation accepts. |
| 401 | token_missing | No Authorization: Bearer … header, or it is malformed. | Send Authorization: Bearer qhr_… with the full token. |
| 401 | token_invalid | The 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. |
| 401 | token_expired | The token is past its expiry date. | Create a new token. |
| 401 | token_revoked | The 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. |
| 401 | tenant_inactive | The company account is suspended. | Contact QHR support. |
| 403 | token_read_only | This token can only read; the operation makes changes. | Use a token created with "Allow changes". |
| 403 | forbidden | The token owner's role lacks the permission this operation needs. | Ask an admin to grant the permission shown on this operation (x-permission). |
| 403 | employee_inactive | The token owner's employee record is not active. | HR must reactivate the employee record. |
| 403 | tenant_access_revoked | The 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. |
| 409 | export_in_progress | An 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. |
| 422 | no_data | No record matches the filters, so there is nothing to export. | Loosen the filters. |
| 422 | too_large | The 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. |
entitlement_blocked · 429 rate_limited · 500 internal_error