QHR Developers

Revoke an approved permission before it starts

PATCH/permission_requests/{id}/revoke
Needs a read & write tokenView team attendance attendance/view_teamRequires feature attendanceNot available in Claudepermission_requests.revoke

Takes back a final approval of a permission request (hourly leave of absence) before its window starts. Only the first approver in the route may revoke, alone: the employee's current manager when they approved it (on manager or manager_and_hr), otherwise HR (route hr, a request that never had a manager step, or a manager who can no longer approve). A note is required. The request ends as revoked.

Effect on pay: the time is no longer excused. If the day already has attendance it is recalculated at once, so a late arrival or early leave in that window counts, and may be deducted, again. Refused once the window has started or payroll for the date is closed.

When to use: when the business needs the employee after all, before the permission begins.

Prerequisites: the request id from permission_requests.team_decided (or permission_requests.hr_list for HR) where actions.can_revoke is true.

Side effects: the employee is notified (in-app and email). Recorded in the audit log. Not offered to Claude: it removes time off already granted and can lead to a pay deduction.

Not available in Claude yet.

Before you call this

You will need ids that come from these operations:

Parameters

NameInTypeDescriptionExample
idRequiredpathintegerPermission request id, from permission_requests.list, permission_requests.team_pending, permission_requests.team_decided or permission_requests.hr_list.4812
Accept-LanguageheaderstringLanguage of messages and translated labels. English when omitted.
Allowed values: ar, en
ar

Request body

application/json

FieldTypeDescription
noteRequiredstringWhy, up to 500 characters. Required.

Response

200 The revoked request.

FieldTypeDescription
recordRequiredobjectA permission request: an hourly leave of absence on one working day.
record.idRequiredintegerPermission request id.
record.referencestringReference shown to people, PRM-<id>.
record.employee_idRequiredintegerThe employee who asked.
record.employee_nostringTheir employee number.
record.employee_namestringTheir full name.
record.dateRequiredstring (date)The working day the permission is for.
record.start_timeRequiredstringStart, wall-clock time HH:MM in the attendance profile's timezone.
record.end_timeRequiredstringEnd, wall-clock time HH:MM in the attendance profile's timezone.
record.starts_atstring (date-time)Absolute start, in UTC. For an overnight shift it may fall on the next calendar day.
record.ends_atstring (date-time)Absolute end, in UTC.
record.minutesintegerLength in minutes.
record.hoursnumberLength in hours, two decimals.
record.kindstringWhat the window is, worked out by QHR from the shift: late_arrival (starts when the shift starts), early_leave (ends when the shift ends), mid_shift (inside the shift) or flexible (a day with no fixed hours).
Allowed values: late_arrival, early_leave, mid_shift, flexible
record.notestringThe employee's reason (up to 500 characters).
record.statusRequiredstringpending_manager (waiting for the employee's manager), pending_hr (waiting for HR), approved, rejected, cancelled (by the employee) or revoked (an approval taken back).
Allowed values: pending_manager, pending_hr, approved, rejected, cancelled, revoked
record.approval_routestringWho approves, fixed when the request was filed from the attendance profile: manager, hr, or manager_and_hr (the manager first, then HR).
Allowed values: manager, hr, manager_and_hr
record.revoke_typestringFor a revoked request: withdrawn (the manager took back their approval before HR decided) or revoked (a final approval taken back). Null otherwise.
record.current_approver_namestringWho must decide now: the manager's name, or "HR". Null once decided.
record.attachmentobjectSupporting file, if one was added in the QHR app: filename, content_type, byte_size and a temporary download url.
record.actionsobjectWhat the token owner may do with this request now. blocked_reason explains why approve is off for an approver: payroll_locked or incident_decided.
record.actions.can_editbooleanMay edit it (permission_requests.update).
record.actions.can_cancelbooleanMay cancel it (permission_requests.cancel).
record.actions.can_approvebooleanMay approve it (permission_requests.approve).
record.actions.can_rejectbooleanMay reject it (permission_requests.reject).
record.actions.can_withdrawbooleanMay withdraw their approval (permission_requests.withdraw).
record.actions.can_revokebooleanMay revoke the approval (permission_requests.revoke).
record.actions.blocked_reasonstringWhy approving is blocked, or null.
record.managerobjectThe manager's decision, once they acted.
record.manager.idintegerEmployee id of the person who acted.
record.manager.namestringTheir full name.
record.manager.acted_atstring (date-time)When, in UTC.
record.manager.notestringThe note they left.
record.hrobjectHR's decision, once HR acted.
record.hr.idintegerEmployee id of the person who acted.
record.hr.namestringTheir full name.
record.hr.acted_atstring (date-time)When, in UTC.
record.hr.notestringThe note they left.
record.revokedobjectWho withdrew or revoked the approval, and why.
record.revoked.idintegerEmployee id of the person who acted.
record.revoked.namestringTheir full name.
record.revoked.acted_atstring (date-time)When, in UTC.
record.revoked.notestringThe note they left.
record.cancelled_atstring (date-time)When the employee cancelled it, in UTC.
record.created_atstring (date-time)When it was filed, in UTC.
record.attendance_profileobjectOnly on permission_requests.show: the employee's shift that day (shift_start, shift_end, day_type, flexible, scheduled_hours, grace_period_minutes).

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.
422not_actionableThe request is not in a state this action accepts (already decided, or not approved).Read error. Reload the request with permission_requests.show and act only where actions allows it.
422own_requestNobody decides their own request.Read error. Reload the request with permission_requests.show and act only where actions allows it.
422not_authorizedThe token owner is not the approver at this stage.Read error. Reload the request with permission_requests.show and act only where actions allows it.
422already_startedThe permission's window has already begun.Read error. Reload the request with permission_requests.show and act only where actions allows it.
422note_requiredA note is required for this action.Read error. Reload the request with permission_requests.show and act only where actions allows it.
422payroll_lockedPayroll for the date is closed.Read error. Reload the request with permission_requests.show and act only where actions allows it.
422employee_requiredThe token's owner is a company user with no employee record, so they cannot act as a manager or HR approver.Use a token created by a user who is linked to an employee, or ask HR to link this user 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 →