Preview an employee's leave settlement on leaving
/employees/{id}/time_off/offboardingtime_off/view_othersRequires feature time_offAvailable in Claudetime_off.offboarding_previewWorks out, in days, the leave an employee would be paid out if they left on a given last working day: carry-over plus this year's entitlement earned to that day, minus approved leave taken, for each encashable policy (annual leave that is fully paid); other policies are listed under excluded with the reason. It also lists the requests that outlive that day and what starting the offboarding does to each: cancel (starts after it) or needs_review (straddles it).
Once an offboarding has started, the last working day is the one it was started with; once it is finalised, this returns the settlement frozen at that moment. Figures are days, not money: the end-of-service amount is worked out by the termination package.
When to use: before time_off.start_offboarding, to show HR the settlement and which leave will be cancelled, and afterwards to read where the offboarding stands.
Prerequisites: the employee's id from employees.list. Needs "View others' time off".
Side effects: none.
Before you call this
You will need ids that come from these operations:
Parameters
| Name | In | Type | Description | Example |
|---|---|---|---|---|
idRequired | path | integer | Employee id, from employees.list, employees.search or hr_leaves.employees. | 1203 |
last_working_day | query | string (date) | The last working day to work it out for, before an offboarding has started. 30 days from today when omitted; ignored once one has started. | 2026-12-31 |
Accept-Language | header | string | Language of messages and translated labels. English when omitted. Allowed values: ar, en | ar |
Response
200 The settlement and the leave it affects.
| Field | Type | Description |
|---|---|---|
carryover | number | Days carried over from earlier years. |
pro_rated | number | This year's entitlement earned up to the last working day. |
used | number | Days of approved leave this year, up to the last working day. |
to_encash | number | Days to be paid out: carryover + pro_rated − used. |
policies | array<object> | The encashable policies (annual leave, fully paid), one row each; rows add up to the totals. |
policies[].carryover | number | Days carried over from earlier years. |
policies[].pro_rated | number | This year's entitlement earned up to the last working day. |
policies[].used | number | Days of approved leave this year, up to the last working day. |
policies[].to_encash | number | Days to be paid out: carryover + pro_rated − used. |
policies[].leave_policy_id | integer | Leave policy id. |
policies[].name | string | Leave policy name. |
excluded | array<object> | Policies the employee holds that are not paid out, and why. |
excluded[].leave_policy_id | integer | Leave policy id. |
excluded[].name | string | Leave policy name. |
excluded[].reason | string | not_accrued_per_year, category_not_encashable or policy_not_fully_paid. |
last_working_day | string (date) | The last working day the settlement is worked out for. |
affected_leave_requests | array<object> | Requests that outlive the last working day and what starting the offboarding does to each. Empty once it is finalised. |
affected_leave_requests[].id | integer | Leave request id. |
affected_leave_requests[].leave_policy_id | integer | Leave policy id. |
affected_leave_requests[].leave_type_name | string | Policy name. |
affected_leave_requests[].start_date | string (date) | First day. |
affected_leave_requests[].end_date | string (date) | Last day. |
affected_leave_requests[].balance | number | Working days. |
affected_leave_requests[].status | string | pending or approved. |
affected_leave_requests[].action | string | cancel (starts after the last day; cancelled for good when the offboarding starts) or needs_review (straddles it; left as is for HR to cancel and re-file shorter).Allowed values: cancel, needs_review |
cancellation_warning | string | What HR must know before starting: the cancellations are permanent, and (for unpaid or partly paid leave) they change payroll. Null when nothing is cancelled. |
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. |
| 404 | not_found | The record does not exist, or you cannot see it. | Check the id. List the records first to get a valid one. |
entitlement_blocked · 429 rate_limited · 500 internal_error