Merge a commercial invoice, packing list, and bill of lading into a unified customs declaration.
Who this is for
Freight forwarders and customs brokers use this recipe to automate declaration processing. Upload the commercial invoice, packing list, and bill of lading in one API call — receive a unified customs record with shipper, consignee, goods descriptions, HS codes, weights, and declared values.
import{IterationLayer}from"iterationlayer";constclient=newIterationLayer({apiKey:"YOUR_API_KEY"});constresult=awaitclient.extract({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:"OBJECT",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:"OBJECT",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:"NUMBER",description:"Weight in kilograms"},{name:"declared_value",type:"CURRENCY_AMOUNT",description:"Declared customs value"},]},{name:"total_weight_in_kg",type:"NUMBER",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"},],},});console.log(result);
fromiterationlayerimportIterationLayerclient=IterationLayer(api_key="YOUR_API_KEY")result=client.extract(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":"OBJECT","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":"OBJECT","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":"NUMBER","description":"Weight in kilograms"},{"name":"declared_value","type":"CURRENCY_AMOUNT","description":"Declared customs value"},]},{"name":"total_weight_in_kg","type":"NUMBER","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"},]},)print(result)
packagemainimportil"github.com/iterationlayer/sdk-go"client:=il.NewClient("YOUR_API_KEY")result,err:=client.Extract(il.ExtractRequest{Files:[]il.FileInput{il.NewFileFromURL("commercial-invoice.pdf","https://example.com/docs/commercial-invoice.pdf"),il.NewFileFromURL("packing-list.pdf","https://example.com/docs/packing-list.pdf"),il.NewFileFromURL("bill-of-lading.pdf","https://example.com/docs/bill-of-lading.pdf"),},Schema:il.ExtractionSchema{"goods":il.NewArrayFieldConfig("goods","List of goods in the shipment",[]il.FieldConfig{il.NewTextFieldConfig("description","Description of the goods"),il.NewTextFieldConfig("hs_code","Harmonized System code"),il.NewIntegerFieldConfig("quantity","Number of units"),il.NewDecimalFieldConfig("weight_in_kg","Weight in kilograms"),il.NewCurrencyAmountFieldConfig("declared_value","Declared customs value"),}),"total_weight_in_kg":il.NewDecimalFieldConfig("total_weight_in_kg","Total shipment weight in kilograms"),"total_declared_value":il.NewCurrencyAmountFieldConfig("total_declared_value","Total declared customs value"),"currency":il.NewTextFieldConfig("currency","Currency code for declared values"),},})