curl -X POST https://api.iterationlayer.com/document-extraction/v1/extract \
-H "Authorization: Bearer $ITERATION_LAYER_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"files": [
{
"type": "url",
"name": "commercial-invoice.pdf",
"url": "https://example.com/docs/commercial-invoice.pdf"
},
{
"type": "url",
"name": "packing-list.pdf",
"url": "https://example.com/docs/packing-list.pdf"
},
{
"type": "url",
"name": "bill-of-lading.pdf",
"url": "https://example.com/docs/bill-of-lading.pdf"
}
],
"schema": {
"fields": [
{
"name": "shipper",
"type": "ARRAY",
"description": "Shipper details",
"fields": [
{
"name": "name",
"type": "TEXT",
"description": "Shipper company name"
},
{
"name": "address",
"type": "TEXT",
"description": "Shipper address"
},
{
"name": "country",
"type": "TEXT",
"description": "Shipper country"
}
]
},
{
"name": "consignee",
"type": "ARRAY",
"description": "Consignee details",
"fields": [
{
"name": "name",
"type": "TEXT",
"description": "Consignee company name"
},
{
"name": "address",
"type": "TEXT",
"description": "Consignee address"
},
{
"name": "country",
"type": "TEXT",
"description": "Consignee country"
}
]
},
{
"name": "goods",
"type": "ARRAY",
"description": "List of goods in the shipment",
"fields": [
{
"name": "description",
"type": "TEXT",
"description": "Description of the goods"
},
{
"name": "hs_code",
"type": "TEXT",
"description": "Harmonized System code"
},
{
"name": "quantity",
"type": "INTEGER",
"description": "Number of units"
},
{
"name": "weight_in_kg",
"type": "DECIMAL",
"description": "Weight in kilograms"
},
{
"name": "declared_value",
"type": "CURRENCY_AMOUNT",
"description": "Declared customs value"
}
]
},
{
"name": "total_weight_in_kg",
"type": "DECIMAL",
"description": "Total shipment weight in kilograms"
},
{
"name": "total_declared_value",
"type": "CURRENCY_AMOUNT",
"description": "Total declared customs value"
},
{
"name": "currency",
"type": "TEXT",
"description": "Currency code for declared values"
}
]
}
}'{
"success": true,
"data": {
"shipper": {
"value": {
"name": {
"value": "Shenzhen Electronics Co.",
"confidence": 0.97,
"citations": ["Shenzhen Electronics Co., Ltd."]
},
"address": {
"value": "88 Nanshan Road, Shenzhen",
"confidence": 0.94,
"citations": ["88 Nanshan Road, Shenzhen 518000"]
},
"country": {
"value": "CN",
"confidence": 0.99,
"citations": ["China"]
}
},
"confidence": 0.96,
"citations": []
},
"consignee": {
"value": {
"name": {
"value": "EuroTech Imports GmbH",
"confidence": 0.98,
"citations": ["EuroTech Imports GmbH"]
},
"address": {
"value": "Industriestr. 12, Hamburg",
"confidence": 0.95,
"citations": ["Industriestr. 12, 20095 Hamburg"]
},
"country": {
"value": "DE",
"confidence": 0.99,
"citations": ["Germany"]
}
},
"confidence": 0.96,
"citations": []
},
"goods": {
"value": [
{
"description": {
"value": "Wireless Bluetooth Earbuds",
"confidence": 0.96,
"citations": ["Wireless Bluetooth Earbuds"]
},
"hs_code": {
"value": "8518.30.20",
"confidence": 0.93,
"citations": ["HS 8518.30.20"]
},
"quantity": {
"value": 500,
"confidence": 0.98,
"citations": ["Qty: 500 pcs"]
},
"weight_in_kg": {
"value": 45.0,
"confidence": 0.95,
"citations": ["Net Weight: 45.0 kg"]
},
"declared_value": {
"value": {
"amount": "7,500.00",
"currency": "USD"
},
"confidence": 0.97,
"citations": ["USD 7,500.00"]
}
}
],
"confidence": 0.95,
"citations": []
},
"total_weight_in_kg": {
"value": 52.5,
"confidence": 0.96,
"citations": ["Gross Weight: 52.5 kg"]
},
"total_declared_value": {
"value": {
"amount": "7,500.00",
"currency": "USD"
},
"confidence": 0.97,
"citations": ["Total Declared Value: USD 7,500.00"]
},
"currency": {
"value": "USD",
"confidence": 0.99,
"citations": ["Currency: USD"]
}
}
}import { IterationLayer } from "iterationlayer";
const client = new IterationLayer({ apiKey: "YOUR_API_KEY" });
const result = await client.extractDocument({
files: [
{
type: "url",
name: "commercial-invoice.pdf",
url: "https://example.com/docs/commercial-invoice.pdf",
},
{
type: "url",
name: "packing-list.pdf",
url: "https://example.com/docs/packing-list.pdf",
},
{
type: "url",
name: "bill-of-lading.pdf",
url: "https://example.com/docs/bill-of-lading.pdf",
},
],
schema: {
fields: [
{
name: "shipper",
type: "ARRAY",
description: "Shipper details",
fields: [
{
name: "name",
type: "TEXT",
description: "Shipper company name",
},
{
name: "address",
type: "TEXT",
description: "Shipper address",
},
{
name: "country",
type: "TEXT",
description: "Shipper country",
},
],
},
{
name: "consignee",
type: "ARRAY",
description: "Consignee details",
fields: [
{
name: "name",
type: "TEXT",
description: "Consignee company name",
},
{
name: "address",
type: "TEXT",
description: "Consignee address",
},
{
name: "country",
type: "TEXT",
description: "Consignee country",
},
],
},
{
name: "goods",
type: "ARRAY",
description: "List of goods in the shipment",
fields: [
{
name: "description",
type: "TEXT",
description: "Description of the goods",
},
{
name: "hs_code",
type: "TEXT",
description: "Harmonized System code",
},
{
name: "quantity",
type: "INTEGER",
description: "Number of units",
},
{
name: "weight_in_kg",
type: "DECIMAL",
description: "Weight in kilograms",
},
{
name: "declared_value",
type: "CURRENCY_AMOUNT",
description: "Declared customs value",
},
],
},
{
name: "total_weight_in_kg",
type: "DECIMAL",
description: "Total shipment weight in kilograms",
},
{
name: "total_declared_value",
type: "CURRENCY_AMOUNT",
description: "Total declared customs value",
},
{
name: "currency",
type: "TEXT",
description: "Currency code for declared values",
},
],
},
});{
"success": true,
"data": {
"shipper": {
"value": {
"name": {
"value": "Shenzhen Electronics Co.",
"confidence": 0.97,
"citations": ["Shenzhen Electronics Co., Ltd."]
},
"address": {
"value": "88 Nanshan Road, Shenzhen",
"confidence": 0.94,
"citations": ["88 Nanshan Road, Shenzhen 518000"]
},
"country": {
"value": "CN",
"confidence": 0.99,
"citations": ["China"]
}
},
"confidence": 0.96,
"citations": []
},
"consignee": {
"value": {
"name": {
"value": "EuroTech Imports GmbH",
"confidence": 0.98,
"citations": ["EuroTech Imports GmbH"]
},
"address": {
"value": "Industriestr. 12, Hamburg",
"confidence": 0.95,
"citations": ["Industriestr. 12, 20095 Hamburg"]
},
"country": {
"value": "DE",
"confidence": 0.99,
"citations": ["Germany"]
}
},
"confidence": 0.96,
"citations": []
},
"goods": {
"value": [
{
"description": {
"value": "Wireless Bluetooth Earbuds",
"confidence": 0.96,
"citations": ["Wireless Bluetooth Earbuds"]
},
"hs_code": {
"value": "8518.30.20",
"confidence": 0.93,
"citations": ["HS 8518.30.20"]
},
"quantity": {
"value": 500,
"confidence": 0.98,
"citations": ["Qty: 500 pcs"]
},
"weight_in_kg": {
"value": 45.0,
"confidence": 0.95,
"citations": ["Net Weight: 45.0 kg"]
},
"declared_value": {
"value": {
"amount": "7,500.00",
"currency": "USD"
},
"confidence": 0.97,
"citations": ["USD 7,500.00"]
}
}
],
"confidence": 0.95,
"citations": []
},
"total_weight_in_kg": {
"value": 52.5,
"confidence": 0.96,
"citations": ["Gross Weight: 52.5 kg"]
},
"total_declared_value": {
"value": {
"amount": "7,500.00",
"currency": "USD"
},
"confidence": 0.97,
"citations": ["Total Declared Value: USD 7,500.00"]
},
"currency": {
"value": "USD",
"confidence": 0.99,
"citations": ["Currency: USD"]
}
}
}from iterationlayer import IterationLayer
client = IterationLayer(api_key="YOUR_API_KEY")
result = client.extract_document(
files=[
{
"type": "url",
"name": "commercial-invoice.pdf",
"url": "https://example.com/docs/commercial-invoice.pdf",
},
{
"type": "url",
"name": "packing-list.pdf",
"url": "https://example.com/docs/packing-list.pdf",
},
{
"type": "url",
"name": "bill-of-lading.pdf",
"url": "https://example.com/docs/bill-of-lading.pdf",
},
],
schema={
"fields": [
{
"name": "shipper",
"type": "ARRAY",
"description": "Shipper details",
"fields": [
{
"name": "name",
"type": "TEXT",
"description": "Shipper company name",
},
{
"name": "address",
"type": "TEXT",
"description": "Shipper address",
},
{
"name": "country",
"type": "TEXT",
"description": "Shipper country",
},
],
},
{
"name": "consignee",
"type": "ARRAY",
"description": "Consignee details",
"fields": [
{
"name": "name",
"type": "TEXT",
"description": "Consignee company name",
},
{
"name": "address",
"type": "TEXT",
"description": "Consignee address",
},
{
"name": "country",
"type": "TEXT",
"description": "Consignee country",
},
],
},
{
"name": "goods",
"type": "ARRAY",
"description": "List of goods in the shipment",
"fields": [
{
"name": "description",
"type": "TEXT",
"description": "Description of the goods",
},
{
"name": "hs_code",
"type": "TEXT",
"description": "Harmonized System code",
},
{
"name": "quantity",
"type": "INTEGER",
"description": "Number of units",
},
{
"name": "weight_in_kg",
"type": "DECIMAL",
"description": "Weight in kilograms",
},
{
"name": "declared_value",
"type": "CURRENCY_AMOUNT",
"description": "Declared customs value",
},
],
},
{
"name": "total_weight_in_kg",
"type": "DECIMAL",
"description": "Total shipment weight in kilograms",
},
{
"name": "total_declared_value",
"type": "CURRENCY_AMOUNT",
"description": "Total declared customs value",
},
{
"name": "currency",
"type": "TEXT",
"description": "Currency code for declared values",
},
]
},
){
"success": true,
"data": {
"shipper": {
"value": {
"name": {
"value": "Shenzhen Electronics Co.",
"confidence": 0.97,
"citations": ["Shenzhen Electronics Co., Ltd."]
},
"address": {
"value": "88 Nanshan Road, Shenzhen",
"confidence": 0.94,
"citations": ["88 Nanshan Road, Shenzhen 518000"]
},
"country": {
"value": "CN",
"confidence": 0.99,
"citations": ["China"]
}
},
"confidence": 0.96,
"citations": []
},
"consignee": {
"value": {
"name": {
"value": "EuroTech Imports GmbH",
"confidence": 0.98,
"citations": ["EuroTech Imports GmbH"]
},
"address": {
"value": "Industriestr. 12, Hamburg",
"confidence": 0.95,
"citations": ["Industriestr. 12, 20095 Hamburg"]
},
"country": {
"value": "DE",
"confidence": 0.99,
"citations": ["Germany"]
}
},
"confidence": 0.96,
"citations": []
},
"goods": {
"value": [
{
"description": {
"value": "Wireless Bluetooth Earbuds",
"confidence": 0.96,
"citations": ["Wireless Bluetooth Earbuds"]
},
"hs_code": {
"value": "8518.30.20",
"confidence": 0.93,
"citations": ["HS 8518.30.20"]
},
"quantity": {
"value": 500,
"confidence": 0.98,
"citations": ["Qty: 500 pcs"]
},
"weight_in_kg": {
"value": 45.0,
"confidence": 0.95,
"citations": ["Net Weight: 45.0 kg"]
},
"declared_value": {
"value": {
"amount": "7,500.00",
"currency": "USD"
},
"confidence": 0.97,
"citations": ["USD 7,500.00"]
}
}
],
"confidence": 0.95,
"citations": []
},
"total_weight_in_kg": {
"value": 52.5,
"confidence": 0.96,
"citations": ["Gross Weight: 52.5 kg"]
},
"total_declared_value": {
"value": {
"amount": "7,500.00",
"currency": "USD"
},
"confidence": 0.97,
"citations": ["Total Declared Value: USD 7,500.00"]
},
"currency": {
"value": "USD",
"confidence": 0.99,
"citations": ["Currency: USD"]
}
}
}package main
import il "github.com/iterationlayer/sdk-go"
func main() {
client := il.NewClient("YOUR_API_KEY")
result, err := client.ExtractDocument(il.ExtractDocumentRequest{
Files: []il.FileInput{
il.FileInput{
Type: "url",
Name: "commercial-invoice.pdf",
Url: "https://example.com/docs/commercial-invoice.pdf",
},
il.FileInput{
Type: "url",
Name: "packing-list.pdf",
Url: "https://example.com/docs/packing-list.pdf",
},
il.FileInput{
Type: "url",
Name: "bill-of-lading.pdf",
Url: "https://example.com/docs/bill-of-lading.pdf",
},
},
Schema: il.ExtractionSchema{
Fields: []any{
il.ArrayFieldConfig{
Name: "shipper",
Type: "ARRAY",
Description: "Shipper details",
Fields: []any{
il.TextFieldConfig{
Name: "name",
Type: "TEXT",
Description: "Shipper company name",
},
il.TextFieldConfig{
Name: "address",
Type: "TEXT",
Description: "Shipper address",
},
il.TextFieldConfig{
Name: "country",
Type: "TEXT",
Description: "Shipper country",
},
},
},
il.ArrayFieldConfig{
Name: "consignee",
Type: "ARRAY",
Description: "Consignee details",
Fields: []any{
il.TextFieldConfig{
Name: "name",
Type: "TEXT",
Description: "Consignee company name",
},
il.TextFieldConfig{
Name: "address",
Type: "TEXT",
Description: "Consignee address",
},
il.TextFieldConfig{
Name: "country",
Type: "TEXT",
Description: "Consignee country",
},
},
},
il.ArrayFieldConfig{
Name: "goods",
Type: "ARRAY",
Description: "List of goods in the shipment",
Fields: []any{
il.TextFieldConfig{
Name: "description",
Type: "TEXT",
Description: "Description of the goods",
},
il.TextFieldConfig{
Name: "hs_code",
Type: "TEXT",
Description: "Harmonized System code",
},
il.IntegerFieldConfig{
Name: "quantity",
Type: "INTEGER",
Description: "Number of units",
},
il.DecimalFieldConfig{
Name: "weight_in_kg",
Type: "DECIMAL",
Description: "Weight in kilograms",
},
il.CurrencyAmountFieldConfig{
Name: "declared_value",
Type: "CURRENCY_AMOUNT",
Description: "Declared customs value",
},
},
},
il.DecimalFieldConfig{
Name: "total_weight_in_kg",
Type: "DECIMAL",
Description: "Total shipment weight in kilograms",
},
il.CurrencyAmountFieldConfig{
Name: "total_declared_value",
Type: "CURRENCY_AMOUNT",
Description: "Total declared customs value",
},
il.TextFieldConfig{
Name: "currency",
Type: "TEXT",
Description: "Currency code for declared values",
},
},
},
})
if err != nil {
panic(err)
}
_ = result
}{
"success": true,
"data": {
"shipper": {
"value": {
"name": {
"value": "Shenzhen Electronics Co.",
"confidence": 0.97,
"citations": ["Shenzhen Electronics Co., Ltd."]
},
"address": {
"value": "88 Nanshan Road, Shenzhen",
"confidence": 0.94,
"citations": ["88 Nanshan Road, Shenzhen 518000"]
},
"country": {
"value": "CN",
"confidence": 0.99,
"citations": ["China"]
}
},
"confidence": 0.96,
"citations": []
},
"consignee": {
"value": {
"name": {
"value": "EuroTech Imports GmbH",
"confidence": 0.98,
"citations": ["EuroTech Imports GmbH"]
},
"address": {
"value": "Industriestr. 12, Hamburg",
"confidence": 0.95,
"citations": ["Industriestr. 12, 20095 Hamburg"]
},
"country": {
"value": "DE",
"confidence": 0.99,
"citations": ["Germany"]
}
},
"confidence": 0.96,
"citations": []
},
"goods": {
"value": [
{
"description": {
"value": "Wireless Bluetooth Earbuds",
"confidence": 0.96,
"citations": ["Wireless Bluetooth Earbuds"]
},
"hs_code": {
"value": "8518.30.20",
"confidence": 0.93,
"citations": ["HS 8518.30.20"]
},
"quantity": {
"value": 500,
"confidence": 0.98,
"citations": ["Qty: 500 pcs"]
},
"weight_in_kg": {
"value": 45.0,
"confidence": 0.95,
"citations": ["Net Weight: 45.0 kg"]
},
"declared_value": {
"value": {
"amount": "7,500.00",
"currency": "USD"
},
"confidence": 0.97,
"citations": ["USD 7,500.00"]
}
}
],
"confidence": 0.95,
"citations": []
},
"total_weight_in_kg": {
"value": 52.5,
"confidence": 0.96,
"citations": ["Gross Weight: 52.5 kg"]
},
"total_declared_value": {
"value": {
"amount": "7,500.00",
"currency": "USD"
},
"confidence": 0.97,
"citations": ["Total Declared Value: USD 7,500.00"]
},
"currency": {
"value": "USD",
"confidence": 0.99,
"citations": ["Currency: USD"]
}
}
}{
"name": "Extract Customs Declaration",
"nodes": [
{
"parameters": {
"content": "## Extract Customs Declaration\n\nFreight forwarders and customs brokers use this recipe to automate declaration processing. Upload a commercial invoice, packing list, and bill of lading in one API call \u2014 receive a unified customs record with shipper, consignee, goods description, HS codes, weights, and declared values.\n\n**Note:** This workflow uses the Iteration Layer community node (`n8n-nodes-iterationlayer`). Install it via Settings > Community Nodes on self-hosted n8n, or add it directly on n8n Cloud with Verified Community Nodes enabled.",
"height": 280,
"width": 500,
"color": 2
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
200,
40
],
"id": "c4414550-c43e-4423-b40a-d0ea01b504b4",
"name": "Overview"
},
{
"parameters": {
"content": "### Step 1: Extract Data\nResource: **Document Extraction**\n\nConfigure the Document Extraction parameters below, then connect your credentials.",
"height": 160,
"width": 300,
"color": 6
},
"type": "n8n-nodes-base.stickyNote",
"typeVersion": 1,
"position": [
475,
100
],
"id": "6c3d22ba-8551-48ca-8924-df2cb20bd73e",
"name": "Step 1 Note"
},
{
"parameters": {},
"type": "n8n-nodes-base.manualTrigger",
"typeVersion": 1,
"position": [
250,
300
],
"id": "a7b8c9d0-e1f2-3456-abcd-567890123456",
"name": "Manual Trigger"
},
{
"parameters": {
"resource": "documentExtraction",
"schemaInputMode": "rawJson",
"schemaJson": "{\"fields\":[{\"name\":\"shipper\",\"type\":\"ARRAY\",\"description\":\"Shipper details\",\"fields\":[{\"name\":\"name\",\"type\":\"TEXT\",\"description\":\"Shipper company name\"},{\"name\":\"address\",\"type\":\"TEXT\",\"description\":\"Shipper address\"},{\"name\":\"country\",\"type\":\"TEXT\",\"description\":\"Shipper country\"}]},{\"name\":\"consignee\",\"type\":\"ARRAY\",\"description\":\"Consignee details\",\"fields\":[{\"name\":\"name\",\"type\":\"TEXT\",\"description\":\"Consignee company name\"},{\"name\":\"address\",\"type\":\"TEXT\",\"description\":\"Consignee address\"},{\"name\":\"country\",\"type\":\"TEXT\",\"description\":\"Consignee country\"}]},{\"name\":\"goods\",\"type\":\"ARRAY\",\"description\":\"List of goods in the shipment\",\"fields\":[{\"name\":\"description\",\"type\":\"TEXT\",\"description\":\"Description of the goods\"},{\"name\":\"hs_code\",\"type\":\"TEXT\",\"description\":\"Harmonized System code\"},{\"name\":\"quantity\",\"type\":\"INTEGER\",\"description\":\"Number of units\"},{\"name\":\"weight_in_kg\",\"type\":\"DECIMAL\",\"description\":\"Weight in kilograms\"},{\"name\":\"declared_value\",\"type\":\"CURRENCY_AMOUNT\",\"description\":\"Declared customs value\"}]},{\"name\":\"total_weight_in_kg\",\"type\":\"DECIMAL\",\"description\":\"Total shipment weight in kilograms\"},{\"name\":\"total_declared_value\",\"type\":\"CURRENCY_AMOUNT\",\"description\":\"Total declared customs value\"},{\"name\":\"currency\",\"type\":\"TEXT\",\"description\":\"Currency code for declared values\"}]}",
"files": {
"fileValues": [
{
"fileInputMode": "url",
"fileName": "commercial-invoice.pdf",
"fileUrl": "https://example.com/docs/commercial-invoice.pdf"
},
{
"fileInputMode": "url",
"fileName": "packing-list.pdf",
"fileUrl": "https://example.com/docs/packing-list.pdf"
},
{
"fileInputMode": "url",
"fileName": "bill-of-lading.pdf",
"fileUrl": "https://example.com/docs/bill-of-lading.pdf"
}
]
}
},
"type": "n8n-nodes-iterationlayer.iterationLayer",
"typeVersion": 1,
"position": [
500,
300
],
"id": "b8c9d0e1-f2a3-4567-bcde-678901234567",
"name": "Extract Data",
"credentials": {
"iterationLayerApi": {
"id": "1",
"name": "Iteration Layer API"
}
}
}
],
"connections": {
"Manual Trigger": {
"main": [
[
{
"node": "Extract Data",
"type": "main",
"index": 0
}
]
]
}
},
"settings": {
"executionOrder": "v1"
}
}Extract a customs declaration from the files at [commercial invoice URL], [packing list URL], and [bill of lading URL]. Use the extract_document tool with these fields:
- shipper (ARRAY): With name (TEXT), address (TEXT), country (TEXT)
- consignee (ARRAY): With name (TEXT), address (TEXT), country (TEXT)
- goods (ARRAY): Each with description (TEXT), hs_code (TEXT), quantity (INTEGER), weight_in_kg (DECIMAL), declared_value (CURRENCY_AMOUNT)
- total_weight_in_kg (DECIMAL): Total shipment weight in kilograms
- total_declared_value (CURRENCY_AMOUNT): Total declared customs value
- currency (TEXT): Currency code for declared values