QHR Developers

Get one employee's leave summary

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

Returns one employee's leave picture, the same row as hr_leaves.employees: headline and other balances, leave they are on today, pending requests and, when leaving, the last working day. Works for employees who have left too.

When to use: for a quick "where does Sara stand on leave?". For every policy's full figures use time_off.balances; for the requests themselves time_off.leave_requests.

Prerequisites: the employee's id from hr_leaves.employees or employees.list. Needs "View others' time off".

Side effects: none.

Before you call this

You will need ids that come from these operations:

Parameters

NameInTypeDescriptionExample
idRequiredpathintegerEmployee id, from hr_leaves.employees or employees.list. Leavers can be read too.1203
leave_policy_idqueryintegerShow this policy as primary_balance (null if not held).7
Accept-LanguageheaderstringLanguage of messages and translated labels. English when omitted.
Allowed values: ar, en
ar

Response

200 The employee's leave summary.

FieldTypeDescription
recordRequiredobjectOne employee with their leave picture today.
record.idintegerEmployee id.
record.employee_nostringEmployee number.
record.namestringFull name.
record.job_titlestringJob title.
record.departmentobjectDepartment.
record.department.idintegerDepartment id.
record.department.namestringDepartment name.
record.managerobjectDirect manager.
record.manager.idintegerEmployee id.
record.manager.full_namestringFull name.
record.employment_statusstringactive, notice_period or inactive.
record.last_working_daystring (date)Last working day of a started offboarding; null otherwise.
record.on_leaveobjectThe approved leave they are on today; null when at work.
record.on_leave.leave_typestringLeave policy name.
record.on_leave.untilstring (date)Last day of that leave.
record.pendingobjectRequests waiting on a decision.
record.pending.countintegerHow many.
record.pending.daysstringTheir days together, one decimal, as a string.
record.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.
record.primary_balance.leave_policy_idintegerLeave policy id.
record.primary_balance.namestringLeave policy name.
record.primary_balance.unitstringUnit the policy counts in, e.g. days.
record.primary_balance.unmeteredbooleanTrue for a per_event policy: no balance, each request justified on its own.
record.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.
record.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.
record.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.
record.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.
record.other_balancesarray<object>The employee's other active policies.
record.other_balances[].leave_policy_idintegerLeave policy id.
record.other_balances[].namestringLeave policy name.
record.other_balances[].unitstringUnit the policy counts in, e.g. days.
record.other_balances[].unmeteredbooleanTrue for a per_event policy: no balance, each request justified on its own.
record.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.

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.
404not_foundThe record does not exist, or you cannot see it.Check the id. List the records first to get a valid one.
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 →