List employees with their leave balances
/hr_leaves/employeestime_off/view_othersRequires feature time_offAvailable in Claudehr_leaves.employeesReturns 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
| Name | In | Type | Description | Example |
|---|---|---|---|---|
page | query | integer | Page number, starting at 1. min 1 | 1 |
per_page | query | integer | Records per page. Each list states its maximum. min 1 | 20 |
on_leave_today | query | boolean | true: only employees on approved leave today. | true |
has_pending | query | boolean | true: only employees with requests waiting on a decision. | true |
leave_policy_id | query | integer | Show this policy as each row's primary_balance (null where not held). | 7 |
q[employee_name_cont] | query | string | Name contains (English or Arabic). | Sara |
q[employee_no_cont] | query | string | Employee number contains. | E-004 |
q[s] | query | string | Sort. employee_name asc when omitted.Allowed values: employee_name asc, employee_name desc, pending_count desc | pending_count desc |
Accept-Language | header | string | Language of messages and translated labels. English when omitted. Allowed values: ar, en | ar |
Response
200 A page of employees, with the counts.
| Field | Type | Description |
|---|---|---|
countsRequired | object | Totals for the search. |
counts.total | integer | Employees matching the search. |
counts.on_leave_today | integer | Of those, on leave today. |
counts.has_pending | integer | Of those, with pending requests. |
recordsRequired | array<object> | The employees on this page. |
records[].id | integer | Employee id. |
records[].employee_no | string | Employee number. |
records[].name | string | Full name. |
records[].job_title | string | Job title. |
records[].department | object | Department. |
records[].department.id | integer | Department id. |
records[].department.name | string | Department name. |
records[].manager | object | Direct manager. |
records[].manager.id | integer | Employee id. |
records[].manager.full_name | string | Full name. |
records[].employment_status | string | active, notice_period or inactive. |
records[].last_working_day | string (date) | Last working day of a started offboarding; null otherwise. |
records[].on_leave | object | The approved leave they are on today; null when at work. |
records[].on_leave.leave_type | string | Leave policy name. |
records[].on_leave.until | string (date) | Last day of that leave. |
records[].pending | object | Requests waiting on a decision. |
records[].pending.count | integer | How many. |
records[].pending.days | string | Their days together, one decimal, as a string. |
records[].primary_balance | object | The 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_id | integer | Leave policy id. |
records[].primary_balance.name | string | Leave policy name. |
records[].primary_balance.unit | string | Unit the policy counts in, e.g. days. |
records[].primary_balance.unmetered | boolean | True for a per_event policy: no balance, each request justified on its own. |
records[].primary_balance.available | string | Days 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.entitled | string | Days 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.taken | string | Days 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_days | string | Days 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_balances | array<object> | The employee's other active policies. |
records[].other_balances[].leave_policy_id | integer | Leave policy id. |
records[].other_balances[].name | string | Leave policy name. |
records[].other_balances[].unit | string | Unit the policy counts in, e.g. days. |
records[].other_balances[].unmetered | boolean | True for a per_event policy: no balance, each request justified on its own. |
records[].other_balances[].available | string | Days still available this year. Days with one decimal, as a string ("12.5"); null on a per_event policy, which has no balance. |
paginationRequired | object | |
pagination.current_pageRequired | integer | This page's number. |
pagination.per_pageRequired | integer | Records per page. |
pagination.total_entriesRequired | integer | Records across all pages. |
pagination.pagesRequired | integer | Number of pages. |
Errors
| HTTP | Code | Meaning | How to fix |
|---|---|---|---|
| 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 | 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. |
entitlement_blocked · 429 rate_limited · 500 internal_error