Skip to main content

Get Extraction

GET 

/api/landed-cost-invoices/ocr/:landed_cost_extraction_id

Retrieve a landed cost invoice OCR extraction record. Eager-loads the matched supplier and any extraction→bill pivots created during apply. Returns extracted header data merged with matched supplier info, line items with per-line cost-category matches (6-tier match: mapped → exact_name → name_substring → keyword → fuzzy_name → fuzzy_mapped → unmatched), candidate targets (inbound shipments / POs / warehouse transfers that fit the supplier + ETA window), and inbound-email source metadata.

Example 200 response:

{
"data": {
"id": 18,
"status": "pending_review",
"file_url": "https://sku2.test/api/landed-cost-invoices/ocr/18/pdf",
"file_name": "DHL-Invoice-INV-44219.pdf",
"page_count": 2,
"header": {
"vendor_name": {"value": "DHL Express", "confidence": 0.94},
"invoice_number": {"value": "INV-44219", "confidence": 0.91},
"invoice_date": {"value": "2026-04-12", "confidence": 0.88},
"currency_code": {"value": "USD", "confidence": 0.97},
"currency_rate": 1.0,
"total_amount": {"value": 1850.75, "confidence": 0.93},
"matched_supplier_id": 12,
"matched_supplier_name": "DHL Express"
},
"is_matched_supplier": true,
"extracted_supplier_name": "DHL Express",
"lines": [
{
"description": "Freight Charges",
"quantity": 1,
"unit_price": 1500.00,
"line_total": 1500.00,
"matched_cost_category_id": 4,
"matched_cost_category_name": "Freight",
"match_tier": "exact_name",
"ignored": false
}
],
"unmatched_line_count": 0,
"candidate_targets": [
{
"target_type": "inbound_shipment",
"target_id": 142,
"reference": "IS-00142",
"eta": "2026-04-15",
"reason": "supplier_eta_close"
},
{
"target_type": "purchase_order",
"target_id": 88,
"reference": "PO-12345",
"reason": "supplier_match"
}
],
"working_state": null,
"prebind_target_type": null,
"prebind_target_id": null,
"azure_cost_usd": 0.0125,
"error_message": null,
"source": "email",
"source_email_from": "billing@dhl.com",
"source_email_subject": "DHL Invoice INV-44219",
"tracked_job_log_id": 9221,
"supplier": { "id": 12, "name": "DHL Express" },
"extraction_bills": [],
"confirmed_at": null,
"confirmed_by_user_id": null,
"created_at": "2026-05-01T08:14:00.000000Z",
"updated_at": "2026-05-01T08:14:00.000000Z"
}
}

Match tiers (in order of confidence): mapped (Tier 0 — saved supplier mapping), exact_name, name_substring, keyword, fuzzy_name, fuzzy_mapped, unmatched.

Candidate target reasons: prebind (from upload param), supplier_eta_close (open inbound shipment for matched supplier with ETA within window), supplier_match (any open PO / WT for matched supplier).

Request

Responses

Successful response