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.
accounting:writeGrant 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
- 200
- 401
- 403
- 404
- 422
- 429
OK
Response Headers
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Not found — no record with the given identifier (or the route does not exist). Verify the ID before retrying.
Unprocessable Entity
Response Headers
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.