List loans' delivery to Qoyod accounting
GET
/hr_loans/accounting_syncRead token is enoughView all employees' loans
loan/view_othersRequires feature loanAvailable in Claudehr_loans.accounting_syncReturns every decided loan and whether its accounting events — the payout (loan.disbursed) and, for a direct loan, the repayment (loan.repaid) — reached Qoyod: one roll-up sync_state per loan (problem, syncing, awaiting_accounting, synced) with the per-event detail, and a summary of the counts. A company not connected to Qoyod gets an empty list and connection_status: not_connected.
When to use: for "did all our loans reach the books?" or to find loans to re-send with hr_loans.resync (can_sync: true).
Prerequisites: none. Re-sending needs "Connect, configure and send to the accounting integration".
Side effects: none. Up to 50 per page.
Parameters
| Name | In | Type | Description | Example |
|---|---|---|---|---|
sync_state | query | string | Only loans in this roll-up state (or an event state such as failed, posted). all by default.Allowed values: all, problem, syncing, awaiting_accounting, synced | problem |
status | query | string | Only loans in this status. Allowed values: all, pending_accounting, pending_settlement, approved, repaying, settled | approved |
period | query | string | Month of the latest event, YYYY-MM. | 2026-11 |
sort | query | string | Sort field; event_at (latest event) by default.Allowed values: event_at, decided_at, amount | event_at |
direction | query | string | Sort direction; desc by default.Allowed values: asc, desc | desc |
page | query | integer | Page number, starting at 1. min 1 | 1 |
per_page | query | integer | Records per page. Each list states its maximum. min 1 | 20 |
Accept-Language | header | string | Language of messages and translated labels. English when omitted. Allowed values: ar, en | ar |
Response
200 The sync list.
| Field | Type | Description |
|---|---|---|
connection_status | string | connected, needs_reauth, disconnected or not_connected. |
sync_enabled | boolean | True when sending to Qoyod is switched on. |
summary | object | Counts: total, synced, syncing, awaiting_accounting, problem. |
recordsRequired | array<object> | One row per loan. |
records[].loan_id | integer | Loan id. |
records[].reference | string | Loan reference. |
records[].employee_id | integer | Borrower. |
records[].status | string | Loan status. |
records[].channel | string | payroll or direct. |
records[].employee_no | string | Employee number. |
records[].employee_name | string | Borrower's name. |
records[].currency | string | Currency. |
records[].amount | string | Amount, decimal string. |
records[].disbursement_date | string | Payout date. |
records[].decided_at | string | When HR decided. |
records[].sync_state | string | problem, syncing, awaiting_accounting or synced. |
records[].can_sync | boolean | True when hr_loans.resync would send something. |
records[].events | array<object> | Per event: event_type, state, sync_reason, reason, journal_entry, attempts, can_sync… |
paginationRequired | object | |
pagination.current_pageRequired | integer | This page's number. |
pagination.per_pageRequired | integer | Records per page. |
pagination.total_entriesRequired | integer | Records across all pages. |
pagination.pagesRequired | integer | Number of pages. |
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. |
entitlement_blocked · 429 rate_limited · 500 internal_error