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.
orders:writeGrant this scope to your token under Settings → Developer → Personal Access Tokens.
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
- 401
- 403
- 404
- 422
- 429
Successful response
Unauthenticated — the bearer token is missing, revoked, expired, or malformed. Never retry automatically; fix the credential. See the Errors guide.
Forbidden — the token lacks a required scope, the endpoint is not available to API tokens, or the user behind the token lacks the permission. A human must adjust the token scopes or user permissions; do not retry.
Not found — no record with the given identifier (or the route does not exist). Verify the ID before retrying.
Validation failed — the body is a field → messages map (Laravel shape) or the platform envelope with a stable machine-readable code. Fix the payload and resubmit.
Rate limited — platform limit is 1,000 requests/min; individual tokens may carry lower limits. Honor the Retry-After header before retrying. See the Rate Limits guide.