QHR Developers

File leave for one of my direct reports

POST/team_leaves
Needs a read & write tokenFile leave for direct reports leave_request/create_for_teamRequires feature leave_requestAvailable in Claudeteam_leaves.create

The token owner, as manager, files a leave request on behalf of one of their direct reports (for example someone off sick who cannot submit it). Filing counts as the manager's approval, so where it lands depends on the policy:

  • manager — approved at once.
  • manager_and_hr — approved by the manager, now waiting for HR.
  • hr — waiting for HR.

The same rules as leave_requests.create apply to the report (balance, approved overlap, working days, last working day, policy assigned and active), and the leave may not start in the past unless the policy allows past dates. If the manager-stage approval is refused (for example a day was already paid as an absence), nothing is saved. The request is marked on_behalf: true: the employee cannot edit it, and cancelling it goes to review.

When to use: when a manager asks to record leave for someone in their team. For the manager's own leave, use leave_requests.create.

Prerequisites: employee_id from employees.team; leave_policy_id from team_leaves.policies. Check first with team_leaves.validate. JSON only: leave whose policy requires a supporting document must be filed in the QHR app.

Side effects: the days are reserved (or taken, when approved at once) on the report's balance. When it waits for HR, HR is emailed; when approved at once, the employee is emailed, and the days are marked as leave in attendance. 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
employee_idRequiredintegerThe direct report, from employees.team.
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 filed request, in the state the policy leads to.

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.
404not_foundThe record does not exist, or you cannot see it.Check the id. List the records first to get a valid one.
422validation_failedThe leave breaks a rule for the report: not enough balance, overlaps an approved leave, in the past, no working day, after their last working day, policy not assigned or switched off, or a document is required. error says which. Nothing was saved.Check with team_leaves.validate, change the dates or the policy, then send again.
422employee_requiredThe token's owner has no employee record, so they manage no one.Use the token of a user linked to their employee record.
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 →