Rescan Customer PO OCR
POST/api/sales-orders/ocr/:extraction_id/rescan
Re-run OCR extraction on an existing Customer PO record. Resets status to 'processing', clears any prior error_message, and re-dispatches the OCR job. Useful when the extraction failed initially (status='failed') or when the matching/parsing logic has improved and the user wants to re-derive the extracted data from the original PDF or email body.
Returns 422 if:
- Extraction is locked confirmed — i.e.
status='confirmed'ANDsales_order_idis non-null (already used to create a sales order that still exists — cannot be re-scanned). Orphaned confirmed extractions (linked sales order deleted,sales_order_idnull via FKnullOnDelete()) are treated as unlocked and can be re-scanned. - Both file_path and source_body_text are null (no source content to re-scan)
Response 200:
{
"data": {
"extraction_id": 7,
"tracked_job_log_id": 1234,
"status": "processing"
},
"message": "Re-scan started"
}
The frontend subscribes to the returned tracked_job_log_id via the global JobProgressTray (job name starts with 'Customer PO OCR:') and re-fetches the extraction once the job completes.
Request
Responses
- 200
Successful response