Preview the salary deductions of a return
/custodies/{id}/return_previewcustody/manage_custodyRequires feature custodyNot available in Claudecustodies.return_previewWorks out, without saving anything, the salary-deduction schedule that custodies.return would create for a damaged or lost asset the employee pays for: how many monthly installments, the regular and last amounts, the first month, every row, and — with labor_law_cap — the monthly cap of five days' wage and the wage it comes from. Deductions start with the payroll of the return month.
When to use: before returning an asset at the employee's cost, to show them what will be deducted. It is a POST only because it takes the return's details; it saves nothing, so a read token may call it.
Prerequisites: the custody id from custodies.list (it must be held). Needs "Manage custody".
Side effects: none — nothing is saved, no one is notified.
Not offered to Claude: the answer carries the employee's monthly wage (monthly_wage), which the custody permission alone should not bring into a chat.
Not available in Claude yet.
Before you call this
You will need ids that come from these operations:
Parameters
| Name | In | Type | Description | Example |
|---|---|---|---|---|
idRequired | path | integer | Custody id, from custodies.list. | 311 |
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 |
|---|---|---|
returned_onRequired | string (date) | Return date; not in the future, not before held_since. |
conditionRequired | string | damaged or lost.Allowed values: intact, damaged, lost |
compensation_amount | string | Cost to recover, at most the value. For lost, the full value when omitted. |
borne_byRequired | string | employee (a schedule exists only then).Allowed values: company, employee |
installments_count | integer | Number of months, 1 to 120. Ignored with labor_law_cap. |
labor_law_cap | boolean | Let QHR set the months so no month takes more than five days' wage (needs an active salary). |
Response
200 The schedule the return would create.
| Field | Type | Description |
|---|---|---|
count | integer | Number of monthly installments. |
per_installment | string | Regular installment. |
last_installment | string | Last installment (absorbs the rounding). |
monthly_cap | string | Five days' wage, with labor_law_cap; else null. |
monthly_wage | string | Basic salary plus allowances the cap is based on; else null. |
first_due_on | string (date) | Month of the first deduction. |
schedule | array<object> | Every installment. |
schedule[].sequence | integer | Installment number. |
schedule[].due_on | string (date) | Payroll month. |
schedule[].amount | string | Amount. |
currency | string | Currency (the holder's pay currency). |
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 | 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 | not_held | The asset is no longer held by an employee (returned or being deducted). | Check its status with custodies.show. |
| 422 | date_in_future | The date is after today in the company time zone. | Send today or an earlier date. |
| 422 | date_before_held_since | The date is before the current holder received the asset. | Send a date on or after held_since. |
| 422 | condition_required | condition is missing or not intact, damaged or lost. | Send one of the three. |
| 422 | not_employee_paid | Only a damaged or lost asset the employee pays for has a schedule. | Send condition damaged or lost and borne_by: employee. |
| 422 | amount_required | A damaged asset needs a compensation amount above zero. | Send compensation_amount. |
| 422 | amount_exceeds_value | The compensation is more than the custody value. | Send at most the value shown by custodies.show. |
| 422 | borne_by_required | borne_by is missing or not company / employee. | Say who pays. |
| 422 | employee_has_package | The employee is leaving or has a termination package, so the cost cannot be recovered in installments. | Return it at the company cost, or let the termination package recover it. |
| 422 | installments_required | No number of installments was given. | Send installments_count (1 or more), or labor_law_cap: true. |
| 422 | installments_count_invalid | More than 120 installments, or under 0.01 each. | Choose fewer months. |
| 422 | no_active_salary | The labour-law cap needs the employee active salary, above zero. | Set the salary, or send installments_count instead of labor_law_cap. |
entitlement_blocked · 429 rate_limited · 500 internal_error