QHR Developers

Create a leave policy

POST/leave_policies
Needs a read & write tokenCreate leave policies leave_policy/createRequires feature leave_policyNot available in Claudeleave_policies.create

Creates a leave policy: the rules employees who hold it follow. Nobody holds it yet; assign it with employee_leave_policies.assign.

How the days are granted (accrual). accrued_per and accrual_method together decide it: - per_year + full_balance: on assignment, duration pro-rated by the whole months left in the year, counted from the employee's joining date (a mid-month start loses that month); topped back up to the full duration every 1 January. - per_year + monthly: on assignment, the share of the current month still to come; then one twelfth of duration on the 1st of each month, never above duration; a fresh balance every 1 January. - one_time_only: the full duration at once on assignment; it never renews. - per_event: no balance is ever granted; each occasion (bereavement, marriage…) is requested on its own, so allow_negative_balance is always on. Only active policies, and employees who are active or serving notice, accrue.

Carry-over. Only for per_year policies whose category has carryover_eligible. On 1 January the unused days of the year just ended (balance plus carried days, minus days taken) move into the new year, up to carryover_max_days (null = no cap); anything above the cap is forfeited. With carryover_expires_end_of_month set, carried days still unused at the end of that month expire for good. With carryover_usable: false carried days cannot be taken but are paid out when the employee leaves.

Prerequisites: leave_category_id from leave_categories.list; the allowed keys and what each combination does from leave_policies.meta_data; check the names with leave_policies.validate_name.

Side effects: recorded in the audit log. Not offered to Claude: it sets entitlements that become balances and pay for every employee later assigned, which HR configures on purpose.

Not available in Claude yet.

Before you call this

You will need ids that come from these operations:

Parameters

NameInTypeDescriptionExample
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

201 The new policy.

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.

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.
422validation_failedA field is missing or invalid: a name is taken in the category, monthly with anything but per_year, a tier ladder longer than duration, tiers on a policy that is not tiered_pay, or an expiry month outside 1–11.Fix the field named in error; see leave_policies.meta_data for valid combinations.
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 →