Run a workflow
One call creates the case, receives the packet and starts the workflow's run.
POST /workflows/{workflowId}/runs
It does what a person does in the app, with a workflow attached at the gate. Sheaf records the call as consent to spend on the run.
Fields
Send them as multipart/form-data.
| Field | Required | Meaning |
|---|---|---|
files | yes, for a new case | One or more PDFs, images or text files (HTML, markdown, plain text). Up to 100 files of any type: a PDF or an image up to 100 MB, a text file up to 10 MB. Repeat the field for several files. |
applicant | yes, for a new case | The applicant's name. |
expectedDocList | yes, for a new case | expectedDocListId for its active version, or expectedDocListId/3 for a specific one. |
applicationId | instead of the two above | Run on an existing case. Files are optional then. |
decidedBy | no | Who consents to the run. Defaults to the key's name. |
Versions
The workflow's active version runs. ?version=2 pins version 2. A missing version returns 404. A draft returns 409. Both fail before anything is written. Publishing a new version changes what callers get, not what they call.
What the run does
The workflow's steps decide. GET /workflows/{workflowId}/{version} returns them.
| Step | What it gives |
|---|---|
| Parse | Every page's text and layout. Every workflow has it. |
| Classify | The documents, each with a suggested requirement. The workflow matches what the run suggests. |
| Extract | Field values for each matched document, read against its document schema. |
| Intel | One brief for each template the step names. |
A step the workflow does not have does not run. The starter workflow standard-intake has Parse, Classify and Extract; in an organization made before October 2026 it has Parse and Classify.
A step can pin an option, such as the Parse step's engine or its page annotation switch. What it leaves on Default takes the system default, which GET /models/options marks for each stage. The Classify step's Detect sub-documents switch, on by default, finds where a file holds several documents and recommends a split.
The answer
It returns 201 with the case. run.state is previewing when the workflow begins with a preview, and running when it does not. Next, read the results.
The case records its workflow in workflow, for example { "workflowId": "standard-intake", "version": 1 }. A later run without a workflow keeps it.
An existing case
With applicationId, the run reads everything in the case that no run has read yet. Add files to upload more first.
When the last run stopped after its parse, the same call with no new file finishes it: Classify and the steps after it run, and no page is read again.
If nothing is new and nothing is left to finish, it returns 409 and says so.
A run with its own options
The door takes no options: a run follows its workflow. To choose an option for one run, make the three calls the app makes:
POST /applicationscreates the case.POST /applications/{id}/filesadds the files.POST /applications/{id}/run/gatestarts the run:
{
"decision": "confirmed",
"decidedBy": "Jane Doe's agent",
"mode": "parse",
"workflow": { "workflowId": "standard-intake", "version": 1 },
"plan": { "ocr_post_processing_grounding": "grounding-none" },
"settings": { "pageAnnotation": true }
}
| Field | Meaning |
|---|---|
decision | confirmed. A flagged file set is refused with 409, as at the door. |
decidedBy | Who consents to the run. |
mode | parse starts the run now. A workflow needs it. |
workflow | The workflow and the version to run. |
plan | A stage and the option to use for this run, both from GET /models/options, and detectSubDocuments: false to skip sub-document detection. It wins over what the workflow pins. |
settings | pageAnnotation and figureAnnotation. They win over the workflow's. |
It returns the case, as the door does.
Red flags
Pre-flight can flag a file, for example a scan too coarse to read or a duplicated page. Sheaf does not override a flag on your behalf. It returns 409:
{
"error": "The file set has 1 red flag(s) — use \"bypassed\" (Process anyway) to override them",
"applicationId": "Xjs0t8SWt_",
"flags": [ { "fileId": "sf-3kQ9", "page": 1, "code": "low_dpi", "note": "p.1 embedded image ~96 DPI — below 150" } ]
}
The case exists with its files and waits at the gate for a person. Do not send the packet again.
Other refusals
| Status | When |
|---|---|
| 400 | No files, a missing applicant or expectedDocList, a file that is not a PDF, an image or a text file, a PDF that needs a password to open, or a file over a limit. |
| 403 | A sandbox with no email has had its one run. emailRequired is true, and the case waits at the gate with its files. |
| 404 | Unknown workflow, version, list or case. |
| 409 | A workflow is already active on the case ("Parse → Classify workflow active"), or there is nothing new to read and nothing left to finish. |
| 502 | The analyzer could not be reached. The case is put back at the gate with its files, and applicationId is in the answer. |
Sheaf