Skip to main content

Run Documents

Attach documents to a pipeline run, start it, retry only the failed documents, rebuild its review queue, and page through its documents and run requests.

These routes run a pipeline day to day from code, the same way the run page does in the web app. Attach documents you already uploaded with POST /v1/pipelines/{id}/documents; they wait idle until you call POST /v1/pipelines/{id}/start. Each attach call opens one submission group with its own run_id, so you can later narrow the document list to exactly what one call added. Documents already attached to the run are skipped, not added twice.

While the run works, GET /v1/pipelines/{id}/documents pages through its documents with the same filters as the run grid: filename search, status, tags, flagged rows, rows with manual edits, and one submission group. GET /v1/pipelines/{id}/runs lists the submission groups themselves with their document count, submission time and roll-up status. Use GET /v1/pipelines/{id}/progress for the overall counters.

When some documents fail, POST /v1/pipelines/{id}/retry-errored processes only those again; documents that succeeded are left as they are. POST /v1/pipelines/{id}/retriage rebuilds a finished run's review queue from the results already stored and routes it again, optionally under a new review_config. Nothing is read again and no credits are spent, so it is the safe way to try a stricter or looser review policy on a run you already paid for.

Who can call these routes. Every route checks two things: the key's scope, and that the person behind the key (the key's creator, or the signed-in person for an OAuth token) may do the same thing in the web app. Reads need the read scope (or runs:read) and any member of the workspace. Attaching, starting, retrying and rebuilding the review queue need runs:write, and the key's person must be an Admin of the workspace, as in the web app; in a workspace whose model configuration Talonic manages, these return 403 insufficient_role. A 403 body carries reason: insufficient_scope, insufficient_role, no_person, person_inactive or workspace_read_only.

POST/v1/pipelines/{id}/documents

Body parameters

document_ids*uuid[]Documents to attach, 1 to 1000. Documents already attached to this run are skipped.

Response fields

pipeline_iduuidThe pipeline.
run_iduuidThe submission group this call opened. Pass it as run_id on the document list to see only these documents.
addedintegerDocuments newly attached.
skippedintegerDocuments that were already attached.
documents[]arrayOne entry per attached document: id (the run document id), document_id, status.
linksobjectstart and documents URLs for the next calls.

Attach two documents, then start

curl -X POST https://api.talonic.com/v1/pipelines/$PIPELINE_ID/documents \
  -H "Authorization: Bearer $TALONIC_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"document_ids": ["0b6c1f9e-2d4a-4e8b-9c1d-3f5a7b9c2e10", "4e2a8c1b-7f3d-4a6e-b9c0-1d2e3f4a5b6c"]}'

curl -X POST https://api.talonic.com/v1/pipelines/$PIPELINE_ID/start \
  -H "Authorization: Bearer $TALONIC_API_KEY"

Response (201) — POST /v1/pipelines/{id}/documents

{
  "pipeline_id": "1a0c681d-ea20-4bb4-8892-01a6d7f834da",
  "run_id": "9f3b2c1d-6e4a-4b8c-a1d2-e3f4a5b6c7d8",
  "added": 2,
  "skipped": 0,
  "documents": [
    { "id": "c1d2e3f4-a5b6-4c7d-8e9f-0a1b2c3d4e5f", "document_id": "0b6c1f9e-2d4a-4e8b-9c1d-3f5a7b9c2e10", "status": "idle" },
    { "id": "d2e3f4a5-b6c7-4d8e-9f0a-1b2c3d4e5f60", "document_id": "4e2a8c1b-7f3d-4a6e-b9c0-1d2e3f4a5b6c", "status": "idle" }
  ],
  "links": {
    "start": "/v1/pipelines/1a0c681d-ea20-4bb4-8892-01a6d7f834da/start",
    "documents": "/v1/pipelines/1a0c681d-ea20-4bb4-8892-01a6d7f834da/documents"
  }
}
GET/v1/pipelines/{id}/documents

Query parameters

pageintegerPage number, from 1.
limitintegerRows per page (50 by default, at most 200).
qstringFilename search (up to 200 characters).
statusstringComma list of run document statuses.
tagsstringComma list of document tags; a row matches when it carries any of them.
flaggedbooleantrue for rows with at least one failed check, false for rows without.
has_manual_editsbooleantrue for rows a reviewer edited.
overridden_by_amendmentbooleantrue for rows whose values a later amendment replaced.
sort_bystringfilename, status, added_at, duration, flag_count, batch (optionally batch:client_batch_id, batch:source_batch_id, batch:upload_batch_id) or field:<fieldKey>.
sort_dirstringasc or desc.
run_idstringOne submission group, or none for documents attached outside any group.
idsstringComma list of run document ids to read exactly those rows (at most 200).

Row fields (beyond the run document itself)

filenamestring | nullThe document's filename.
display_namestring | nullThe readable name, when the workspace sets one (see Document Display Names).
tagsstring[]The document's tags.
client_batch_id / source_batch_id / upload_batch_idstring | nullThe batch ids the document carries.
flag_countintegerFailed checks on the row.
has_manual_editsbooleanWhether a reviewer edited the row.
overridden_by_amendmentbooleanWhether a later amendment replaced values of the row.
GET/v1/pipelines/{id}/runs
POST/v1/pipelines/{id}/start
POST/v1/pipelines/{id}/retry-errored
POST/v1/pipelines/{id}/retriage

Body parameters (optional)

review_configobjectA new review routing configuration to apply first. Leave it out to keep the stored one.

Response fields

resyncobject{ rewound, reBlocked, orphansCleared }: field counts reset before routing.
clearedintegerOpen review items removed before routing again.
statsobject | nulltotal, routed, autoAccepted, forced, normalized, newlyRouted, reviewRate, ranAt, plus optional adjudication and demotion summaries.
To retry a single failed document instead of every failed document in a run, call POST /v1/documents/{id}/re-extract. Workspace-wide retry, resume and recovery of stuck documents are not available over the API; Talonic does them for you for now.

Errors

Error responses

400validation_errorBad body (for example more than 1000 ids), a run that is archived or finishing up (it takes no new documents and no retry), or a call made from the all-workspaces view (Select a workspace first.).
403forbiddenreason names what is missing: insufficient_scope, insufficient_role, no_person, person_inactive or workspace_read_only.
404not_foundThe pipeline does not exist in your workspace, or one of the documents is missing or hidden from the key's person.

Frequently asked questions

Why are my attached documents not processing?+
Attached documents wait idle until you call POST /v1/pipelines/{id}/start. Attaching and starting are separate so you can attach in several calls and start once. If start returns entries in held_runs, a business-rule hold keeps those groups back; see Rule Holds & Cases.
Does retriage cost credits?+
No. Retriage rebuilds the review queue from results Talonic already stored and routes them again. Nothing is read again, so no credits are spent. Use it to try a different review_config on a finished run.
How do I see only the documents one call added?+
Every attach call returns a run_id. Pass it as the run_id query parameter on GET /v1/pipelines/{id}/documents. Documents attached outside any group are listed with run_id=none.
My key has runs:write but start returns 403 insufficient_role. Why?+
The key never reaches further than its person does in the web app. Starting a run needs an Admin of the workspace, and in a workspace whose model configuration Talonic manages it is done by Talonic. Ask an Admin to create the key, or ask Talonic.