Get Siblings (Prev/Next Navigation)
GET/api/document-inbox/customer_po/:extraction_id/siblings
Returns the previous and next document in the unified inbox relative to the given extraction. Powers the prev/next pager on the OCR review pages so the user can walk through the queue without bouncing back to the inbox list.
Path params:
type(required) — one ofcustomer_poorsupplier_invoice(regex-constrained at the route level; unknown values return 404)id(required, integer) — extraction ID of the currently-viewed document
Behavior:
- Walks both
sales_order_ocr_extractionsandpurchase_invoice_ocr_extractionstogether - Only
pending_reviewextractions participate in the walk — confirmed/failed/processing rows have no Review button in the inbox, so the OCR review page wouldn't show anything actionable for them - The current item itself is ALWAYS included even if it's no longer
pending_review(e.g. the user just confirmed it but hasn't navigated yet) — keepsposition/totalcorrect on the open page - Sort order matches the inbox listing:
created_at DESC, id DESC prev/nextcross table boundaries — the next document may be a customer PO even if the current one is a supplier invoiceprev/nextarenullat the boundaries of the list- Each sibling reference includes both
typeandidso the frontend can route to the correct OCR review page positionis 1-indexed (1 = newest);nullif the current item is not found at all (e.g. just deleted)
Response 200:
{
"data": {
"prev": { "type": "supplier_invoice", "id": 17 },
"next": { "type": "customer_po", "id": 41 },
"position": 2,
"total": 47
}
}
Response 404: route constraint blocks type values other than customer_po or supplier_invoice.
Request
Responses
- 200
Successful response