Request a permission (hourly leave of absence)
/permission_requestsattendance/view_ownRequires feature attendanceAvailable in Claudepermission_requests.createAsks, 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
| Name | In | Type | Description | Example |
|---|---|---|---|---|
Accept-Language | header | string | Language of messages and translated labels. English when omitted. Allowed values: ar, en | ar |
Request body
application/json
| Field | Type | Description |
|---|---|---|
permission_requestRequired | object | The window. Times are wall-clock times in the employee's attendance profile timezone. |
permission_request.date | string (date) | The working day, YYYY-MM-DD. |
permission_request.start_time | string | Start, HH:MM (24-hour). |
permission_request.end_time | string | End, HH:MM. Must be after the start on the same day (an overnight shift may wrap past midnight). |
permission_request.note | string | Reason, up to 500 characters. |
permission_request.remove_attachment | boolean | Edit only: true removes the attached file. |
Response
201 The new request, waiting for a decision.
| Field | Type | Description |
|---|---|---|
recordRequired | object | A permission request: an hourly leave of absence on one working day. |
record.idRequired | integer | Permission request id. |
record.reference | string | Reference shown to people, PRM-<id>. |
record.employee_idRequired | integer | The employee who asked. |
record.employee_no | string | Their employee number. |
record.employee_name | string | Their full name. |
record.dateRequired | string (date) | The working day the permission is for. |
record.start_timeRequired | string | Start, wall-clock time HH:MM in the attendance profile's timezone. |
record.end_timeRequired | string | End, wall-clock time HH:MM in the attendance profile's timezone. |
record.starts_at | string (date-time) | Absolute start, in UTC. For an overnight shift it may fall on the next calendar day. |
record.ends_at | string (date-time) | Absolute end, in UTC. |
record.minutes | integer | Length in minutes. |
record.hours | number | Length in hours, two decimals. |
record.kind | string | What 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.note | string | The employee's reason (up to 500 characters). |
record.statusRequired | string | pending_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_route | string | Who 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_type | string | For 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_name | string | Who must decide now: the manager's name, or "HR". Null once decided. |
record.attachment | object | Supporting file, if one was added in the QHR app: filename, content_type, byte_size and a temporary download url. |
record.actions | object | What 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_edit | boolean | May edit it (permission_requests.update). |
record.actions.can_cancel | boolean | May cancel it (permission_requests.cancel). |
record.actions.can_approve | boolean | May approve it (permission_requests.approve). |
record.actions.can_reject | boolean | May reject it (permission_requests.reject). |
record.actions.can_withdraw | boolean | May withdraw their approval (permission_requests.withdraw). |
record.actions.can_revoke | boolean | May revoke the approval (permission_requests.revoke). |
record.actions.blocked_reason | string | Why approving is blocked, or null. |
record.manager | object | The manager's decision, once they acted. |
record.manager.id | integer | Employee id of the person who acted. |
record.manager.name | string | Their full name. |
record.manager.acted_at | string (date-time) | When, in UTC. |
record.manager.note | string | The note they left. |
record.hr | object | HR's decision, once HR acted. |
record.hr.id | integer | Employee id of the person who acted. |
record.hr.name | string | Their full name. |
record.hr.acted_at | string (date-time) | When, in UTC. |
record.hr.note | string | The note they left. |
record.revoked | object | Who withdrew or revoked the approval, and why. |
record.revoked.id | integer | Employee id of the person who acted. |
record.revoked.name | string | Their full name. |
record.revoked.acted_at | string (date-time) | When, in UTC. |
record.revoked.note | string | The note they left. |
record.cancelled_at | string (date-time) | When the employee cancelled it, in UTC. |
record.created_at | string (date-time) | When it was filed, in UTC. |
record.attendance_profile | object | Only on permission_requests.show: the employee's shift that day (shift_start, shift_end, day_type, flexible, scheduled_hours, grace_period_minutes). |
Errors
| HTTP | Code | Meaning | How to fix |
|---|---|---|---|
| 400 | bad_request | A parameter is missing or malformed. | Check the parameters against this operation's documentation. |
| 401 | token_missing | No Authorization: Bearer … header, or it is malformed. | Send Authorization: Bearer qhr_… with the full token. |
| 401 | token_invalid | The 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. |
| 401 | token_expired | The token is past its expiry date. | Create a new token. |
| 401 | token_revoked | The 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. |
| 401 | tenant_inactive | The company account is suspended. | Contact QHR support. |
| 403 | token_read_only | This token can only read; the operation makes changes. | Use a token created with "Allow changes". |
| 403 | forbidden | The token owner's role lacks the permission this operation needs. | Ask an admin to grant the permission shown on this operation (x-permission). |
| 403 | employee_inactive | The token owner's employee record is not active. | HR must reactivate the employee record. |
| 403 | tenant_access_revoked | The 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. |
| 422 | disabled_on_shift | The attendance profile does not allow permission requests. | Read error and change the date or times. |
| 422 | not_working_day | The date is not a working day. | Read error and change the date or times. |
| 422 | no_shift | The day has no start and end time. | Read error and change the date or times. |
| 422 | outside_shift | The window is outside the shift. | Read error and change the date or times. |
| 422 | whole_shift | The window covers the whole shift: request a leave instead. | Read error and change the date or times. |
| 422 | covers_required | The window covers all the required hours: request a leave instead. | Read error and change the date or times. |
| 422 | invalid_duration | The end is not after the start. | Read error and change the date or times. |
| 422 | shift_started | A late arrival asked for after the shift began. | Read error and change the date or times. |
| 422 | shift_ended | Too late: the shift has ended; justify the attendance incident instead. | Read error and change the date or times. |
| 422 | day_ended | Too late: the day has ended; justify the attendance incident instead. | Read error and change the date or times. |
| 422 | overlapping | Another pending or approved request covers part of the window. | Read error and change the date or times. |
| 422 | payroll_locked | Payroll for the date is closed. | Read error and change the date or times. |
| 422 | not_editable | Edit only: someone already approved it. | Read error and change the date or times. |
| 422 | attachment_invalid | The attachment is not valid. | Read error and change the date or times. |
| 422 | invalid | A field is not valid, e.g. the note is too long. | Read error and change the date or times. |
| 422 | employee_required | The 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. |
entitlement_blocked · 429 rate_limited · 500 internal_error