Update a leave policy
/leave_policies/{id}leave_policy/editRequires feature leave_policyNot available in Claudeleave_policies.updateChanges the fields you send; the rest stay as they are. See leave_policies.create for what each rule means.
What happens to balances: nothing is recalculated. Employees who hold the policy keep their current balance, and a new duration, accrued_per or accrual_method applies from the next accrual (the 1st of the month or 1 January). In that case the answer carries warnings saying how many employees are affected. Moving per_event → per_year grants nothing until the next accrual run; per_year → per_event leaves current balances and carried days spendable but never accrued again.
Switching off: active: false is refused while any employee holds the policy — remove them first with employee_leave_policies.remove, so their remaining balance is acknowledged.
Prerequisites: the policy id from leave_policies.list; keys from leave_policies.meta_data.
Side effects: recorded in the audit log. Not offered to Claude: it changes the entitlements of every employee holding the policy.
Not available in Claude yet.
Before you call this
You will need ids that come from these operations:
Parameters
| Name | In | Type | Description | Example |
|---|---|---|---|---|
idRequired | path | integer | Leave policy id, from leave_policies.list. | 12 |
Accept-Language | header | string | Language of messages and translated labels. English when omitted. Allowed values: ar, en | ar |
Request body
application/json
| Field | Type | Description |
|---|---|---|
leave_policyRequired | object | The policy's fields. Keys for the enum fields come from leave_policies.meta_data. |
leave_policy.name_en | string | Name in English; unique within the category. |
leave_policy.name_ar | string | Name in Arabic; unique within the category. |
leave_policy.leave_category_id | integer | Category, from leave_categories.list. |
leave_policy.duration | number | Entitlement in days, more than 0. For tiered_pay, at least the sum of the tiers' days. |
leave_policy.accrued_per | string | per_year (renews every 1 January, can carry over), one_time_only (granted once, never renews) or per_event (no balance; each occasion requested on its own).Allowed values: per_year, per_event, one_time_only |
leave_policy.accrual_method | string | full_balance (all at once) or monthly (a twelfth on the 1st of each month; per_year only).Allowed values: full_balance, monthly |
leave_policy.compensation_type | string | fully_paid, tiered_pay (needs tiers) or unpaid.Allowed values: fully_paid, tiered_pay, unpaid |
leave_policy.approver | string | manager, hr or manager_and_hr (manager first, then HR).Allowed values: manager, hr, manager_and_hr |
leave_policy.allow_past_dates | boolean | Allow requests for past dates. |
leave_policy.allow_negative_balance | boolean | Allow requests beyond the available balance (forced true for per_event). |
leave_policy.requires_document | boolean | Require a supporting document. |
leave_policy.show_used_balance | boolean | Show employees their used days. |
leave_policy.carryover_usable | boolean | Let employees take carried-over days. |
leave_policy.carryover_max_days | number | Cap on days carried over; null for no cap. |
leave_policy.carryover_expires_end_of_month | integer | Month 1–11 after which unused carried-over days expire; null for never. |
leave_policy.active | boolean | Switch the policy on or off. Cannot be switched off while employees hold it. |
leave_policy.tiers | array<object> | Pay ladder of a tiered_pay policy, in order: the first days days of the leave are paid at percentage, the next tier's days at its percentage, and any day beyond the last tier is unpaid. Empty for every other compensation type. |
leave_policy.tiers[].days | integer | Days in this tier (at least 1). |
leave_policy.tiers[].percentage | integer | Percentage of pay for these days, 0 to 100. |
Response
200 The policy after the change, with `warnings` when employees' entitlement is affected.
| Field | Type | Description |
|---|---|---|
idRequired | integer | Leave policy id. |
nameRequired | string | Name in the language of the request. |
leave_category_idRequired | integer | Category the policy belongs to (leave_categories.list). |
durationRequired | string | Entitlement in days a year (or in total for a one-time policy), as a decimal string, e.g. "21.0". |
activeRequired | boolean | False when the policy is switched off: no new requests, no accrual. |
employees_count | integer | Employees currently holding the policy. |
compensation_type | string | How the leave is paid: Fully Paid, Tiered Pay or Unpaid (translated). |
approver | string | Who approves requests: Manager, HR, or Manager & HR (translated). |
accrued_per | string | How often the entitlement is granted: Per Year, Per Event or One Time Only (translated). |
accrual_method | string | How the days are granted: Full Balance (all at once) or Monthly (translated). |
allow_past_dates | boolean | Employees may request leave for dates already past. |
allow_negative_balance | boolean | Requests may exceed the available balance. Always true for per-event policies. |
requires_document | boolean | A supporting document must be attached to each request. |
show_used_balance | boolean | Employees see the days they have used. |
carryover_usable | boolean | Carried-over days may be taken. When false they are only paid out when the employee leaves the company. |
carryover_max_days | number | Most days carried into the next year; null for no cap, 0 to carry nothing. |
carryover_expires_end_of_month | integer | Month (1–11) at whose end unused carried-over days expire; null when they never expire. |
tiers | array<object> | Pay ladder of a tiered_pay policy, in order: the first days days of the leave are paid at percentage, the next tier's days at its percentage, and any day beyond the last tier is unpaid. Empty for every other compensation type. |
tiers[].days | integer | Days in this tier (at least 1). |
tiers[].percentage | integer | Percentage of pay for these days, 0 to 100. |
warnings | array<string> | Present only when the change touches the entitlement (duration, accrued_per, accrual_method) of a policy employees hold: what it means for their balances. Show these to the person who made the change. |
Errors
| HTTP | Code | Meaning | How to fix |
|---|---|---|---|
| 400 | bad_request | A parameter is missing or malformed. | Check the parameters against this operation's documentation. |
| 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 | token_read_only | This token can only read; the operation makes changes. | Use a token created with "Allow changes". |
| 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. |
| 422 | validation_failed | A field is invalid, or active: false was sent while employees still hold the policy. | Fix the field named in error. To switch the policy off, remove every employee with employee_leave_policies.remove first. |
entitlement_blocked · 429 rate_limited · 500 internal_error