QHR Developers

Edit my permission request

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

Changes the date, times or note of one of the token owner's own permission requests (hourly leave of absence) while nobody has approved it yet. Send the whole window again; every rule of permission_requests.create is checked again, except that the attendance profile may have switched permission requests off since. The approval route and the current approver do not change.

When to use: to correct a request before it is approved. Once the manager or HR has approved it, cancel it with permission_requests.cancel and file a new one.

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

Side effects: recorded in the audit log. The approver is not notified again.

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
permission_requestRequiredobjectThe window. Times are wall-clock times in the employee's attendance profile timezone.
permission_request.datestring (date)The working day, YYYY-MM-DD.
permission_request.start_timestringStart, HH:MM (24-hour).
permission_request.end_timestringEnd, HH:MM. Must be after the start on the same day (an overnight shift may wrap past midnight).
permission_request.notestringReason, up to 500 characters.
permission_request.remove_attachmentbooleanEdit only: true removes the attached file.

Response

200 The request after the change.

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
400bad_requestA parameter is missing or malformed.Check the parameters against this operation's documentation.
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.
422disabled_on_shiftThe attendance profile does not allow permission requests.Read error and change the date or times.
422not_working_dayThe date is not a working day.Read error and change the date or times.
422no_shiftThe day has no start and end time.Read error and change the date or times.
422outside_shiftThe window is outside the shift.Read error and change the date or times.
422whole_shiftThe window covers the whole shift: request a leave instead.Read error and change the date or times.
422covers_requiredThe window covers all the required hours: request a leave instead.Read error and change the date or times.
422invalid_durationThe end is not after the start.Read error and change the date or times.
422shift_startedA late arrival asked for after the shift began.Read error and change the date or times.
422shift_endedToo late: the shift has ended; justify the attendance incident instead.Read error and change the date or times.
422day_endedToo late: the day has ended; justify the attendance incident instead.Read error and change the date or times.
422overlappingAnother pending or approved request covers part of the window.Read error and change the date or times.
422payroll_lockedPayroll for the date is closed.Read error and change the date or times.
422not_editableEdit only: someone already approved it.Read error and change the date or times.
422attachment_invalidThe attachment is not valid.Read error and change the date or times.
422invalidA field is not valid, e.g. the note is too long.Read error and change the date or times.
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 →