QHR Developers

Download the custody list as a spreadsheet

GET/custodies/export
Needs a read & write tokenExport Employees, Documents, Leaves and Attendance lists to Excel/CSV exports/hr_dataRequires feature custodyNot available in Claudecustodies.export
  • It also needs: View every employee's custody, its details and stats custody/view_others

Builds an Excel (format=xlsx) or CSV (format=csv) file of the rows custodies.list shows for the same filters (held custody when no status is sent), with the columns you choose, headed in the requested language. Up to 10,000 rows the file comes back in the response. Above that it is built in the background: the answer is 202, and QHR emails the token owner when the file is ready to download from the export history in QHR. More than 20,000 rows is refused (too_large).

When to use: to hand someone a file of the company's custody, e.g. for an asset count. To read the records, use custodies.list.

Prerequisites: columns[] from custodies.export_columns. Needs "Export HR data" and "View others' custody".

Side effects: each export, refused ones included, is recorded in the company's export history and the audit log. One export of this list per user runs at a time (export_in_progress).

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 or csv. Anything else, or none, answers 400 bad_format.
Allowed values: xlsx, csv
xlsx
columns[]Requiredqueryarray<string>The columns, in order (key from custodies.export_columns).reference,employee_name,item,serial,value
q[status_eq]querystringOnly this status, as in custodies.list.
Allowed values: held, returned, deducting, deducted
held
q[search_cont]querystringHolder's name or number, reference or serial contains.Ahmed
Accept-LanguageheaderstringLanguage of messages and translated labels. English when omitted.
Allowed values: ar, en
ar

Response

200 The file, Excel or CSV as asked.

Returns a file, not JSON: application/vnd.openxmlformats-officedocument.spreadsheetml.sheet

Errors

HTTPCodeMeaningHow to fix
400bad_formatformat is missing or not xlsx / csv.Send format=xlsx or format=csv.
400no_columnsNo column was sent.Send columns[] from the export columns operation.
400unknown_columnA column is unknown or not visible to the caller.Use only keys from the export columns operation.
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 this user is still running.Wait for it to finish, then try again.
422no_dataNothing matches the filters.Change or remove the filters.
422too_largeMore than 20,000 rows; row_count and max_rows say how many.Narrow the filters.
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 →