Error codes
What to do for each code that Treasury adds to the shared ones, and the code behind each refusal of the product.
On this page
A refused request answers with the error object and a stable code, and a refusal changes nothing. The object, the codes every API shares and which of them to retry are on Errors. This page says what to do for the codes of this API.
{
"code": "statement_gap",
"message": "The opening balance of the file is not the closing balance of the last statement of the account.",
"requestId": "5230bc15-93a3-4a2b-afcd-d66c34c7a35a"
} Send the same request again after you fixed the cause, with the same operationId, or send a new change with a new one. See Idempotency and concurrency.
Codes of this API
| Code | HTTP | What to do |
|---|---|---|
not_an_approver | 422 | Use an approver of the account. The approvers are set with your account. |
account_not_found | 404 | List the accounts and use one of their ids. |
statement_not_found | 404 | List the statements of the account and use one of their ids. |
transaction_not_found | 404 | Read the id from a list or from the operation result. |
match_not_found | 404 | Use the matchId of a booked transaction. |
open_item_not_found | 404 | List the open items and use one of their ids. |
payment_not_found | 404 | List the payment proposals and use one of their ids. |
batch_not_found | 404 | Read the batchId from the answer of the export. |
operation_not_found | 404 | Check the operationId; send the change if it was never sent. |
company_not_found | 404 | Use the companyId of a company of your account, as the accounts list shows it. |
subscription_not_found | 404 | List the subscriptions and use one of their ids. |
delivery_not_found | 404 | List the deliveries and use one of their ids. |
nothing_to_retry | 422 | Read the delivery: only a delivery whose state is retrying can be retried. |
nothing_parked | 422 | Read the delivery: only a delivery whose state is parked can be replayed. |
endpoint_not_answering | 422 | Bring the endpoint back, then replay the event. |
statement_duplicate | 422 | Nothing to do: read the statement that is stored. |
statement_gap | 422 | Import the statement that comes before it first. |
transaction_pending | 422 | Import the statement that books it, then match it. |
already_matched | 422 | Read the match. To undo a payment, use the return of the bank, which reverses it. |
nothing_to_accept | 422 | Split the transaction or book it to an entry. |
invalid_match_state | 422 | Read the match and use the operation that fits its state. |
transfer_unavailable | 422 | Import the statement of the other account, or choose another transaction. |
open_item_exceeded | 422 | Read the open amount of the item and assign no more than that. |
bill_has_proposal | 422 | Work on the proposal that exists. |
amount_exceeds_open | 422 | Read the open amount of the bill. After a returned payment the open amount returns once the return is matched. |
invalid_payment_status | 422 | Read the proposal and use the operation that fits its status. |
self_approval | 422 | Ask another approver. |
insufficient_authority | 422 | Read requiredAuthority of the proposal and ask an approver who holds it. |
statement_unbalanced | 422 | Check that the file is complete and export it again from your bank. |
statement_out_of_period | 422 | Export the statement again for the period you mean. |
statement_duplicate_line | 422 | Remove the repeated line or import only the days that are new. |
allocation_empty | 422 | Send at least one allocation. |
allocation_mismatch | 422 | Make the parts add up to the amount, or accept only a match that covers it. |
allocation_exceeds_line | 422 | Lower the parts. |
allocation_kind | 422 | Use the operation for a transfer, or accept the suggestion for a return. |
wrong_side | 422 | Choose items of the other side. |
unknown_entry | 422 | Use one of the values listed for entry. |
entry_wrong_side | 422 | Use an entry for a debit or for a credit, as the transaction is. |
transfer_same_account | 422 | Choose a transaction of another account. |
transfer_mismatch | 422 | Choose the transaction with the opposite amount. |
bill_not_payable | 422 | Use an open item whose side is payable. |
no_beneficiary_account | 422 | Have the bank account of the beneficiary added to your account, then prepare the payment. |
amount_invalid | 422 | Send a positive decimal string. |
reason_required | 422 | Send reason. |
batch_empty | 422 | Send at least one paymentIds entry. |
mixed_accounts | 422 | Export one file for each account. |
Refusals of the product
The product refuses an action with a sentence. The API refuses the same action with the code on the right.
| The product says | The API answers |
|---|---|
| This line is not in the statements. | transaction_not_found |
| This account does not exist. | account_not_found |
| This invoice or bill is not in the ledger of the company. | open_item_not_found |
| This payment does not exist. | payment_not_found |
| The record changed since you opened it. Open it again. | revision_conflict |
| A pending line is matched once the bank books it. | transaction_pending |
| This line is already matched. | already_matched |
| There is no suggestion to accept. Split the line or book it to an entry. | nothing_to_accept |
| The line is not in a state that allows this. | invalid_match_state |
| The parts do not add up to the amount of the line. | allocation_mismatch |
| Choose at least one invoice or bill. | allocation_empty |
| The parts are larger than the line. | allocation_exceeds_line |
| A split holds invoices, bills and entries only. | allocation_kind |
| The invoice or bill does not owe that much any more. | open_item_exceeded |
| A credit is matched to invoices you issued, a debit to bills you received. | wrong_side |
| This entry does not exist. | unknown_entry |
| This entry does not fit the direction of the line. | entry_wrong_side |
| Both lines are on the same account. | transfer_same_account |
| The two lines are not the same amount in opposite directions. | transfer_mismatch |
| The other line is already matched or not yet booked. | transfer_unavailable |
| Only a line that was left can be reopened. | invalid_match_state |
| This statement is already imported. | statement_duplicate |
| The statement does not start where the last one ended. | statement_gap |
| The lines do not add up to the closing balance. | statement_unbalanced |
| A line is dated outside the period of the statement. | statement_out_of_period |
| A line of the file is already stored or repeated in the file. | statement_duplicate_line |
| Only a bill you received can be paid. | bill_not_payable |
| The account of the beneficiary is not on file. | no_beneficiary_account |
| This bill already has a payment proposal. | bill_has_proposal |
| Enter an amount greater than zero. | amount_invalid |
| The amount is more than the bill still owes. | amount_exceeds_open |
| The payment is not in a status that allows this. | invalid_payment_status |
| This person does not approve payments. | not_an_approver |
| A payment is never approved by the person who prepared it. | self_approval |
| This amount needs a director. | insufficient_authority |
| Write the reason. | reason_required |
| Only approved payments are exported. | invalid_payment_status |
| Choose at least one payment. | batch_empty |
| One file holds the payments of one account. | mixed_accounts |
Where next
- Idempotency and concurrency for
operation_reusedandrevision_conflict. - Go-live checklist.