Docs·Get started

XERJ Reader

Ask a question about a document. Get back the exact piece of the document that answers it, with its position and a confidence, or a plain “not in this document”.

What it does #

You send a document and a question. XERJ Reader (xerj-reader-1) reads the document and returns one of three kinds of answer:

answer.type What you get Example from the sample email
span The exact text from your document, with start and end character offsets “How much is invoice INV-20931?” → 48,200 EUR, characters 533–543
yes or no Yes or No, with the supporting span when there is one “Do both shipments leave Rotterdam on the same day?” → No
none “Not in this document”, plus the best guess if there is a candidate “Who is the CEO of Acme Retail?” → no answer

Every answer has a confidence between 0 and 1. You set the bar an answer must clear with min_confidence.

JSON
{
  "answer": {"type": "span", "text": "48,200 EUR", "start": 533, "end": 543, "confidence": 0.98},
  "best_guess": null
}

Why it is built this way #

It cannot invent a value. The model points at a piece of your document. It has no way to write text that is not there. So answer.text == document[start:end], always.

Every substring is a possible answer. Choice-style APIs pick from a list of options you write first. XERJ Reader picks from the document itself, so dates, amounts, names, IDs and clauses work without listing them.

It says when the answer is not there. Below min_confidence you get "type": "none" instead of a guess dressed up as an answer. The best guess still comes back, marked as such, so you can show the closest passage without trusting it.

You can show your work. With start and end you can highlight the answer in your own UI, so a person can check it in one glance.

When to use it #

Use XERJ Reader when the answer is written in the document and you need to know where:

One request reads up to 1,000,000 characters.

When to use something else #

Need many values from one document? That is still XERJ Reader: /v1/extract asks up to 20 fields in one call.

Start here #

Base URL #

Text
https://platform.xerj.ai/v1

All endpoints take and return JSON in UTF-8. Every request needs an API key in the Authorization header. Create keys on the API keys page.

Access is by invitation during the preview: request access, and you can create keys once your access is active. The quickstart has the steps.