Lainstack Docs
How to build freight operations automations with Lainstack: read shipping documents, check them, bring a person in when something is wrong, and update the systems you already use. New here? Start with what Lainstack is and the principles behind it.
Freight recipes
UK customs declarations (CDS)
Send a UK import declaration to CDS from an invoiceRead an invoice and packing list, let a person correct them, build an H1 declaration, check it against CDS rules, send it to HMRC and handle rejections.
Send a UK export declaration to CDS from an invoiceRead an export invoice, let a person correct it, build a B1 export declaration, send it to HMRC and wait until the goods have left the UK.
Send a UK supplementary declaration to CDSComplete a simplified declaration or an entry in your records with its supplementary declaration, checked against CDS rules and sent to HMRC.
Amend or cancel a CDS declaration after acceptanceLet a person check an accepted declaration and send HMRC only the fields they change, or cancel a declaration by MRN before the goods are cleared.
Answer a customs hold with documentsWhen HMRC holds an import and asks for documents, upload them with the declaration's MRN, then check again until the goods are released.
Track CDS declaration status by MRNCheck HMRC's status for your open customs declarations by MRN on a schedule, and act only on those released, rejected or invalidated since you last looked.
Reconcile last month's CDS declarations with your recordsEach month, list every declaration HMRC holds for the trader, compare it with your own records by MRN, and send only the differences to a person.
Roll-on roll-off crossings (GVMS)
Import through a roll-on roll-off port, from declaration to clearancePre-lodge an import, put its MRN on the lorry's goods movement record, and follow the crossing through any inspection until the goods clear.
Export through a roll-on roll-off port, from declaration to exitPre-lodge an export, put its DUCR on the lorry's goods movement record, and hear from HMRC when the goods have left the UK.
Get a lorry through a roll-on roll-off crossing with GVMSCreate a goods movement record for a lorry's crossing from its customs declarations, fix what HMRC flags before check-in, and wait until the goods clear.
Checks before you declare
Check commodity codes on an invoice before you declareLook up each commodity code on an invoice in the UK Trade Tariff and send a person only the codes that are missing, not declarable or out of quota.
Check your customers' EORI numbers with HMRCCheck every GB EORI number in your customer table with HMRC on a schedule, and send only the ones HMRC does not confirm to a person.
Descartes BoxTop
Find or create a Descartes BoxTop job without duplicatesTurn incoming shipment documents into a Descartes BoxTop job, reuse a job that already exists for the reference, attach the documents and record a milestone.
Shipping documents (any system)
Handle shipping documents that arrive by emailRead the invoice and packing list a shipper emails in, ask for what is missing, compare the two and reply in the same thread when they disagree.
Compare a commercial invoice with a packing listMatch an invoice and packing list line by line, set sensible tolerances, handle certificates that split a line, and send only the real differences to a person.
Validate customs XML against an XSD before you send itCheck a customs or TMS XML message against its XSD schema set, list every error by line and path, and stop a bad message before the portal rejects it.
Turn a shipping document into a spreadsheetUpload an invoice or packing list, run OCR on it, read every goods line with AI Agent, and get the lines back as an Excel file with one row per line.
Emissions and CBAM
Estimate UK CBAM charges for importsEstimate the UK CBAM charge of each line of an imports spreadsheet.
Estimate UK transport emissions for shipmentsEstimate the emissions of each leg of your shipments.
Learn Lainstack
Section titled “Learn Lainstack”Build your first automationAdd blocks, map data between them, try it with a draft run and publish.
Connect your systemsWhich connection an AI provider, a TMS or a customs portal needs, and how to check it works.
Read data from a documentRead fields from an invoice with AI, check them and let a person correct them beside the document.
Organizations and workspacesWhere your work lives, the roles people hold and how they join.
Runs and escalationsRead what each step of a run did, group failures by cause, and answer the runs waiting for a person.
Build your first agentSet up an AI assistant that answers questions about your workspace and proposes changes you approve.
Connect an MCP clientGive Claude Code, Codex or Cursor access to your workspaces.
Start with the blocks
Section titled “Start with the blocks”TriggersWhat starts a run: a webhook, a schedule, an email, a submitted operation or another automation.
HTTP RequestCall an external API. Settings, outputs, exits and the traps worth knowing.
FlowBranch, loop, wait and ask a person to approve before the run continues.
DataParse, reshape, look up and transform the values that move between blocks.
Browse every block, or see all the guides and concepts.
Get started
Section titled “Get started”Sign up for Lainstack Cloud and start on the Free plan, with no card, or run it on your own servers. See Get started, Self-host Lainstack and Editions and plans.