Reject a request as its assignee
PATCH
/tickets/{id}/reject_workNeeds a read & write tokenRaise and follow requests; approve as direct manager; work requests of own department
ticket/requestRequires feature ticketAvailable in Claudetickets.reject_workThe assignee refuses the work, with a reason the requester will read: an assigned or in_progress request ends as rejected and cannot be reopened. Only the current assignee.
When to use: when the department cannot or will not do what was asked (out of scope, not possible). To hand it to a colleague instead use tickets.assign; an approver refusing before approval uses tickets.reject.
Prerequisites: the request's id, from tickets.show (reject_work in available_actions).
Side effects: a rejected entry in the activity log with the reason; the requester is notified in QHR and by email with the reason.
Before you call this
You will need ids that come from these operations:
Parameters
| Name | In | Type | Description | Example |
|---|---|---|---|---|
idRequired | path | integer | Request id (id, not the TKT-… reference), from tickets.list or ticket_approvals.list. | 5012 |
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 |
|---|---|---|
reasonRequired | string | Reason, up to 500 characters. |
Response
200 The rejected request.
| Field | Type | Description |
|---|---|---|
idRequired | integer | Request id. |
reference | string | Reference people quote, e.g. TKT-000123. |
subject | string | Subject the requester wrote (up to 120 characters). |
statusRequired | string | Where 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 |
priority | string | Priority: low, medium, high or highest. Set by the request type; only HR changes it.Allowed values: low, medium, high, highest |
target_days | integer | Days the department has to finish once the request is approved. |
type | object | The request type. |
type.id | integer | Id. |
type.name_en | string | Name in English. |
type.name_ar | string | Name in Arabic. |
type.name | string | Name in the requested language. |
category | object | The type's category, with its icon and color. |
category.id | integer | Id. |
category.name_en | string | Name in English. |
category.name_ar | string | Name in Arabic. |
category.name | string | Name in the requested language. |
category.icon | string | Icon key. |
category.color | string | Colour key; null for the default colour. |
department | object | The department handling the request. |
department.id | integer | Id. |
department.name_en | string | Name in English. |
department.name_ar | string | Name in Arabic. |
department.name | string | Name in the requested language. |
requester | object | Who raised the request. |
requester.id | integer | Employee id. |
requester.name | string | Full name, in the requested language. |
requester.department_name | string | Their department. |
assignee | object | Who is working on it; null while nobody is. |
assignee.id | integer | Employee id. |
assignee.name | string | Full name, in the requested language. |
assignee.department_name | string | Their department. |
due_on | string (date) | Due date: set when the request is approved (approval day + target_days); HR can move it. |
overdue | boolean | True when it is open, assigned or in_progress and past its due date. |
last_activity_at | string (date-time) | Last time anything happened on it, UTC. |
created_at | string (date-time) | When it was submitted, UTC. |
available_actions | array<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. |
description | string | Free text the requester added (up to 5,000 characters). |
approval_flow | string | Approvals 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_at | string (date-time) | When it entered the department queue (approved), UTC. |
assigned_at | string (date-time) | When it was last taken or assigned, UTC. |
review_started_at | string (date-time) | When it was sent for review, UTC. |
auto_close_on | string (date) | While in review: the day it closes by itself if the requester does nothing. |
closed_at | string (date-time) | When it reached a final status, UTC. |
manager_approval | object | The direct manager's decision; null until they decide. |
manager_approval.approver | object | Who decided. |
manager_approval.approver.id | integer | Employee id. |
manager_approval.approver.name | string | Full name, in the requested language. |
manager_approval.approver.department_name | string | Their department. |
manager_approval.acted_at | string (date-time) | When, UTC. |
hr_approval | object | HR's decision; null until HR decides. |
hr_approval.approver | object | Who decided. |
hr_approval.approver.id | integer | Employee id. |
hr_approval.approver.name | string | Full name, in the requested language. |
hr_approval.approver.department_name | string | Their department. |
hr_approval.acted_at | string (date-time) | When, UTC. |
answers | array<object> | The form as submitted, one entry per field of the type's form at that time. |
answers[].key | string | Field key. |
answers[].type | string | Field type (short_text, long_text, number, date, date_range, select, multi_select, checkbox, file, employee). |
answers[].label_en | string | Label in English. |
answers[].label_ar | string | Label in Arabic. |
answers[].label | string | Label in the requested language. |
answers[].width | integer | Layout width on a 12-column grid (12, 6 or 4). |
answers[].options | array<object> | Choices of a select / multi_select field. |
answers[].value | any | The 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[].files | array<object> | Files of a file field. |
answers[].files[].id | integer | File id. |
answers[].files[].name | string | File name. |
answers[].files[].url | string | Temporary download link. |
answers[].files[].size | integer | Size in bytes. |
answers[].files[].content_type | string | application/pdf, image/jpeg or image/png. |
progress | array<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[].step | string | Step key. |
progress[].state | string | Step state. Allowed values: done, current, failed, pending |
progress[].label | string | Label to show. |
progress[].actor | object | Who acted at this step. |
progress[].actor.id | integer | Employee id. |
progress[].actor.name | string | Full name, in the requested language. |
progress[].actor.department_name | string | Their department. |
progress[].at | string | When (a date for target). |
progress[].note | string | Extra note. |
can_view_conversation | boolean | True when the owner may read the conversation (ticket_comments.list). |
can_comment | boolean | True when the owner may post (ticket_comments.create). |
requester_active | boolean | False when the requester has left the company; HR may then close the request. |
Errors
| HTTP | Code | Meaning | How to fix |
|---|---|---|---|
| 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. |
| 404 | not_found | The record does not exist, or you cannot see it. | Check the id. List the records first to get a valid one. |
| 422 | validation_failed | The 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. |
| 422 | employee_required | The 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. |
entitlement_blocked · 429 rate_limited · 500 internal_error