Sheaf
SheafDocsAPIRun a workflow

Run a workflow

POST /workflows/{workflowId}/runs creates the case, receives the packet and starts the run, in one call.

POST /workflows/{workflowId}/runs

One call does what a person does in the app: start a case, drop the packet in, take the gate with a workflow attached. The call itself is the consent to spend on the run, and is recorded as such.

Fields

Sent as multipart/form-data.

FieldRequiredMeaning
filesyes, for a new caseOne or more PDFs. Up to 25 files, 100 MB each. Repeat the field for several files.
applicantyes, for a new caseThe applicant's name.
expectedDocListyes, for a new caseexpectedDocListId for its active version, or expectedDocListId/3 for a specific one.
applicationIdinstead of the two aboveRun on an existing case. Files are optional then.
decidedBynoWho consents to the run. Defaults to the key's name.

Versions

The workflow's active version runs. ?version=2 pins one. A missing version answers 404 and a draft answers 409, both before anything is written. Publishing a new version changes what callers get without changing what they call.

The answer

201 with the case. run.state is previewing or running, depending on whether the workflow begins with a preview. From here, read the results.

An existing case

Send applicationId and the run covers whatever the case holds that no run has read. Add files to drop more in first. If there is nothing new to read, the answer is 409 and says so.

Red flags

If pre-flight flags a file, such as a scan too coarse to read or a duplicated page, Sheaf does not override that on your behalf. The answer is:

{
  "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" } ]
}

with status 409. The case exists with its files and waits at the gate for a person. Do not send the packet again. This is the one error that carries more than a message.

Other refusals

StatusWhen
400No files, a missing applicant or expectedDocList, a file that is not a PDF.
404Unknown workflow, version, list or case.
409A run is already in flight on the case, or there is nothing new to read.
502The analyzer could not be reached. The case is put back at the gate with its files, and applicationId is in the answer.

This page as markdown · llms.txt · API contract