QHR Developers

Update a leave policy

PATCH/leave_policies/{id}
Needs a read & write tokenEdit leave policies leave_policy/editRequires feature leave_policyNot available in Claudeleave_policies.update

Changes 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

NameInTypeDescriptionExample
idRequiredpathintegerLeave policy id, from leave_policies.list.12
Accept-LanguageheaderstringLanguage of messages and translated labels. English when omitted.
Allowed values: ar, en
ar

Request body

application/json

FieldTypeDescription
leave_policyRequiredobjectThe policy's fields. Keys for the enum fields come from leave_policies.meta_data.
leave_policy.name_enstringName in English; unique within the category.
leave_policy.name_arstringName in Arabic; unique within the category.
leave_policy.leave_category_idintegerCategory, from leave_categories.list.
leave_policy.durationnumberEntitlement in days, more than 0. For tiered_pay, at least the sum of the tiers' days.
leave_policy.accrued_perstringper_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_methodstringfull_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_typestringfully_paid, tiered_pay (needs tiers) or unpaid.
Allowed values: fully_paid, tiered_pay, unpaid
leave_policy.approverstringmanager, hr or manager_and_hr (manager first, then HR).
Allowed values: manager, hr, manager_and_hr
leave_policy.allow_past_datesbooleanAllow requests for past dates.
leave_policy.allow_negative_balancebooleanAllow requests beyond the available balance (forced true for per_event).
leave_policy.requires_documentbooleanRequire a supporting document.
leave_policy.show_used_balancebooleanShow employees their used days.
leave_policy.carryover_usablebooleanLet employees take carried-over days.
leave_policy.carryover_max_daysnumberCap on days carried over; null for no cap.
leave_policy.carryover_expires_end_of_monthintegerMonth 1–11 after which unused carried-over days expire; null for never.
leave_policy.activebooleanSwitch the policy on or off. Cannot be switched off while employees hold it.
leave_policy.tiersarray<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[].daysintegerDays in this tier (at least 1).
leave_policy.tiers[].percentageintegerPercentage of pay for these days, 0 to 100.

Response

200 The policy after the change, with `warnings` when employees' entitlement is affected.

FieldTypeDescription
idRequiredintegerLeave policy id.
nameRequiredstringName in the language of the request.
leave_category_idRequiredintegerCategory the policy belongs to (leave_categories.list).
durationRequiredstringEntitlement in days a year (or in total for a one-time policy), as a decimal string, e.g. "21.0".
activeRequiredbooleanFalse when the policy is switched off: no new requests, no accrual.
employees_countintegerEmployees currently holding the policy.
compensation_typestringHow the leave is paid: Fully Paid, Tiered Pay or Unpaid (translated).
approverstringWho approves requests: Manager, HR, or Manager & HR (translated).
accrued_perstringHow often the entitlement is granted: Per Year, Per Event or One Time Only (translated).
accrual_methodstringHow the days are granted: Full Balance (all at once) or Monthly (translated).
allow_past_datesbooleanEmployees may request leave for dates already past.
allow_negative_balancebooleanRequests may exceed the available balance. Always true for per-event policies.
requires_documentbooleanA supporting document must be attached to each request.
show_used_balancebooleanEmployees see the days they have used.
carryover_usablebooleanCarried-over days may be taken. When false they are only paid out when the employee leaves the company.
carryover_max_daysnumberMost days carried into the next year; null for no cap, 0 to carry nothing.
carryover_expires_end_of_monthintegerMonth (1–11) at whose end unused carried-over days expire; null when they never expire.
tiersarray<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[].daysintegerDays in this tier (at least 1).
tiers[].percentageintegerPercentage of pay for these days, 0 to 100.
warningsarray<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

HTTPCodeMeaningHow to fix
400bad_requestA parameter is missing or malformed.Check the parameters against this operation's documentation.
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.
403token_read_onlyThis token can only read; the operation makes changes.Use a token created with "Allow changes".
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.
422validation_failedA 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.
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 →