QHR Developers

Request leave

POST/leave_requests
Needs a read & write tokenSubmit leave requests leave_request/createRequires feature leave_requestAvailable in Claudeleave_requests.create

Submits 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

NameInTypeDescriptionExample
Accept-LanguageheaderstringLanguage of messages and translated labels. English when omitted.
Allowed values: ar, en
ar

Request body

application/json

FieldTypeDescription
leave_requestRequiredobjectThe leave being requested.
leave_request.leave_policy_idintegerThe leave policy (Annual, Sick…). Must be assigned to the employee and active.
leave_request.start_datestring (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_datestring (date)Last day of leave, on or after start_date, and not after the employee's last working day.
leave_request.reasonstringWhy, up to 500 characters. Optional.

Response

201 The request, waiting for its first approver.

FieldTypeDescription
recordRequiredobjectThe leave request as saved.
record.idRequiredintegerLeave request id.
record.employee_idRequiredintegerId of the employee taking the leave.
record.leave_policy_idRequiredintegerLeave policy id.
record.start_dateRequiredstring (date)First day of leave.
record.end_dateRequiredstring (date)Last day of leave.
record.balancestringWorking days the request charges to the leave balance, as a decimal string ("3.0"). Weekends, days off and public holidays are not counted.
record.reasonstringThe reason given.
record.statusRequiredstringRequest 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_behalfbooleanTrue when filed by a manager or HR for the employee.
record.created_atstringWhen it was submitted, in UTC (2026-03-02 06:00:00 UTC).
warningstringPresent 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

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.
422employee_requiredThe 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.
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 →