Request a loan for a team member
/team_loansloan/create_for_teamRequires feature loanNot available in Claudeteam_loans.createSubmits a loan request on behalf of one of the token owner's direct reports. It joins HR's queue as pending, recording the manager as the one who asked; HR approves or rejects it on hr_loans.
When to use: when a manager asks for an advance for someone in their team. The employee may hold only one request awaiting a decision.
Prerequisites: employee_id of a current direct report, from employees.team. Anyone else — another manager's report, a leaver, yourself — answers 404.
Side effects: everyone who may approve loans, except the manager, is emailed; the manager is emailed again once HR decides. Recorded in the audit log. Not offered to Claude, because it starts a loan for someone other than the person asking.
Not available in Claude yet.
Before you call this
You will need ids that come from these operations:
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 |
|---|---|---|
loanRequired | object | The request. |
loan.amountRequired | string | Amount wanted, decimal string, more than 0. |
loan.descriptionRequired | string | Why it is needed, up to 1000 characters. |
loan.needed_onRequired | string (date) | Date the money is needed. |
employee_idRequired | integer | A current direct report, from employees.team. |
Response
201 The new request.
| Field | Type | Description |
|---|---|---|
record | object | A loan with its decision and schedule. |
record.id | integer | Loan id. |
record.reference | string | Loan reference, e.g. LON-0042. |
record.status | string | Status: pending (waiting for HR), pending_accounting (HR approved, an accountant in Qoyod is deciding), approved (lent, nothing repaid yet), repaying (installments being collected), pending_settlement (a settlement waits for the accountant), settled (paid back), rejected or cancelled.Allowed values: pending, pending_accounting, approved, repaying, pending_settlement, settled, rejected, cancelled |
record.channel | string | How the money moves, chosen by HR at approval: payroll (paid out on a payslip and repaid in monthly installments deducted from pay) or direct (paid out and repaid in one payment outside payroll). Null until approved.Allowed values: payroll, direct, null |
record.installments_count | integer | Number of installments (payroll loans). |
record.currency | string | The employee's pay currency, ISO code. |
record.amount | string | Amount lent. Decimal string. |
record.needed_on | string (date) | Date the employee needs the money. |
record.submitted_at | string | When it was requested, ISO 8601 UTC. |
record.description | string | Why the employee needs it. |
record.disbursement_date | string (date) | Payout date. |
record.installments_start_on | string (date) | First installment month. |
record.installments_end_on | string (date) | Last installment month. |
record.repayment | object | Where a direct loan's single repayment stands; null for a payroll loan or one not approved. |
record.repayment.due_on | string (date) | Repayment due date. |
record.repayment.repaid_on | string (date) | Date it was repaid. |
record.repayment.state | string | not_due, due_soon (within 3 days), overdue, paid_early, paid_on_time or paid_late. |
record.repayment.days | integer | Days to, past or early/late against the due date, by state. |
record.payments | array<object> | Payments behind a direct loan: the payout (paid) and the repayment (received). Always empty for a payroll loan, whose money moves on the payslip. |
record.payments[].id | integer | Payment id. |
record.payments[].reference | string | Payment reference. |
record.payments[].kind | string | paid (to the employee) or received (from them). |
record.payments[].purpose | string | disbursement or repayment. |
record.payments[].date | string (date) | Payment date. |
record.payments[].amount | string | Amount. Decimal string. |
record.payments[].currency | string | The employee's pay currency, ISO code. |
record.decision | object | HR's decision; null while pending. |
record.decision.by | integer | Employee id of who decided. |
record.decision.name | string | Their name. |
record.decision.at | string | When, ISO 8601 UTC. |
record.decision.note | string | Note to the employee. |
record.installments | array<object> | The repayment schedule (payroll loans). |
record.installments[].id | integer | Installment id. |
record.installments[].sequence | integer | Its number, from 1. |
record.installments[].payroll_id | integer | The payroll run collecting it; null until a run claims it. |
record.installments[].due_on | string (date) | Month it is deducted (first day). |
record.installments[].amount | string | Amount. Decimal string. |
record.installments[].currency | string | The employee's pay currency, ISO code. |
record.installments[].status | string | due or paid.Allowed values: due, paid |
record.installments_paid | integer | Installments collected; null before approval. |
record.installments_remaining | integer | Installments still to collect; null before approval. |
record.amount_repaid | string | Repaid so far. Decimal string. |
record.outstanding | string | Still owed. Decimal string. |
record.editable | boolean | True while it can be changed. |
record.cancellable | boolean | True while it can be withdrawn. |
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. |
| 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 | Some fields are missing or not valid. | Fix the fields named in error (and errors when present), then send again. |
| 422 | validation_failed | The employee already has a loan request awaiting a decision (named in error); only one may wait at a time. | Wait for that request to be decided, or cancel it with loans.cancel. |
| 422 | employee_required | The token's owner has no employee record in this company. | Use a token created by a person who is an employee here. |
entitlement_blocked · 429 rate_limited · 500 internal_error