Reading results
Poll the case for run.state, then read its documents, their files and the ledger.
Polling
GET /applications/{id}
Read run.state:
| State | Meaning |
|---|---|
previewing, inventory, running | In flight. A workflow moves through these by itself. |
report | Landed. The workflow has filed what it could. |
gated with run.lastRunError | The run did not finish and the case was put back. The error says why: it failed, someone stopped it, or the analyzer went silent. |
Every five to ten seconds is plenty. That is the whole integration; webhooks are optional.
Documents
GET /applications/{id}/documents
One entry, from a real run:
{
"address": "sf-Fjh0L6mx:p1-2",
"title": "Pay Stubs — Last 30 Days",
"spans": [ { "fileId": "sf-Fjh0L6mx", "pages": [1, 2] } ],
"expectedDocId": "pay-stubs",
"settled": true,
"document": {
"suggestedName": "2026-08-31_pay-stub_example-corp.pdf",
"extractKeyData": { "document_date": "2026-08-31", "issuing_party": "Example Corp" }
},
"approval": {
"outcome": "approved",
"decidedBy": "Workflow",
"authenticatedAs": "LOS integration (API)",
"approvedDocId": "ad-9OiuG41jd5"
}
}
- A document's identity is its page span, the
address. There is no minted document id, and the address stays stable across runs for pages that did not move. - No
expectedDocIdmeans it matched nothing on the list. On real packets that is common, and not an error. A person can still keep such a document: it is then settled, and itsapproval.expectedDocIdis"unmatched". - A range that reads as several documents is listed whole until its split is confirmed — a person approves it, or a workflow follows it. From then on the list shows the pieces in its place, each with its own address. Nothing is cut or re-parsed.
- Each page is listed once. A page someone approved into a document belongs to that document only, and a page someone junked is not listed.
settled: falsemeans it still waits for a person.
The filed PDF
GET /applications/{id}/approved-docs/{approvedDocId}/file
returns the PDF cut from the packet. ?kind=md returns its text with page provenance. The id is approval.approvedDocId above.
The case list
GET /applications lists your cases, each with docsFiled and docsTotal: how many lines of the list are satisfied.
The ledger
GET /applications/{id}/events
Newest first. Each row is { seq, at, actor, action, target, detail }. See the ledger.
Sheaf