Request leave
/leave_requestsleave_request/createRequires feature leave_requestAvailable in Claudeleave_requests.createSubmits a leave request for the token owner: a leave policy, a first and last day, and an optional reason. QHR counts the working days in the range (weekends, the employee's days off and public holidays are not counted) and starts the approval chain the policy names:
- manager — the employee's manager decides; with no manager (or every manager up the line on leave today), HR decides. - manager_and_hr — the manager approves first, then HR gives the final approval. - hr — HR decides alone.
Nothing is approved automatically when the employee submits for themselves.
Refused (422) when the policy is not assigned to you or is switched off, the dates are missing or inverted, the range has no working day, the leave ends after your last working day, it overlaps leave you already have *approved*, it starts in the past (unless the policy allows past dates) or later than next year, the policy requires a supporting document, or there are not enough days left this year and the policy does not allow a negative balance. Overlapping a *pending* request, or a leave starting next year (whose balance is granted on 1 January), goes through with a warning.
When to use: when a person asks to take time off. Run leave_requests.validate first and tell them the days it costs and what is left.
Prerequisites: leave_policy_id from leave_requests.assigned_leave_policies. The open API takes JSON only, so leave whose policy requires a supporting document must be requested in the QHR app.
Side effects: the days are reserved at once: they count against the balance while the request is pending, become taken when it is approved, and come back if it is rejected, cancelled or withdrawn. The approvers of the first step (the manager, or HR) are emailed. Recorded in the request's history and the audit log.
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_requestRequired | object | The leave being requested. |
leave_request.leave_policy_id | integer | The leave policy (Annual, Sick…). Must be assigned to the employee and active. |
leave_request.start_date | string (date) | First day of leave (YYYY-MM-DD), in this year or the next. Not in the past unless the policy allows past dates. |
leave_request.end_date | string (date) | Last day of leave, on or after start_date, and not after the employee's last working day. |
leave_request.reason | string | Why, up to 500 characters. Optional. |
Response
201 The request, waiting for its first approver.
| Field | Type | Description |
|---|---|---|
recordRequired | object | The leave request as saved. |
record.idRequired | integer | Leave request id. |
record.employee_idRequired | integer | Id of the employee taking the leave. |
record.leave_policy_idRequired | integer | Leave policy id. |
record.start_dateRequired | string (date) | First day of leave. |
record.end_dateRequired | string (date) | Last day of leave. |
record.balance | string | Working days the request charges to the leave balance, as a decimal string ("3.0"). Weekends, days off and public holidays are not counted. |
record.reason | string | The reason given. |
record.statusRequired | string | Request status: pending (waiting for a decision), approved, rejected, cancelled, or revoked (an approval was taken back).Allowed values: pending, approved, rejected, cancelled, revoked |
record.on_behalf | boolean | True when filed by a manager or HR for the employee. |
record.created_at | string | When it was submitted, in UTC (2026-03-02 06:00:00 UTC). |
warning | string | Present when the request went through with something to know: it overlaps another pending request, or it starts next year (that year's balance is not granted yet). |
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 | employee_required | The token's owner is a company user with no employee record, so they have no leave of their own. | Ask HR to link your user to your employee record, or use a token of a user who has one. |
entitlement_blocked · 429 rate_limited · 500 internal_error