Skip to content

Send CDS declaration

Builds an import, simplified, supplementary or export declaration from invoice data and client tables, checks it, sends it to HMRC and waits for its decision.

@lainstack/hmrc/send-cds-declaration · Customs · Available on Lainstack Cloud

Use Send CDS declaration to build a customs declaration, check it, send it to HMRC Customs Declarations and wait for HMRC’s decision. It builds from the reviewed Invoice data, the client’s row in the Client table (matched on Client) and that client’s rows in the Product table.

Choose the Declaration and its Type:

  • Import (IMA, IMD): an H1, or with Procedure set to customs warehousing (7100) an H2.
  • Simplified import (IMC, IMF): an SDP frontier declaration, which an IMY completes. Needs sde_authorisation; deferment only.
  • Supplementary import (IMY, IMZ): completes a simplified declaration or a records entry. Fill in Earlier declaration. Due by the 10th of the following month; deferment only.
  • Export (EXA, EXD): a B1. Set the Office of exit.

The client’s method_of_payment says how duty is paid: E deferment account, P CDS cash account, H bank transfer.

Good to know:

  • The declaration is checked against CDS rules and HMRC’s schemas before it is sent. Errors open a document review: a reviewer fixes the fields and the block sends with the changes, or rejects and the run takes Rejected in review. HMRC refusing or rejecting it opens a review too, and a resend uses a new LRN.
  • Source documents show beside the declaration in review.
  • Wait until: Received (MRN issued) on IMD, IMF and EXD, before the goods arrive; Accepted (MRN issued); on imports Released, which leaves on Held by customs if customs holds the goods; on exports Exited, once the departure is recorded against the DUCR.
  • A GVMS goods location (code ending GVM) adds RRS01, except on a supplementary.
  • With no decision within Give up after (minutes) (default 15, up to 14 days) the block leaves on Timed out.
  • A draft run holds this block: nothing is built, checked or sent. Publish and run it against a sandbox connection.
  • It sends at most once per attempt; the XML and its record are saved as run files.
Setting Key Type Details
HMRC connection (required) credentialId Connection The trader’s HMRC Customs Declarations connection. A draft run holds the send on every connection. At most 160 characters.
Invoice data (required) invoice Value The reviewed invoice and packing list, usually Reviewed data from the review step.
Source documents documents Value PDF or image files shown beside the declaration when it needs fixing.
Client (required) client Text Who the declaration is for, by their client key.
Declaration declaration One of Import, Simplified import, Supplementary import, Export Default import.
Type declarationTypeCode One of Goods have arrived (IMA), Before arrival, pre-lodged (IMD), Goods have arrived (IMC), Before arrival, pre-lodged (IMF), After a simplified declaration (IMY), After an entry in your records (IMZ), Goods have arrived at the place of export (EXA), Before arrival, pre-lodged (EXD) Default IMA.
Procedure procedure One of Release to free circulation (4000), Customs warehousing (7100) Default 4000.
Wait until waitUntil One of Received (MRN issued), Accepted (MRN issued), Released (goods cleared), Exited (goods left the UK) Received continues as soon as HMRC has the pre-lodged declaration and its MRN, before the goods arrive. Accepted continues once HMRC accepts it. Released keeps waiting until the goods are released, and stops early if customs holds them. Exited waits until HMRC says the exported goods have left the UK. Default accepted.
Simplified declaration MRN simplifiedDeclarationMrn Text The MRN of the simplified frontier declaration this completes.
Accepted at previousAcceptedAt Text When HMRC accepted the simplified declaration (IMY), or when the goods were entered in your records (IMZ). This is the tax point.
DUCR ducr Text The DUCR of the frontier declaration or the records entry.
Entry summary MRN entrySummaryMrn Text Optional. The carrier’s ENS MRN. Without it only the DUCR is declared.
Client table (required) clientsTableId Text One row per client key: EORIs, payment and authorisations.
Product table (required) productLibraryTableId Text Each client’s products with their commodity codes.
Goods location goodsLocationId Text HMRC goods location code. Defaults to WLALONBTW.
Office of exit exitOffice Text The customs office where the goods leave the UK, e.g. GB000040.
Declaration fields document Value Every field of the declaration, filled from the inputs above. Change a field to override how it’s filled. At most 100 items.
Give up after (minutes) timeoutMinutes Number Take the Timed out path when HMRC has not decided by then. Defaults to 15; up to 20160 (14 days, as long as HMRC keeps notifications). From 1 to 20,160. Default 15.
Output Path Type
Outcome outcome Choice
Summary summary Text
LRN lrn Text
DUCR ducr Text
MRN mrn Text
Environment environment Text
Conversation ID conversationId Text
Submitted At submittedAt Text
Accepted At acceptedAt Text
Checked At checkedAt Text
Next Check At nextCheckAt Text
HMRC Problem hmrcProblem Text
Issues issues List
Refusal > Code refusal.code Text
Refusal > Message refusal.message Text
Refusal > Errors refusal.errors List
Refusal > Explanation refusal.explanation Text
Errors errors List
Tax Lines taxLines List
Tax Total > Amount taxTotal.amount Text
Tax Total > Currency taxTotal.currency Text
Notifications notifications List
Unreadable Notifications unreadableNotifications List
Declaration XML document Value
Declaration record documentRecord Value
Exit Port Notes
Accepted out
Rejected in review rejected Failure exit.
Held by customs held
Timed out timedOut

Last updated: