Create a leave policy
/leave_policiesleave_policy/createRequires feature leave_policyNot available in Claudeleave_policies.createCreates 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
| Name | In | Type | Description | Example |
|---|---|---|---|---|
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
201 The new policy.
| 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. |
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. |
| 422 | validation_failed | A 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. |
entitlement_blocked · 429 rate_limited · 500 internal_error