QHR Developers

Export the employees list as Excel or CSV

GET/employees/export
Needs a read & write tokenExport Employees, Documents, Leaves and Attendance lists to Excel/CSV exports/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

NameInTypeDescriptionExample
formatRequiredquerystringFile format: xlsx (Excel) or csv.
Allowed values: xlsx, csv
xlsx
columns[]Requiredqueryarray<string>Column keys from employees.export_columns, in the order wanted. At least one.employee_no,employee_name,department
q[employee_name_cont]querystringName contains (English or Arabic).Sara
q[employment_status_eq]querystringOnly this employment status.
Allowed values: active, notice_period, inactive
active
q[department_id_eq]queryintegerOnly this department (id from employees.meta_data).4
q[location_id_eq]queryintegerOnly this main work location (id from employees.meta_data).2
q[assigned_location_id]queryintegerOnly employees who may check in at this location, as main or additional location.2
q[manager_id_eq]queryintegerOnly the direct reports of this employee id (from employees.managers).88
q[portal_access_eq]querystringOnly this QHR login status.
Allowed values: not_invited, pending, activated, cancelled, expired
activated
q[employee_no_cont]querystringEmployee number contains.E-01
q[job_title_cont]querystringJob title contains.Accountant
q[email_cont]querystringEmail contains.@example.com
q[s]querystringRow order, <field> asc|desc, e.g. first_name asc. Newest first when omitted.first_name asc
filter_labels[]queryarray<string>Human descriptions of the filters, printed on the file's info sheet (at most 50).Department: Finance
Accept-LanguageheaderstringLanguage 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

HTTPCodeMeaningHow to fix
400bad_formatformat is missing or is not xlsx or csv.Send format=xlsx or format=csv.
400no_columnsNo column was sent in columns[].Send at least one key from employees.export_columns.
400unknown_columnA column in columns[] is not one employees.export_columns offers you.Use only keys returned by employees.export_columns.
400bad_filtersA q[...] filter value cannot be used.Check the filter values (ids are numbers, statuses come from the listed values).
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_progressThis 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.
422no_dataThe filters match no employee.Loosen the filters.
422too_largeMore than 20,000 rows; row_count and max_rows say by how much.Narrow the filters 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 →