QHR Developers

Export the loan queue to Excel or CSV

GET/hr_loans/export
Needs a read & write tokenExport Payslips, Payroll Runs, Loans, Deductions, Bonuses, Payments and Termination Packages to Excel/CSV exports/payroll_dataRequires feature loanNot available in Claudehr_loans.export
  • It also needs: View all employees' loans loan/view_others

Builds a file of the company's loans, newest submitted first, one row per loan, with the columns you choose (reference, employee, status, channel, currency, amount, needed date, payout and repayment dates, settlement amount…) and a total of the amounts per currency. It holds the same loans as hr_loans.list with the same q[…] filters.

When to use: to hand the loan book to finance or to archive it. To read loans, hr_loans.list is lighter.

Prerequisites: column keys from hr_loans.export_columns. You need "Export payroll data" as well as "View all employees' loans" (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 this status, as in hr_loans.list.approved
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 →