Cancel my leave request
/leave_requests/{id}/cancelleave_request/cancelRequires feature leave_requestAvailable in Claudeleave_requests.cancelCancels one of the token owner's own leave requests. What happens depends on how far it got:
- Still waiting, and no manager has approved it yet: cancelled at once (status: cancelled). - Approved, or already approved by the manager and waiting for HR, or filed for you by HR or the manager: becomes a cancellation request for the approver (current_stage: cancellation_review); the leave stands until they decide with leave_requests.approve_cancellation or leave_requests.reject_cancellation. Cancelling an approved leave needs a note.
Refused (422) once the leave has started, when it was already rejected, cancelled or revoked, or while an earlier cancellation is under review.
When to use: when a person no longer needs leave they asked for. To change the dates of a request no one has decided yet, leave_requests.update keeps it in the queue instead.
Prerequisites: the request's id from leave_requests.list (check locked / lock_reason there).
Side effects: a direct cancellation gives the reserved days back at once and emails the approvers that it was withdrawn. A cancellation request emails the approvers asking them to review it; the days come back only when they approve it. 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 |
|---|---|---|---|---|
idRequired | path | integer | Leave request id, from leave_requests.list (your own) or team_leaves.pending_requests (your team's). | 5120 |
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 |
|---|---|---|
note | string | The reason, up to 500 characters. Required when the leave is approved. |
Response
200 The request after the cancellation.
| Field | Type | Description |
|---|---|---|
recordRequired | object | The request after the cancellation. |
record.id | integer | Leave request id. |
record.employee_id | integer | Id of the employee taking the leave. |
record.leave_policy_id | integer | Leave policy id. |
record.start_date | string (date) | First day of leave. |
record.end_date | 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.status | 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.created_at | string | When it was submitted, in UTC (2026-03-02 06:00:00 UTC). |
record.note | string | The cancellation note you sent. |
Errors
| HTTP | Code | Meaning | How to fix |
|---|---|---|---|
| 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 has started, the request is already closed or under cancellation review, or an approved leave was cancelled without a note. error says which. | Send a note for an approved leave; otherwise there is nothing left to cancel. |
| 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