QHR Developers

Take back my manager approval before HR decides

PATCH/leave_requests/{id}/withdraw
Needs a read & write tokenApprove / reject requests leave_request/approveRequires feature leave_requestAvailable in Claudeleave_requests.withdraw

On a manager_and_hr request that the manager approved and that is still waiting for HR, the manager takes the approval back. The request ends as revoked with revoke_type: withdrawn and leaves HR's queue. A reason (note, up to 500 characters) is required. HR never withdraws; you cannot act on your own request.

When to use: when a manager approved too early ("I approved Sara's leave before checking the plan"). For a leave that already has its final approval, leave_requests.revoke is the operation.

Prerequisites: the request's id, where approver_actions.can_withdraw is true (from team_leaves.pending_requests or leave_requests.show).

Side effects: the reserved days come back to the employee's balance and the employee is emailed with the reason. Attendance and payroll are not touched (the leave was never approved). Recorded in the request's history and the audit log.

Refusals answer 422 with a code naming the reason (also sent as error_code).

Before you call this

You will need ids that come from these operations:

Parameters

NameInTypeDescriptionExample
idRequiredpathintegerLeave request id, from leave_requests.list (your own) or team_leaves.pending_requests (your team's).5120
Accept-LanguageheaderstringLanguage of messages and translated labels. English when omitted.
Allowed values: ar, en
ar

Request body

application/json

FieldTypeDescription
noteRequiredstringThe reason, up to 500 characters. The employee sees it.

Response

200 The request, now revoked.

FieldTypeDescription
recordRequiredobjectOne leave request with its approval history.
record.idRequiredintegerLeave request id.
record.employee_idRequiredintegerId of the employee taking the leave.
record.employee_nostringTheir employee number.
record.employee_namestringTheir full name.
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.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.reasonstringThe employee's reason, up to 500 characters.
record.created_atstringWhen the request was submitted, in UTC (2026-03-02 06:00:00 UTC).
record.leave_type_namestringLeave policy name, in the requested language.
record.cancellation_requested_atstringWhen the employee asked to cancel this leave, while that is under review.
record.on_behalfbooleanTrue when HR or the manager filed it for the employee.
record.document_urlstringShort-lived link to the attached supporting document. Null when there is none.
record.document_filenamestringThe attached document's file name.
record.current_stagestringWhere the request sits in the approval chain: awaiting_manager, awaiting_hr, cancellation_review (the employee asked to cancel an approved leave) or terminal (decided).
Allowed values: awaiting_manager, awaiting_hr, cancellation_review, terminal
record.current_approver_namestringWho must decide next, when the request is waiting.
record.compensation_typestringHow the leave is paid: fully_paid, tiered_pay (pay drops after some days) or unpaid.
Allowed values: fully_paid, tiered_pay, unpaid, null
record.compensation_type_labelstringThe same, translated.
record.actionsarray<object>The approval history, oldest first: who did what, when, with their note.
record.actions[].actionstringWhat happened: submitted, updated, manager_approved, pending_hr, hr_approved, manager_rejected, hr_rejected (sent back to the manager when a manager had approved), pending_cancellation, cancelled, cancellation_rejected, withdrawn or revoked.
record.actions[].actioned_atstringWhen, in UTC (2026-03-02 08:15:00 UTC).
record.actions[].notestringThe note written with it.
record.actions[].actioned_bystringWho did it (full name).
record.revoke_typestringHow the approval was taken back: withdrawn (the manager, while HR had not decided) or revoked (a final approval, before the leave started). Null unless revoked.
Allowed values: withdrawn, revoked, null
record.revocationobjectWho took the approval back, when and why. Null unless the status is revoked.
record.revocation.byobjectA person: id (employee id) and full_name.
record.revocation.by.idintegerEmployee id.
record.revocation.by.full_namestringFull name, in the requested language when known.
record.revocation.atstring (date-time)When, in UTC.
record.revocation.notestringThe reason given.
record.approver_actionsobjectWhat the caller may do with this request as an approver. All false on your own requests.
record.approver_actions.can_withdrawbooleanTrue when you may take back your manager approval with leave_requests.withdraw.
record.approver_actions.can_revokebooleanTrue when you may take back the final approval with leave_requests.revoke.
record.approver_actions.revoke_blocked_reasonstringWhy revoking is blocked right now although you hold the right: payroll_locked or cancellation_pending. Null otherwise.
Allowed values: payroll_locked, cancellation_pending, null

Errors

HTTPCodeMeaningHow to fix
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.
422own_requestThe request is your own leave; an approval on it cannot be taken back by you.Ask the employee's other approver (or HR) to act.
422not_actionableThe request is not in a state that allows this (already decided, or not waiting for HR after a manager approval).Re-read it with leave_requests.show and use the operation its state allows.
422not_authorizedYou do not hold the step this takes back (you are not the first approver in the leave's route).Only approver_actions flags that are true can be acted on; ask the right approver.
422note_requiredNo reason (note) was sent.Send a note; the employee sees it.
422note_too_longThe reason is longer than 500 characters.Shorten the note to 500 characters.
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 →