askledgerDocs
REST-APIAdministrations
Documentatie

Search how similar lines were booked (by administration)

GET
/administrations/{administrationId}/booked-lines

Choose a ledger account (and VAT category) from how similar invoice lines were booked before in this ledger, across all contacts: also for a new supplier without history, and to decide between neighbouring accounts. Searches fuzzy (trigram) on the line description and the contact name, e.g. 'parkeren', 'lunch' or 'Figma'. Only lines with a ledger account, on invoices that are not deleted or rejected, dated within the last months and the plan's data window. Returns one item per ledger account, best first by relevance × frequency: count = matching lines on that account in the period, lastUsed = date of the latest one, taxCategory = the VAT category used most on those lines (null when unknown), examples = up to 3 most recent matching lines (netAmount excl. VAT, invoice currency). A high count with recent use is strong evidence; a single loose match is weak. No items means no comparable lines: fall back to search-ledger-accounts.

Same as the ledger endpoint, addressed by LedgerSuite administration id instead of ledgerId. Other LedgerSuite products call this with their own client_credentials token (audience urn:ledgersuite:askledger, scope askledger:read) for administrations that include them; company group API keys and OAuth tokens work too.

Requires the ledger:read scope (Lezen). Same operation as the MCP tool search-booked-lines.

Authorization

bearer
headerAuthorizationBearer <token>

A company group API key (al_live_…, created at /dashboard/api), an OAuth access token from the same authorization flow MCP clients use, or (other LedgerSuite products, /administrations routes only) a LedgerSuite client_credentials token.

Path Parameters

administrationId*string

LedgerSuite administration id; its linked ledger is used

Query Parameters

query*string

What the line is about: its description (e.g. 'parkeren', 'lunch') and/or the contact name

Length1 <= length <= 200
type?string

purchase (default) or sales lines

Value in"sales""purchase"
months?integer

Look back this many months from today (default 24), within the plan's data window

Range1 <= value <= 120
limit?integer

Max ledger accounts (default 5, max 20)

Range1 <= value <= 20

Response Body

OK

application/json
  1. response
items*array<>
curl -X GET "https://example.com/administrations/string/booked-lines?query=string"
{  "items": [    {      "ledgerAccountCode": "string",      "ledgerAccountName": "string",      "taxCategory": "nl_high",      "count": -9007199254740991,      "lastUsed": "string",      "examples": [        {          "description": "string",          "contactName": "string",          "date": "string",          "netAmount": 0        }      ]    }  ]}