The trade engine answers the questions a customs declaration depends on: what is this item (classification), may it go there (screening), and what will it cost to land (landed cost). Carriers and 3PLs that broker customs implement it. Universal implementers MAY implement it, by proxying a carrier’s engine or a specialist provider. It reuses the core objects, Item (chapter 01 §3), Contact and Money, so its outputs drop straight into a shipment. The no-invention rule still applies. The engine suggests. It never writes export_hs_code or import_hs_code onto a shipment unless the client explicitly applies a result (§2.3). This sequence shows how the trade resources feed a DDP shipment, from item classification to the duty collection after import.

1. Common inputs

Trade requests take a trade context. It is a subset of a shipment, so a client can send what it already has:
Alternatively, pass shipment: "shp_...", and the context is read from it, with items taken from handling_units[].items[].

2. Classification

2.1 Create

2.2 The classification object

  • status is pending, completed or failed. Requests with more than 100 items MAY be asynchronous and emit classification.completed.
  • confidence is 0–1. Below the implementer’s published threshold, requires_review is true, and the result MUST NOT be applied automatically by any implementer-side automation.
  • rationale is human-readable and is never a substitute for the code.

2.3 Apply and feedback

apply with { "product": "prod_..." } writes into the product’s hs_codes instead (chapter 20). With a shipment, apply writes export_hs_code and import_hs_code to the matching items, matched by sku, then by index, on a draft shipment, and records system_metadata.classification on each one. feedback records corrections that implementers MAY use to improve future suggestions.

3. Compliance screening

  • decision is clear, review or blocked. The worst item or party decides the overall result. An item restriction of prohibited means blocked. restricted, license_required and agency_review mean review. A party match at or above the implementer’s published threshold means review, and an exact match on a sanctions list means blocked.
  • At purchase, blocked fails the purchase, and review lets it proceed with a compliance_review warning in messages[], unless the account setting compliance.block_on_review is true.
  • restrictions[].level is prohibited, restricted (allowed with conditions), license_required, or agency_review (FDA, USDA, CITES…). It may carry license_types[] and documents_required[].
  • When trade is implemented, implementers SHOULD screen automatically at purchase and fail with 422 carrier_error / compliance_blocked, giving the screening ID in error.details.
This flowchart shows how party and item results combine into one decision, and what a blocked result means at purchase.

4. Landed cost

The body is a trade context (§1) plus optional service (a service code, because some fees are carrier-specific) and currency.

The landed_cost object

  • regime.type is standard, eu_ioss, uk_low_value, no_voec, au_lvg, ch_low_value, us_section_321, or other. It also says whether tax is collected at checkout or at import.
  • duties[].measure records the legal basis (MFN, section_301, anti_dumping, countervailing, retaliatory), and preferential records any trade-agreement rate applied.
  • Guarantees. If guaranteed is true, the issuer commits to these totals for a DDP shipment purchased before expires_at that cites this quote in customs_declaration.landed_cost: "lc_...". Rates reuse the object: rate.landed_cost is a landed_cost (with id), so buying a DDP rate binds its quote.
This flowchart shows how the parts of a landed_cost build on each other, from customs value to the guaranteed total.

5. Tariff lookup

Capability trade.tariffs.

6. Duty and tax collections

For carriers and 3PLs that pay import duties and taxes on the shipper’s behalf under DDP, and then collect them from the shipper.
  • status is pending_assessment, due, paid, disputed, or waived.
  • variance is the assessed total minus the guaranteed quote. For guaranteed quotes the issuer absorbs it, so the shipper’s total stays at the quote.
  • POST /v1/duty_collections/{id}/pay with { "payment_method": "..." } settles a collection, with the payment method’s details handled outside this spec. POST /v1/duty_collections/export produces a CSV file. This is capability trade.collections.
This state diagram shows the duty_collection statuses and the events that mark each transition. Transitions without a label have no event in §7.

7. Events

classification.completed, classification.failed, compliance_screening.completed, landed_cost.created, duty_collection.created, duty_collection.assessed, duty_collection.paid, duty_collection.disputed.