Sign in

Search

View as Markdown

GET /public/v1/search (scope search:read) finds documents in your business's files by words, inside compounds too ("Stuhl" finds "Bürostuhl"), and by meaning ("office chairs" finds "Bürostühle"). Deleted files are left out. It finds documents; it answers no questions and writes nothing.

Parameters

ParameterMeaning
qRequired, 1 to 200 characters.
kindA public kind (invoice, credit_note, delivery_note, contract, …); repeat for several.
since, untilIssue date, ISO 8601, inclusive.
partyAny party's name as read; case, umlauts and legal forms don't matter ("Müller Sanitär GmbH" finds "MUELLER SANITAER G.m.b.H.").
vat_idA party's VAT ID as read, ignoring spaces and case.
matchhybrid (default): words and meaning; keywords: words only; meaning: meaning only; exact: only documents holding q as written (case, accents and spacing aside), never one that only means the same.
due_since, due_untilAn invoice's due date, ISO 8601, inclusive.
gross_min, gross_maxThe gross in your business's currency (converted at the ECB's rate), inclusive.
directionincoming (from suppliers) or outgoing (to customers).
statusAn invoice's: open (unpaid) or paid.
categoryAn ECLASS code of any level, eight digits (24000000): documents with a line in it or under it.
limit, offset1 to 50, default 20; offset up to 250.

Results

One per document, best first; a file without a document comes as itself.

  • document_id, file_id, file_name, kind, number, seller, buyer, issue_date, gross, currency, pages
  • passages[], up to 5: page, text (about 300 characters), highlights ([start, end) ranges of the matched words in text, to mark), found_by (words, meaning, both)
  • facts[]: card facts holding the words
  • file_url, document_url: the file and document in this API

total counts the matches (Ocost ranks the best 300), truncated says there were more. meaning: "unavailable": search by meaning is building or unreachable; words still answer.

Examples

curl -sS -G https://api.ocost.io/public/v1/search \
  -H "Authorization: Bearer $OCOST_KEY" \
  --data-urlencode "q=Wartungsvertrag Aufzug" \
  --data-urlencode "kind=contract" \
  --data-urlencode "since=2025-01-01"