QHR Developers

Approve a request

PATCH/tickets/{id}/approve
Needs a read & write tokenRaise and follow requests; approve as direct manager; work requests of own department ticket/requestRequires feature ticketAvailable in Claudetickets.approve

Approves a request at the stage it waits in. At the manager stage (pending_manager) only the requester's current direct manager decides; at the HR stage (pending_hr) anyone with Requests › manage. Nobody approves their own request.

What happens: a manager approval moves it to HR when the flow is "manager then HR", otherwise to the department queue (open). Reaching open starts the clock: the due date becomes today + the type's target days.

When to use: when the owner agrees to a request waiting on them. To decide many at once, use ticket_approvals.bulk_approve.

Prerequisites: the request's id, from ticket_approvals.list (which lists exactly what the owner may decide).

Side effects: an entry in the activity log. Notified in QHR and by email: HR when it moves to the HR stage; otherwise the requester (approved) and the handling department's members (new request in the queue).

Before you call this

You will need ids that come from these operations:

Parameters

NameInTypeDescriptionExample
idRequiredpathintegerRequest id (id, not the TKT-… reference), from tickets.list or ticket_approvals.list.5012
Accept-LanguageheaderstringLanguage of messages and translated labels. English when omitted.
Allowed values: ar, en
ar

Response

200 The request after the approval.

FieldTypeDescription
idRequiredintegerRequest id.
referencestringReference people quote, e.g. TKT-000123.
subjectstringSubject the requester wrote (up to 120 characters).
statusRequiredstringWhere the request is: pending_manager (waiting for the direct manager), pending_hr (waiting for HR), open (approved, in the department queue, nobody on it yet), assigned (given to someone who has not accepted yet), in_progress (someone is working on it), in_review (done, waiting for the requester to confirm), closed, rejected or cancelled (the last three are final).
Allowed values: pending_manager, pending_hr, open, assigned, in_progress, in_review, closed, rejected, cancelled
prioritystringPriority: low, medium, high or highest. Set by the request type; only HR changes it.
Allowed values: low, medium, high, highest
target_daysintegerDays the department has to finish once the request is approved.
typeobjectThe request type.
type.idintegerId.
type.name_enstringName in English.
type.name_arstringName in Arabic.
type.namestringName in the requested language.
categoryobjectThe type's category, with its icon and color.
category.idintegerId.
category.name_enstringName in English.
category.name_arstringName in Arabic.
category.namestringName in the requested language.
category.iconstringIcon key.
category.colorstringColour key; null for the default colour.
departmentobjectThe department handling the request.
department.idintegerId.
department.name_enstringName in English.
department.name_arstringName in Arabic.
department.namestringName in the requested language.
requesterobjectWho raised the request.
requester.idintegerEmployee id.
requester.namestringFull name, in the requested language.
requester.department_namestringTheir department.
assigneeobjectWho is working on it; null while nobody is.
assignee.idintegerEmployee id.
assignee.namestringFull name, in the requested language.
assignee.department_namestringTheir department.
due_onstring (date)Due date: set when the request is approved (approval day + target_days); HR can move it.
overduebooleanTrue when it is open, assigned or in_progress and past its due date.
last_activity_atstring (date-time)Last time anything happened on it, UTC.
created_atstring (date-time)When it was submitted, UTC.
available_actionsarray<string>What the token's owner may do on this request now, as the operation's last word: approve, reject, take, assign, accept, reject_work, send_for_review, send_back, close, cancel, priority, due_date (e.g. take → tickets.take). Check it before calling a member action.
descriptionstringFree text the requester added (up to 5,000 characters).
approval_flowstringApprovals the request goes through, copied from its type at submission: none, manager, hr or manager_and_hr.
Allowed values: none, manager, hr, manager_and_hr
opened_atstring (date-time)When it entered the department queue (approved), UTC.
assigned_atstring (date-time)When it was last taken or assigned, UTC.
review_started_atstring (date-time)When it was sent for review, UTC.
auto_close_onstring (date)While in review: the day it closes by itself if the requester does nothing.
closed_atstring (date-time)When it reached a final status, UTC.
manager_approvalobjectThe direct manager's decision; null until they decide.
manager_approval.approverobjectWho decided.
manager_approval.approver.idintegerEmployee id.
manager_approval.approver.namestringFull name, in the requested language.
manager_approval.approver.department_namestringTheir department.
manager_approval.acted_atstring (date-time)When, UTC.
hr_approvalobjectHR's decision; null until HR decides.
hr_approval.approverobjectWho decided.
hr_approval.approver.idintegerEmployee id.
hr_approval.approver.namestringFull name, in the requested language.
hr_approval.approver.department_namestringTheir department.
hr_approval.acted_atstring (date-time)When, UTC.
answersarray<object>The form as submitted, one entry per field of the type's form at that time.
answers[].keystringField key.
answers[].typestringField type (short_text, long_text, number, date, date_range, select, multi_select, checkbox, file, employee).
answers[].label_enstringLabel in English.
answers[].label_arstringLabel in Arabic.
answers[].labelstringLabel in the requested language.
answers[].widthintegerLayout width on a 12-column grid (12, 6 or 4).
answers[].optionsarray<object>Choices of a select / multi_select field.
answers[].valueanyThe answer: text, number, YYYY-MM-DD, { from, to }, an option key or keys, true/false, or { id, name } for an employee field. Null when not answered or a file field.
answers[].filesarray<object>Files of a file field.
answers[].files[].idintegerFile id.
answers[].files[].namestringFile name.
answers[].files[].urlstringTemporary download link.
answers[].files[].sizeintegerSize in bytes.
answers[].files[].content_typestringapplication/pdf, image/jpeg or image/png.
progressarray<object>The progress tracker: submitted, then manager / hr as the flow needs, department, target. state is done, current, failed (it ended there) or pending.
progress[].stepstringStep key.
progress[].statestringStep state.
Allowed values: done, current, failed, pending
progress[].labelstringLabel to show.
progress[].actorobjectWho acted at this step.
progress[].actor.idintegerEmployee id.
progress[].actor.namestringFull name, in the requested language.
progress[].actor.department_namestringTheir department.
progress[].atstringWhen (a date for target).
progress[].notestringExtra note.
can_view_conversationbooleanTrue when the owner may read the conversation (ticket_comments.list).
can_commentbooleanTrue when the owner may post (ticket_comments.create).
requester_activebooleanFalse when the requester has left the company; HR may then close the request.

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.
422validation_failedThe action is not possible now: the request is not in a status this action starts from (or someone acted first), the token's owner is not the person who may do it, or a value is missing or not valid (reason, comment, assignee…). error says which.Read the request again with tickets.show, check available_actions, and send the missing value.
422employee_requiredThe token's owner is not linked to an employee in this company; requests are raised and handled by employees.Link the owner's login to their employee record in QHR, or use a token of a user who has one.
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 →