QHR Developers

List employees with their leave balances

GET/hr_leaves/employees
Read token is enoughView others' time off time_off/view_othersRequires feature time_offAvailable in Claudehr_leaves.employees

Returns the employees still employed (active or on notice), alphabetically, each with their headline balance (annual leave, or the policy named in leave_policy_id), their other balances, the leave they are on today, their pending requests and, when leaving, their last working day. counts gives the totals for the search: all, on leave today, with pending requests (the two switches do not change them).

When to use: for "who is on leave today?" (on_leave_today=true), "who has requests waiting?" (has_pending=true) or "how much annual leave does everyone have left?". For one employee, use hr_leaves.employee or time_off.balances.

Prerequisites: none. Needs "View others' time off".

Side effects: none. Up to 50 per page.

Parameters

NameInTypeDescriptionExample
pagequeryintegerPage number, starting at 1.
min 1
1
per_pagequeryintegerRecords per page. Each list states its maximum.
min 1
20
on_leave_todayquerybooleantrue: only employees on approved leave today.true
has_pendingquerybooleantrue: only employees with requests waiting on a decision.true
leave_policy_idqueryintegerShow this policy as each row's primary_balance (null where not held).7
q[employee_name_cont]querystringName contains (English or Arabic).Sara
q[employee_no_cont]querystringEmployee number contains.E-004
q[s]querystringSort. employee_name asc when omitted.
Allowed values: employee_name asc, employee_name desc, pending_count desc
pending_count desc
Accept-LanguageheaderstringLanguage of messages and translated labels. English when omitted.
Allowed values: ar, en
ar

Response

200 A page of employees, with the counts.

FieldTypeDescription
countsRequiredobjectTotals for the search.
counts.totalintegerEmployees matching the search.
counts.on_leave_todayintegerOf those, on leave today.
counts.has_pendingintegerOf those, with pending requests.
recordsRequiredarray<object>The employees on this page.
records[].idintegerEmployee id.
records[].employee_nostringEmployee number.
records[].namestringFull name.
records[].job_titlestringJob title.
records[].departmentobjectDepartment.
records[].department.idintegerDepartment id.
records[].department.namestringDepartment name.
records[].managerobjectDirect manager.
records[].manager.idintegerEmployee id.
records[].manager.full_namestringFull name.
records[].employment_statusstringactive, notice_period or inactive.
records[].last_working_daystring (date)Last working day of a started offboarding; null otherwise.
records[].on_leaveobjectThe approved leave they are on today; null when at work.
records[].on_leave.leave_typestringLeave policy name.
records[].on_leave.untilstring (date)Last day of that leave.
records[].pendingobjectRequests waiting on a decision.
records[].pending.countintegerHow many.
records[].pending.daysstringTheir days together, one decimal, as a string.
records[].primary_balanceobjectThe headline policy: the one asked for with leave_policy_id, else annual leave, else the first by name. Null when the employee holds none.
records[].primary_balance.leave_policy_idintegerLeave policy id.
records[].primary_balance.namestringLeave policy name.
records[].primary_balance.unitstringUnit the policy counts in, e.g. days.
records[].primary_balance.unmeteredbooleanTrue for a per_event policy: no balance, each request justified on its own.
records[].primary_balance.availablestringDays still available this year. Days with one decimal, as a string ("12.5"); null on a per_event policy, which has no balance.
records[].primary_balance.entitledstringDays entitled this year. Days with one decimal, as a string ("12.5"); null on a per_event policy, which has no balance.
records[].primary_balance.takenstringDays in approved requests. Days with one decimal, as a string ("12.5"); null on a per_event policy, which has no balance.
records[].primary_balance.pending_daysstringDays held by pending requests. Days with one decimal, as a string ("12.5"); null on a per_event policy, which has no balance.
records[].other_balancesarray<object>The employee's other active policies.
records[].other_balances[].leave_policy_idintegerLeave policy id.
records[].other_balances[].namestringLeave policy name.
records[].other_balances[].unitstringUnit the policy counts in, e.g. days.
records[].other_balances[].unmeteredbooleanTrue for a per_event policy: no balance, each request justified on its own.
records[].other_balances[].availablestringDays still available this year. Days with one decimal, as a string ("12.5"); null on a per_event policy, which has no balance.
paginationRequiredobject
pagination.current_pageRequiredintegerThis page's number.
pagination.per_pageRequiredintegerRecords per page.
pagination.total_entriesRequiredintegerRecords across all pages.
pagination.pagesRequiredintegerNumber of pages.

Errors

HTTPCodeMeaningHow to fix
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.
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.
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 →