Export the employees list as Excel or CSV
/employees/exportexports/hr_dataRequires feature employeeNot available in Claudeemployees.export- It also needs: View employees directory
employee/view_employee
Builds a file of the employees list with the chosen columns and the same filters as employees.list, in the format named by format (xlsx for Excel or csv; required). Up to 10,000 employees the file comes back straight away; above that (up to 20,000) the export is queued and the answer is 202 with the export record, and the file is emailed and listed in My exports when ready.
When to use: to hand someone a spreadsheet of employees. To read employees as data, use employees.list.
Prerequisites: column keys from employees.export_columns; filter ids from employees.meta_data and employees.managers. One export of this list per user may run at a time.
Side effects: every attempt past the format and column checks (refused ones included) is recorded in My exports and in the audit log (who exported what, with which filters). 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 employees.export_columns, in the order wanted. At least one. | employee_no,employee_name,department |
q[employee_name_cont] | query | string | Name contains (English or Arabic). | Sara |
q[employment_status_eq] | query | string | Only this employment status. Allowed values: active, notice_period, inactive | active |
q[department_id_eq] | query | integer | Only this department (id from employees.meta_data). | 4 |
q[location_id_eq] | query | integer | Only this main work location (id from employees.meta_data). | 2 |
q[assigned_location_id] | query | integer | Only employees who may check in at this location, as main or additional location. | 2 |
q[manager_id_eq] | query | integer | Only the direct reports of this employee id (from employees.managers). | 88 |
q[portal_access_eq] | query | string | Only this QHR login status. Allowed values: not_invited, pending, activated, cancelled, expired | activated |
q[employee_no_cont] | query | string | Employee number contains. | E-01 |
q[job_title_cont] | query | string | Job title contains. | Accountant |
q[email_cont] | query | string | Email contains. | @example.com |
q[s] | query | string | Row order, <field> asc|desc, e.g. first_name asc. Newest first when omitted. | first_name asc |
filter_labels[] | query | array<string> | Human descriptions of the filters, printed on the file's info sheet (at most 50). | Department: Finance |
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).
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 column was sent in columns[]. | Send at least one key from employees.export_columns. |
| 400 | unknown_column | A column in columns[] is not one employees.export_columns offers you. | Use only keys returned by employees.export_columns. |
| 400 | bad_filters | A q[...] filter value cannot be used. | Check the filter values (ids are numbers, statuses come from the listed values). |
| 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 | This user already has an employees export queued or being built; export is that export. | Wait for that export to finish (My exports), then try again. |
| 422 | no_data | The filters match no employee. | Loosen the filters. |
| 422 | too_large | More than 20,000 rows; row_count and max_rows say by how much. | Narrow the filters and export in parts. |
entitlement_blocked · 429 rate_limited · 500 internal_error