Skip to main content

Apply To Purchase Invoices

POST 

/api/vendor-deposits/:vendorDepositId/applications

Apply a paid deposit's unapplied balance to one or more purchase invoices (bills) of the same supplier.

Required scope: accounting:write

Grant this scope to your token under Settings → Developer → Personal Access Tokens.

Authentication: Requires Bearer token.

Body fields:

  • applications (array, required, min 1)
    • applications.*.purchase_invoice_id (integer, required) — an existing bill.
    • applications.*.amount_in_deposit_currency (number, required, > 0) — the amount to apply, in the deposit's currency.

The request is all-or-nothing: if any application is refused, none of them is saved, so a 422 always means nothing changed. An application is refused when the deposit can't be applied, the bill belongs to another supplier, the amount is more than the deposit's unapplied balance, or the amount is more than the bill still owes (its total with tax, less payments, deposits and vendor credits already applied). The 422 body carries an error message that ends with "Nothing was applied — correct the amount and try again." Use the preview endpoint to check an amount first.

Returns the updated deposit, with its new amount_applied and available_balance.

Request​

Responses​

OK

Response Headers
    Content-Type