Reprocess Document Job Endpoint
const url = 'http://localhost:8080/v1/documents/example/reprocess';const options = { method: 'POST', headers: {'Content-Type': 'application/json'}, body: '{"template_id":"example","clear_template":false,"processing_mode":"example","page_range":"example"}'};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request POST \ --url http://localhost:8080/v1/documents/example/reprocess \ --header 'Content-Type: application/json' \ --data '{ "template_id": "example", "clear_template": false, "processing_mode": "example", "page_range": "example" }'Re-enqueue any terminal-status job, optionally swapping templates.
Body is optional; {} keeps the existing template. See the
ReprocessPayload docstring for the keep / clear / swap matrix.
Parameters
Section titled “ Parameters ”Path Parameters
Section titled “Path Parameters ”Request Body
Section titled “Request Body ”Body for POST /v1/documents/{job_id}/reprocess.
Same auth-header keep/clear pattern as the infra-endpoints router:
template_idomitted (defaultNone) → keep current.clear_template: true→ reset to auto-classify.template_idset → swap.
The two cannot both be supplied (clear_template=true with a
template_id); pydantic catches that with the validator below.
processing_mode (omitted → keep the job’s current mode) switches
the pipeline depth on re-run: canonical / entities /
extraction. The service rejects a canonical / entities
mode paired with a template_id (400, with an actionable message).
page_range (omitted → keep the job’s current selection) re-selects
PDF pages on re-run — e.g. narrow a job that failed “all pages” over
the page cap to 1-3, or widen back to all.
Responses
Section titled “ Responses ”Successful Response
Validation Error
object
object
object
Example generated
{ "detail": [ { "loc": [ "example" ], "msg": "example", "type": "example", "input": "example", "ctx": {} } ]}