QHR Developers

Request a permission (hourly leave of absence)

POST/permission_requests
Needs a read & write tokenCheck in/out and view own attendance history attendance/view_ownRequires feature attendanceAvailable in Claudepermission_requests.create

Asks, in advance, for the token owner to be away for a few hours of one working day: arrive late, leave early or step out during the shift. This is an hourly leave of absence, not an access right; for a whole day, request a leave instead. QHR places the window on the owner's shift and works out its kind: starting at the shift start is a late_arrival, ending at the shift end an early_leave, anything else inside the shift mid_shift; on a flexible day it is flexible and must be shorter than the required hours.

Rules: the attendance profile must allow permission requests; the date must be a working day; the window must lie inside the shift and not cover all of it; it may not overlap the owner's other pending or approved requests; payroll for the date must still be open. Deadlines: a late arrival before the shift starts, an early leave or mid-shift absence before the shift ends, a flexible day before the day ends. After that, justify the attendance incident instead. There is no monthly limit on the number or hours.

Approval chain: set by the attendance profile and fixed for this request (approval_route): manager (the direct manager decides), hr (HR decides), or manager_and_hr (the manager recommends, then HR decides). The request starts with the manager, or with HR when the route is hr or the owner has no manager who can approve attendance.

Effect on pay: once approved, the covered time excuses the matching late arrival, early leave or short hours on that day, so it is not deducted; a late check-in inside an approved late arrival reads Present.

When to use: when the owner says "I need to leave at 3 on Monday" or "I'll be two hours late tomorrow". Check the day first with permission_requests.day_context.

Prerequisites: a token created by a user who is linked to an employee record.

Side effects: the manager (or every HR approver) gets an in-app notification and an email asking for a decision. Recorded in the audit log. Attachments can only be added in the QHR app.

Parameters

NameInTypeDescriptionExample
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

201 The new request, waiting for a 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
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.
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 →