Which four questions decide the intake route for your team
Document intake routes differ on four points. First, who submits the file: a person, a script or a system. Second, how long the caller can wait for an answer.
Third, ask what must come back. Some teams need only a verdict about the pack. Others, in contrast, need every extracted field. Finally, ask how long the data may stay on the service.
Write the four answers down for your document intake routes before you read the rest. Then each route below either fits or does not fit. A clear choice among document intake routes saves weeks of rework later. The extraction API and command line page lists the routes in full.
When a person uploads a pack by hand in the workspace
The web workspace is built for people. Specifically, a person uploads a file and gets a run identifier. Next, the job joins a single worker queue.
Progress streams to the screen as server events. In addition, the status shows the queue position, the estimated wait and the phase. Moreover, the workspace offers a first-page preview, a validation panel, a ZIP of results and CSV reports.
Of the document intake routes, this one suits a reviewer who wants to see the pack and the flags. For automation, the API routes take over. Web runs follow the retention period your administrators set. The review workspace page shows what a reviewer sees.
When a script needs a quick verdict from the analyze route
The analyze route is a sync call. For example, a script sends one file in a field named file, and the call blocks until the whole pipeline ends. Then the answer arrives in the same HTTP reply. However, other document intake routes answer later.
First, the reply holds a success flag, a document count, a page total and an error list. Each document entry holds its type, its type confidence, its outcome, its rejections, its flags and its pages. Notably, the list is capped at one hundred documents.
The reply is also free of any file paths. Likewise, it carries no extracted values. As a result, it fits triage that asks what a pack contains. Among document intake routes, it is the one for quick triage.
A long pack means a long request. Therefore, set a generous client timeout, and run the call from a background worker. Moreover, the working folder is removed before the reply is sent, so nothing waits for a cleanup pass.
The route sits behind your API gateway. Therefore, put a gateway in front of it, as you would for any internal service.
When a system needs the extracted records from tenant jobs
Tenant job routes are the async path for systems. A caller sends a statement file with a bearer token and a tenant header. The service then answers with a 202 reply and a run identifier.
Next, the caller uses the poll route until the job ends. The tenant job routes also offer a jobs list and a results route. The queue behavior in a batch shows how those calls read a whole batch.
What a tenant call must prove before a job can run
These tenant job routes check two values per call. The token must be 32 to 512 printable ASCII characters, and the tenant must be a canonical UUID. In addition, tokens are compared in constant time. However, if no token registry exists, the routes answer 503.
An accounting evidence route also needs the tenant token. Specifically, it takes up to twenty documents and returns a closed schema within 8 MiB. Meanwhile, results are filtered by owner, so one tenant cannot read the runs of another.
Tenant runs expire after a set window. The default window is 168 hours, and the uploaded file is deleted when the job ends. For the full rules, see the retention and expiry rules.
How the command line fits into scripts and test runs
The command line wraps the shared core. A command line analyze call looks like cli.py analyze, followed by a file path. For instance, a json flag prints the machine-readable result. Also, an output directory flag keeps the run files.
Because command line analyze uses the same core as the analyze route, the answer has the same shape. The exit code is 1 when the run fails, so a shell script can branch on it. In contrast to the HTTP routes, the command line runs on the machine that holds the files. Among document intake routes, it is the only local one.
Command line analyze suits two jobs well, as the next lines show. First, it helps engineers check a single file before they wire an integration. Second, it supports a regression run over a reference pack after each upgrade. A command line analyze loop over a folder is easy to script.
The command line analyze step still needs the same model and OCR services as the server.
What the same file rules mean for every intake route
All document intake routes take the same accepted file types. They are PDF, JPG, JPEG, PNG, TIFF, TIF and WEBP files. A file may not be empty, and it may not exceed 50 MiB. Therefore, check the accepted file types before you call any route.
Also, the name is cleaned before it is saved, and it must stay within 255 bytes after the cleanup. Similarly, a file above the size limit is refused with a 413 answer. Every error comes back in one shape, and the accepted file types are the same for every caller.
- Send one document family per file when you can, because splitting then has less to guess.
- Prefer native PDFs to image files, because the reader finds text without OCR. Nevertheless, the accepted file types allow both.
- Keep scans sharp, because poor pages lead to flags and requests for a new copy.
Also, the accepted file types are part of the route choice too. A route cannot fix a bad file, because each one passes the same pipeline. The pipeline overview lists the stages.
How to test each route on your own real packs first
Use your own files, not clean examples. For example, pick ten or so real packs, including your worst scans. Then send them through each of the document intake routes you plan to use.
- Time each route with your own packs, and write down the range.
- Check what comes back, and compare it with what your system needs.
- Break a call on purpose, with a bad token or a huge file, to see the error shape.
- Restart the service during a job, to see how your caller reacts.
Record the answers for each of the document intake routes beside the four questions. As a result, that record becomes your intake design note, and it makes the next review quick. The job status and recovery article covers the restart test in greater depth.