BillOS v1
Console llms.txt OpenAPI
POST/businesses/{bid}/documents/{id}/settlements

Match an issued receipt to an invoice

POST /businesses/{bid}/documents/{id}/settlements

Requires the documents scope.

For money received "on account" and matched afterwards: allocates part of an ISSUED receipt's unallocated amount to an open invoice or proforma of the same customer. Not printed on the receipt (that paper is done); removable. A receipt created with settles needs none of this. Fires document.paid when the invoice reaches zero.

Path parameters

NameTypeDescription
bidstringrequiredBusiness id, from POST /businesses.
idstringrequiredReceipt id.

Body

FieldTypeDescription
documentIdstringrequiredThe invoice or proforma.
amountintegerOptional: defaults to what is left on the receipt, capped at the balance. Integer agorot (₪1 = 100).

Response

201: { "ok": true, … }

FieldTypeDescription
okbooleanrequired
settlementSettlementRowrequiredOne receipt paying (part of) one invoice or proforma.
targetSettlementThe open-items view of an issued invoice (305) or proforma (300): total minus the receipts allocated to it minus the credit notes based on it.
paidbooleanThe target reached a zero balance with this allocation.

Errors: 400, 401, 403, 404, 409, 429. Every failure answers { "error", "reason", "hint", "param", "doc_url", "retryable", "request_id" }: branch on reason, and read hint for what to change (https://docs.billos.co.il/errors.md).

POST /businesses/{bid}/documents/{id}/settlements
curl -X POST "$BASE/businesses/$BID/documents/$DOC_ID/settlements" \
  -H "X-Api-Key: $KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "documentId": "string"
  }'
const res = await fetch(`${BASE}/businesses/${BID}/documents/${DOC_ID}/settlements`, {
  method: 'POST',
  headers: {
    'X-Api-Key': KEY,
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
    "documentId": "string"
  }),
})
const data = await res.json()
if (!data.ok) throw new Error(data.reason)
import requests
res = requests.post(
    f"{BASE}/businesses/{BID}/documents/{DOC_ID}/settlements",
    headers={"X-Api-Key": KEY},
    json={
      "documentId": "string"
    },
)
data = res.json()
Set BASE to https://api.billos.co.il/v1 and KEY to your bk_live_… key, or a bk_test_… key to run it against the sandbox.
Manage your businesses, keys and webhooks in the BillOS Console.