QHR Developers

Approve a permission request (hourly leave)

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

Approves an employee's permission request (hourly leave of absence) at the stage it waits at. At the manager stage only the employee's current manager may act: on the manager route the request becomes approved; on manager_and_hr the manager's approval is a recommendation and the request moves to pending_hr. At the HR stage any HR approver ("View attendance reports") may act, and the request becomes approved. Nobody may decide their own request.

Effect on pay: once approved, the covered time excuses the late arrival, early leave or short hours it overlaps on that day, so they are not deducted; if the day already has attendance, it is recalculated at once (a late check-in inside the window reads Present). Approval is refused when payroll for the date is closed, or when the day's late / early / short-hours incident has already been deducted or ignored (actions.blocked_reason); rejecting stays possible.

When to use: when the manager or HR says "approve Sara's permission for Monday". Find the request in permission_requests.team_pending (manager) or permission_requests.hr_list (HR).

Prerequisites: the request id where actions.can_approve is true; a token created by a user linked to an employee record.

Side effects: the employee is notified (in-app and email) when it is approved; on manager_and_hr every HR approver is notified instead that it waits for them. Recorded in the audit log. Not offered to Claude: a final approval removes the day's pending late or early-leave deductions, which changes pay.

Not available in Claude yet.

Before you call this

You will need ids that come from these operations:

  • actions.can_approve

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
notestringNote for the employee, up to 500 characters.

Response

200 The request after the decision.

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.
422payroll_lockedPayroll for the date is closed.Read error. Reload the request with permission_requests.show and act only where actions allows it.
422incident_decidedThe day's incident was already deducted or ignored; reject instead.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 →