QHR Developers

Confirm an end-of-service package

POST/termination_packages/{id}/confirm
Needs a read & write tokenManage employee offboarding time_off/manage_offboardingRequires feature time_offNot available in Claudetermination_packages.confirm

Makes the package real. In a company not using accounting approval it completes at once (200, status paid): the employee's loans are settled from it, deducting custody is settled and held assets are handed to the confirming employee, an offboarding record is created and the employee moves to notice_period (inactive after the last working day), approved leave after the last day is cancelled, pending bonuses and deductions are claimed so payroll never pays them twice, and the payout is recorded as a payment.

In a company connected to Qoyod with approval on, it is submitted instead (202, status pending_accounting): the events go to the accountant, and all of the above happens only when every decision comes back approved. A decline returns it to declined, with the employee untouched.

When to use: once the package is final. It cannot be confirmed while stale or with blockers; when the employee still holds company assets send acknowledge_held_custody: true.

Prerequisites: the package id from termination_packages.list; check actions.can_confirm with termination_packages.show. The token's owner must be an employee (recorded as the confirmer).

Side effects: ends the employment and moves money, as above; effects lists what was done. Recorded in the audit log and sent to accounting when connected. Irreversible once paid, so not offered to Claude.

Irreversible operation

This operation cannot be undone and can affect the whole company. Double-check the ids before you call it. For safety it is never offered through Claude.

Before you call this

You will need ids that come from these operations:

Parameters

NameInTypeDescriptionExample
idRequiredpathintegerTermination package id, from termination_packages.list.41
Accept-LanguageheaderstringLanguage of messages and translated labels. English when omitted.
Allowed values: ar, en
ar

Request body

application/json

FieldTypeDescription
acknowledge_held_custodybooleanRequired (true) when the package lists held_custody: HR acknowledges the assets still with the employee.

Response

200 Completed: the package is paid.

FieldTypeDescription
recordobjectA termination package in full: the frozen calculation, the money, what happened on approval and what may be done next.
record.idintegerPackage id.
record.referencestringReference, e.g. EOS-0041.
record.statusstringdraft (saved calculation, nothing happened yet), pending_accounting (confirmed, waiting for the accountant in Qoyod), declined (refused by accounting, editable again), paid (approved and the payout recorded) or cancelled.
Allowed values: draft, pending_accounting, declined, paid, cancelled
record.status_label_enstringStatus in English.
record.status_label_arstringStatus in Arabic.
record.include_last_payrollbooleanTrue when the final partial month is paid in the package (and the employee is kept off the payroll run for it); false when payroll pays it.
record.employeeobjectThe leaving employee.
record.employee.idintegerEmployee id.
record.employee.employee_nostringEmployee number.
record.employee.name_enstringName in English.
record.employee.name_arstringName in Arabic.
record.employee.departmentstringDepartment.
record.employee.employment_statusstringEmployment status key (active, notice_period, inactive).
record.last_working_daystring (date)Last working day.
record.payment_datestring (date)Date the package is paid.
record.compensation_totalstringWhat the employee is owed (HR's figure when overridden).
record.offsets_totalstringLoans, deductions and custody taken off.
record.net_payoutstringWhat is paid: compensation minus offsets.
record.currencystringCurrency, ISO code.
record.has_overridebooleanTrue when HR entered a total different from the calculated one.
record.payment_statusstringWhether the payout is recorded.
record.accountingobjectmode (legacy, or approval when an accountant must approve in Qoyod) and gate.
record.created_atstringWhen it was created, UTC ISO 8601.
record.reasonobjectA reason an employment can end, as the Ministry of Human Resources lists it.
record.reason.idintegerMinistry reason id (there is no 8 or 10).
record.reason.codestringStable key, e.g. resignation, contract_expiry, article_80.
record.reason.name_enstringName in English.
record.reason.name_arstringName in Arabic.
record.reason.payout_classstringEffect on the award: full, none (e.g. Article 80) or tiered (resignation: none under 2 years, one third 2–5, two thirds 5–10, full from 10).
Allowed values: full, none, tiered
record.computed_compensation_totalstringWhat QHR calculated.
record.overrideobjectWhen overridden: computed, entered, variance, reason.
record.paymentobjectThe recorded payout: id, reference, kind, purpose, date, amount.
record.breakdownobjectThe calculation frozen when saved: service (tenure), wage_base, gratuity (award and tier), leave_encashment, final_salary, bonuses, deductions, loans, custody, totals.
record.custodyarray<object>Custody whose value is deducted from the package.
record.held_custodyarray<object>Assets still held, to be acknowledged at confirm.
record.calculated_atstringWhen the figures were calculated.
record.confirmed_atstringWhen it was confirmed.
record.approved_atstringWhen it became final.
record.paid_atstringWhen the payout was recorded.
record.cancelled_atstringWhen it was cancelled.
record.created_byobjectWho created it.
record.confirmed_byobjectWho confirmed it.
record.stalebooleanTrue when the employee's data changed since the calculation; recalculate before confirming.
record.stale_reasonsarray<object>What changed.
record.blockersarray<object>What prevents confirming (code, message).
record.decisions_outstandingintegerAccounting decisions still awaited.
record.loan_settlementsarray<object>The loans this package settles.
record.effectsobjectAfter confirmation: new employment status, offboarding record, cancelled leave, settled loans, claimed bonuses and deductions, custody, and the payment created.
record.actionsobjectWhat may be done now: can_edit, can_recalculate, can_confirm, can_cancel.

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.
422package_not_confirmableThe package is not a draft or declined one (already confirmed, paid or cancelled).Read its status with termination_packages.show.
422package_staleThe employee's data changed since the calculation; stale_reasons says what.Run termination_packages.recalculate, then confirm.
422held_custody_unacknowledgedThe employee still holds company assets (held_custody) and they were not acknowledged.Send acknowledge_held_custody: true.
422held_custody_self_transferThe confirming employee is the leaving employee, so held assets would be handed to themselves.Have another HR employee confirm.
422custody_unclaimed_deductingA deducting custody of the employee is not covered by the package.Recalculate the package so it includes the custody.
422employee_not_activeThe employee is no longer active (already serving notice or gone).Nothing to do here; a package is only for an active employee.
422loan_not_settleableOne of the employee's loans cannot be settled from the package; reference names it.Resolve that loan first (hr_loans.show).
422custody_installment_in_flightA custody installment is on a payroll run that is not finished; reference names it.Finish or revert that payroll run first.
422offsets_exceed_compensationLoans, deductions and custody owed exceed what the employee is owed; the message gives the shortfall.Settle part of the loans or custody first, or raise the total.
422payable_not_positiveWith accounting approval on, what remains after deductions and custody would be zero or less, which Qoyod refuses.Override the total with a reason, or settle the custody first.
422employee_requiredThe token's owner has no employee record in this company; every change to a package is stamped with the employee who made it.Use a token created by a person who is an employee here.
422no_active_salaryThe employee has no active salary, so there is no wage to calculate from.Give the employee an active salary (salaries.create).
422no_join_dateThe employee has no join date, so the length of service is unknown.Set the join date with employees.update (employment_detail.join_date).
422unknown_reasonreason_id is not one of the ministry's reasons.Pick an id from termination_reasons.list.
422last_working_day_requiredlast_working_day is missing or not a date.Send the last working day as YYYY-MM-DD.
422last_working_day_before_join_dateThe last working day is before the employee joined.Correct the last working day, or the join date.
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 →