QHR Developers

Cancel my permission request

PATCH/permission_requests/{id}/cancel
Needs a read & write tokenCheck in/out and view own attendance history attendance/view_ownRequires feature attendanceAvailable in Claudepermission_requests.cancel

Cancels one of the token owner's own permission requests (hourly leave of absence). A pending request can always be cancelled. An approved one can be cancelled until its window starts, as long as payroll for the date is still open; the time then counts as usual again, so a late arrival or early leave on that day may be deducted. Rejected, cancelled and revoked requests cannot be cancelled.

When to use: when the owner no longer needs the time off, or to replace an approved request with a different window.

Prerequisites: the request id from permission_requests.list where actions.can_cancel is true.

Side effects: for an approved request, the day's attendance and its late / early-leave incidents are recalculated. Nobody is notified. Recorded in the audit log.

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

Response

200 The cancelled 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_cancellableThe request was rejected, cancelled or revoked.Nothing to do for a decided request; for a started or locked one ask HR.
422already_startedAn approved permission whose window has begun.Nothing to do for a decided request; for a started or locked one ask HR.
422payroll_lockedAn approved permission on a date whose payroll is closed.Nothing to do for a decided request; for a started or locked one ask HR.
422employee_requiredThe token's owner is a company user with no employee record, so they have no permission requests.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 →