File leave for one of my direct reports
/team_leavesleave_request/create_for_teamRequires feature leave_requestAvailable in Claudeteam_leaves.createThe 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
| 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 |
|---|---|---|
employee_idRequired | integer | The direct report, from employees.team. |
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 filed request, in the state the policy leads to.
| 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. |
| 404 | not_found | The record does not exist, or you cannot see it. | Check the id. List the records first to get a valid one. |
| 422 | validation_failed | The 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. |
| 422 | employee_required | The token's owner has no employee record, so they manage no one. | Use the token of a user linked to their employee record. |
entitlement_blocked · 429 rate_limited · 500 internal_error