Skip to main content

Suggest Bill Line Accounts

POST 

/api/bills/ocr/suggest-accounts

Suggest an expense account (nominal code) for each line of a bill being entered, with the reason for each suggestion. Writes nothing.

Required scope: purchase-orders:write

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

Suggestions come, in order, from: an account already on the line (never replaced), the accounts this supplier's recent bills booked the same description to, the line's cost category default account, and the account this supplier is usually booked to.

Body:

  • supplier_id (optional, integer, nullable) - an existing supplier; without it only the cost category default can be used.
  • lines (required, array, 1-500 items):
    • lines.*.description (required key, string or null, max 500) - the line description.
    • lines.*.nominal_code_id (optional, integer, nullable) - an account already chosen for the line.
    • lines.*.cost_category_id (optional, integer, nullable) - the line's cost category.

Response: data has one entry per line, in the order sent:

  • nominal_code_id, nominal_code_label - the suggested account, or null when there is nothing to go on.
  • confidence (0-100).
  • source - chosen, supplier_history, cost_category_default, supplier_usual or none.
  • reason - a plain-language explanation.
  • needs_confirmation - true when confidence is below meta.confirm_below: a person should pick or confirm the account.

meta.confirm_below is the confidence threshold (70) and meta.history_bills the number of the supplier's recent bills considered (12).

Authentication: Requires Bearer token. Permission: create bills (bills.create). Scope: purchase-orders (read/write).

Request​

Responses​

OK

Response Headers
    Content-Type