Match bank transactions with open documents
https://api.light.inc/v1/bank-accounts/{bankAccountId}/clear-and-reconcile
Registers a bank payment for each allocation item against its open invoice receivable or invoice payable, then matches the bank transactions with the bank payments' lines on this bank account's ledger account, all in one transaction. Fails with 400 and error type BANK_RECONCILIATION_INVALID_CLEARING when the preview of the same request is not valid; the description of summary.isValid on preview-clearing lists what makes it so, each in terms of fields the preview returns. More than 100 bankTransactionIds, accountingDocumentIds or allocation.items fail with BANK_RECONCILIATION_TOO_MANY_ITEMS. When a payment date falls in a closed period it fails with ACCOUNTING_PERIOD_CLOSED; retry with a clearingDate in an open period. A bank transaction that is already matched or excluded fails with BANK_RECONCILIATION_TRANSACTIONS_NOT_VALID before any payment is registered, so retrying a request that already succeeded changes nothing. An invoice or bill paired with one in another entity pays both sides and needs intercompanyCounterpartLedgerAccountId; without it the request fails with INTERCOMPANY_COUNTERPART_ACCOUNT_MISSING and writes nothing.
Authorization
Send one of these on every request. See Authentication for how to get credentials.
- API key
Basic authentication header of the form Basic <api_key>, where <api_key> is your api key.
- Bearer token
Path parameters
-
bankAccountIdstring · uuidrequired
Request body
application/json;charset=UTF-8
-
bankTransactionIdsarray of string · uuidrequiredIDs of unmatched bank transactions of this bank account
-
accountingDocumentIdsarray of string · uuidrequiredIDs of open invoices receivable (AR) or open invoices payable (AP), at most 100. AR and AP can't be mixed in one match.
-
allocationobjectHow the bank transactions pay the documents, at most 100 items. Leave it out to use the allocation Light suggests, the one the preview returns for the same bank transactions and documents.
-
itemsarray of objectrequiredOne item per payment to register against a document
-
accountingDocumentIdstring · uuidrequiredID of the invoice receivable (AR) or invoice payable (AP) the payment clears
-
amountInInvoiceCurrencyinteger · int64requiredAmount the payment clears, in minor units of the invoice's currency
-
amountInBankCurrencyinteger · int64requiredAmount taken from the bank transactions, in minor units of the bank account's currency. Equals
amountInInvoiceCurrencywhen both currencies are the same. -
paymentDatestring · daterequiredDate the payment is registered on
-
feesInBankCurrencyinteger · int64requiredBank fees booked with this payment, in minor units of the bank account's currency; 0 when there are none
-
-
-
clearingDatestring · dateDate to register every payment on, instead of the bank transaction date. When given, it replaces the
paymentDateof every allocation item. Use it to clear into an open period when the bank transaction date falls in a closed one. -
intercompanyCounterpartLedgerAccountIdstring · uuidRequired when the document is an invoice or bill paired with one in another entity of the company, and not allowed otherwise. Clearing a paired document pays both sides. For a bill, this is the ledger account of the bank account that receives the payment on the invoice side; for an invoice, the one that pays the bill. A paired document has to be cleared on its own.
Response
-
idstring · uuidUnique identifier for the matching group
-
bankTransactionIdsarray of string · uuidIDs of the bank transactions in the match, now
MATCHED -
ledgerTransactionLineIdsarray of string · uuidIDs of the ledger transaction lines in the match. When documents were cleared, these are the lines of the bank payments the clearing created; list them with
matchingGroupId:eq:<id>onGET /v1/bank-accounts/{bankAccountId}/ledger-transaction-linesto find each bank payment'saccountingDocumentId.