Get Adjacent Documents
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_po,supplier_invoice,vendor_credit, orlanded_cost_invoice(regex-constrained at the route level; unknown values return 404)id(required, integer) — extraction ID of the currently-viewed document
Behavior:
- Walks
sales_order_ocr_extractions,purchase_invoice_ocr_extractions,vendor_credit_ocr_extractions, andlanded_cost_invoice_ocr_extractionstogether (vendor credit rows tied to an existing credit's attachment are excluded, matching the inbox listing) - 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, vendor credit, or landed cost invoice 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": "vendor_credit", "id": 9 },
"position": 2,
"total": 47
}
}
Response 404: route constraint blocks type values other than customer_po, supplier_invoice, vendor_credit, or landed_cost_invoice.
Request
Responses
- 200
- 401
- 403
- 404
- 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.
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.