This workflow automates pre-dispatch customs document validation for international shipments. It ingests shipping document packages, extracts content from each file, uses Claude AI to cross-validate all documents for consistency, regulatory compliance, and HS code accuracy, then flags errors before goods are dispatched — preventing costly delays, fines, and rejected shipments at the border.
How it works
- Trigger — Webhook submission or watched Drive/S3 folder when new shipment docs are uploaded
- Register Shipment — Assigns shipment case ID, normalises metadata from payload
- Fetch Document Files — Downloads each document from Google Drive or URL
- Extract Text Content — Parses PDF/DOCX text from all documents
- Classify Document Types — Identifies invoice, packing list, bill of lading, COO, etc.
- Cross-Document Consistency Check — Detects mismatches across documents (values, weights, quantities)
- AI Compliance Validation — Claude AI validates each doc against destination country rules
- Aggregate Findings — Merges per-document results into a shipment-level report
- Route by Risk Level — Branches on CLEAR / HOLD / REJECT
- Notify Logistics Team — Slack alert with error summary and action items
- Email Exporter Report — Detailed validation report with fix instructions
- Update Shipment Tracker — Writes status back to Airtable / Google Sheets
- Create Compliance Ticket — Opens Jira issue for HOLD or REJECT shipments
- Return API Response — Structured JSON result to caller or TMS integration
Setup Steps
- Import workflow into n8n
- Configure credentials:
- Anthropic API — Claude AI for compliance validation
- Google Drive OAuth — Document intake and storage
- Google Sheets OAuth — Shipment compliance audit log
- Airtable — Shipment tracker CRM
- Slack OAuth — Logistics team alerts
- SendGrid / SMTP — Exporter notification emails
- Jira API — Compliance issue tracking
- Set your Google Drive intake folder ID
- Configure destination country rules in the AI prompt node
- Set your Airtable base and shipment table IDs
- Activate the workflow
Sample Webhook Payload
{
"shipmentId": "SHP-2025-00392",
"exporterEmail": "[email protected]",
"originCountry": "CN",
"destinationCountry": "AU",
"incoterms": "FOB",
"declaredValue": 48500,
"currency": "USD",
"goodsDescription": "Electronic Components",
"documents": [
{ "name": "Commercial Invoice", "type": "commercial_invoice", "driveFileId": "1aBcD" },
{ "name": "Packing List", "type": "packing_list", "driveFileId": "2eFgH" },
{ "name": "Bill of Lading", "type": "bill_of_lading", "driveFileId": "3iJkL" },
{ "name": "Certificate of Origin", "type": "certificate_of_origin", "driveFileId": "4mNoP" }
]
}
Documents Supported
- Commercial Invoice
- Packing List
- Bill of Lading (B/L) / Airway Bill (AWB)
- Certificate of Origin (COO / Form D / EUR.1)
- Customs Entry / Import Declaration
- Dangerous Goods Declaration (DGD)
- Phytosanitary / Health Certificate
- Insurance Certificate
- Letter of Credit (L/C)
- Export Licence / Permit
- Material Safety Data Sheet (MSDS)
- Fumigation Certificate
AI Validation Checks
- Field Completeness — All mandatory fields present and populated
- Cross-Document Consistency — Values, weights, quantities, HS codes match across docs
- HS Code Validation — Correct classification for declared goods and destination
- Incoterms Compliance — Terms correctly applied across invoice and B/L
- Valuation Rules — Customs value method correct, currency declared
- Country of Origin — COO criteria met, preferential rates applicable
- Restricted / Prohibited Goods — Flags potential dual-use, CITES, or embargoed items
- Sanction Screening — Party names checked against common red flags
- Date & Validity — Document dates consistent, certificates not expired
Features
- Multi-document cross-validation in a single run
- AI-powered HS code verification and suggestion
- Destination-country–specific compliance rules
- Automatic HOLD/REJECT routing for high-risk findings
- Detailed error report with fix instructions per field
- Full audit trail in Google Sheets
- Jira ticket creation for escalated compliance issues
Explore More Automation:
Contact us to design AI-powered lead nurturing, content engagement, and multi-platform reply workflows tailored to your growth strategy.