The industry-specific problem
A manifest may mix kilograms and pounds, merge header cells, repeat invoice totals on each page, or render a container number as an image. Copying these values manually delays clearance; blindly importing them can create a more expensive declaration error.
Step-by-step workflow
- Ingest PDF attachments in n8n into a restricted document store; record a content hash and document type.
- Extract searchable text first. Route image-only pages to the OpenAI Vision API only when the data-sharing arrangement permits it.
- Ask a currently supported Claude model for typed candidate fields and page references; the requested Claude 3.5 Sonnet label is a legacy requirement to verify, not a guaranteed runtime.
- Validate units, decimal precision, invoice sums, container-number checks and mandatory fields against a versioned CargoWise/EDI mapping.
- Import through your approved CargoWise interface or adapter. Queue unsupported schemas and conflicting source evidence for operator review; retain the original document.
Visual workflow
PDF hash → text extraction
image page → OpenAI Vision → Claude candidate schema
text page → Claude candidate schema
→ unit/totals validation → CargoWise staging OR customs review
Specific configuration example
This n8n Code-node fragment consumes a normalized, authenticated event from preceding integration steps. It demonstrates the decision boundary, not a complete API client. Fields are workflow-local mappings, not claimed vendor field names. Upstream credentials, schema validation, permissions, durable reservations and provider operations must be implemented separately. Numeric policy examples are illustrative, not Imperio service terms.
// n8n Code node: no silent mass-unit conversion
const manifest = $json;
const lines = manifest.lines ?? [];
const issues = [];
for (const line of lines) {
if (line.weight_unit !== "KG") issues.push(`unit:${line.source_page}`);
if (!line.hs_code_verified) issues.push(`classification:${line.source_page}`);
}
const sum = lines.reduce((n, x) => n + Number(x.invoice_value_minor), 0);
if (sum !== manifest.invoice_total_minor) issues.push("invoice_total_mismatch");
return [{ json: { ...manifest, importReady: issues.length === 0, issues } }];
Outcome to measure
Measure operator touch time per manifest, first-pass acceptance and amendment frequency. Illustrative baseline: reducing review from 12 to five minutes across 200 manifests saves about 23 hours, only if amendment rates do not worsen.
Compared with manual work or other tools
Template OCR is strong for stable supplier layouts. Claude-assisted extraction handles variation better but requires validation and evidence. A dedicated EDI integration remains preferable when a shipper already provides reliable structured data.
Work with Imperio Automation
Send Imperio anonymized manifest layouts and your approved CargoWise import specification for an exception-first parsing assessment.
Frequently asked questions
Can the model choose tariff codes?
It may propose candidates with source evidence, but classification needs an authorized verification process before filing.
What if a manifest repeats totals on every page?
Tag document-level totals separately from line values and reject double-counted sums.
Does valid JSON mean valid EDI?
No. Field lengths, code lists, required segments and partner-specific mappings need deterministic checks.