Download the Documents list as Excel or CSV
/documents/exportexports/hr_dataRequires feature documentNot available in Claudedocuments.export- It also needs: View own documents
document/view
Builds a spreadsheet of the same documents documents.list returns for the same filters — documents with an expiry date, latest version only — with the columns you pick. Choose the file type with format=xlsx (Excel) or format=csv.
When to use: to hand HR or a government-relations officer a file of expiring or expired documents. For questions about a few documents, documents.list is lighter.
Prerequisites: at least one column key from documents.export_columns in columns[]. Needs the HR data export permission as well as viewing documents. You only get the employees you can see.
Side effects: each attempt is recorded in your exports history and the audit log. Up to 10,000 documents the file comes straight back; above that the answer is 202 and the file is built in the background and emailed to you when ready. At most 20,000 rows, and one Documents export at a time per person. Not offered to Claude: it returns a file, not JSON.
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 from documents.export_columns, in the order you want them. Repeat the parameter for each column. | employee_name,title,expiry_date,expiry_state |
q[employee_name_cont] | query | string | Employee's name contains. | Layla |
q[expiry_date_gteq] | query | string (date) | Expires on or after this date. | 2027-03-01 |
q[expiry_date_lteq] | query | string (date) | Expires on or before this date. | 2027-03-31 |
q[expiry_date_gt] | query | string (date) | Expires after this date. | 2027-03-01 |
q[expiry_date_lt] | query | string (date) | Expires before this date (today's date: the expired ones). | 2027-02-27 |
q[verified_eq] | query | boolean | Verified (true) or not yet verified (false) only. | false |
q[s] | query | string | Row order, <field> asc|desc (as in documents.list). Newest upload first when omitted. | expiry_date asc |
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 with `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[] was sent. | Send at least one key from documents.export_columns. |
| 400 | unknown_column | A column key is not one of documents.export_columns. | Use only the keys documents.export_columns returns. |
| 400 | bad_filters | A filter value (q[...]) cannot be read. | Send dates as YYYY-MM-DD and sorts as <field> asc|desc. |
| 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 | Your previous Documents export is still being built; export describes it. | Wait for its email, then export again. |
| 422 | no_data | No document matches the filters. | Widen or remove the filters. |
| 422 | too_large | More than 20,000 rows; row_count and max_rows give the numbers. | Narrow the filters, e.g. a shorter expiry date range. |
entitlement_blocked · 429 rate_limited · 500 internal_error