Reading results
Poll a case for run.state, then read its documents, their filed PDFs and its ledger.
Polling
GET /applications/{id}
Read run.state:
| State | Meaning |
|---|---|
previewing, inventory, running | Not finished. A workflow moves through these by itself. |
report | Landed. The workflow has filed what it could. |
Any state with run.stopped | The last run did not finish and the case was put back where that run started. run.stopped.reason says why: it failed, someone stopped it, or the analyzer went silent. |
To continue a stopped run, send run.stopped.request.body to the route that started it again (via gate → POST /applications/{id}/run/gate, tool → POST /applications/{id}/run/tool). Pages already read are not read again. DELETE /applications/{id}/run/stopped clears it.
Poll every five to ten seconds. Polling alone is a complete integration; webhooks are optional.
Documents
GET /applications/{id}/documents
One entry:
{
"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"
}
}
The API's names keep the earlier word: a match is an approval.
| Field | Meaning |
|---|---|
address | The document's identity: its page span. There is no minted document id. The address stays the same across runs for pages that did not move. |
expectedDocId | Absent when no requirement on the list fits the document. That is common on real packets, and not an error. |
settled | false while the document waits for a person. |
approval.outcome | rejected when a person refused the document for its requirement. Nothing is filed. |
approval.expectedDocId | "unmatched" when no requirement fits and the document is matched to its kind instead. approval.docKind names the kind, such as letter. The document is then settled. |
docKind | The kind the document is matched to, or, before anyone decides, the kind the run read. Send it as docKind with "expectedDocId": "unmatched" to match the document to it. Absent when the run read no kind of document. |
tag | priority or excluded when someone tagged the document. |
origin | "archived" on archived pages, which are listed as their own entries. They stay on file, out of search, Research and Intel. See tags and archive. "edited" on a document a person set in Doc Review with Split here, Move page or Merge with. |
bundle | The bundle the document is part of, when a person or a workflow filed its pages as one of the list's bundles: { "name": "URLA Package", "file": "borrower-packet.pdf" }. See Doc Review. |
inEdit | Marks an open merge or split suggestion. Filing the document returns 409 until the suggestion is resolved or dismissed. See documents in edit. |
- A range that reads as several documents is listed whole until its split is decided: a person decides it, whole or cut by cut, or a workflow follows it. Then the documents it makes take its place, one at each accepted cut, 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.
Extracted values
A workflow's Extract step reads each matched document against its document schema. The values are in the case's run records:
GET /applications/{id}/analysis
The run whose kind is extract holds extractions, one per document:
{
"address": "sf-Fjh0L6mx:p1-2",
"docType": "pay-stub",
"schemaVersion": "1",
"values": { "pay-date": "2026-08-31", "net-pay": "3,210.55", "employer-address": null },
"notStated": ["employer-address"],
"sources": {
"net-pay": [ { "fileId": "sf-Fjh0L6mx", "page": 1, "element": { "blockId": "b-7", "unit": 0 }, "citedText": "Net pay 3,210.55" } ]
}
}
| Field | Meaning |
|---|---|
address | The document, as in /documents. |
values | Each field the schema asks for and what the page says. |
notStated | Fields the document does not state. A missing value is never guessed. |
sources | The lines each value was read from: file, page, the line's place on the page, and its text. Empty when the run's model does not cite, as the default does not. |
A document the step could not read is in the same run's skippedExtractions, with the reason. Every other document keeps its values:
{
"address": "sf-Fjh0L6mx:p3-4",
"spans": [ { "fileId": "sf-Fjh0L6mx", "pages": [3, 4] } ],
"reason": "Truncated: the answer is incomplete"
}
The record goes when a later run reads that document.
A workflow with no Extract step leaves no such run. To extract then, send POST /applications/{id}/run/tool with { "tool": "extract", "decidedBy": "Jane Doe's agent" } once run.state is report.
Briefs
A brief answers an Intel template's questions over the whole case, each answer cited to the page.
GET /intel-templateslists the templates.POST /applications/{id}/intel-briefswith{ "templateId": "deal-diligence-review" }starts one and returns itsbriefId.- Poll
GET /applications/{id}/intel-briefs/{briefId}untilstatusisready.
The brief holds its sections, one per question, each answer in parts with their citations, and citations, each a file, a page and a line.
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. approvedDocId is the entry's approval.approvedDocId.
The case list
GET /applications
Each case carries docsFiled and docsTotal (how many of its list's required documents are matched, of how many; a recommended document is never counted) and updatedAt (its last change). By default every case comes back, newest created first.
| Parameter | Effect |
|---|---|
sort=recent | The cases changed last come first. |
limit | Keeps the first N. |
q | Keeps the names that contain it. |
Example: GET /applications?sort=recent&limit=10&q=doe.
The ledger
GET /applications/{id}/events
Rows come newest first. Each row is { seq, at, actor, action, target, detail }. See the ledger.
Sheaf