Check commodity codes on an invoice before you declare
A wrong commodity code usually surfaces late, when a declaration is rejected or the duty comes out wrong. This recipe checks every line of an invoice against HMRC’s UK Trade Tariff first, so the only lines a person sees are the ones with a problem.
Use this templateNeeds an AI connection.
It checks that each code exists and can be declared and, if you add step 5, that its quotas have room for the goods. It does not choose the code for you. Classifying goods stays with whoever is responsible for the declaration.
Why a supplier’s code is not enough
Section titled “Why a supplier’s code is not enough”HMRC’s guidance says only the first 6 digits of a commodity code are shared worldwide. So a 6-digit HS code on a supplier’s invoice does not name a UK tariff line, and the block refuses it instead of guessing:
| Code on the invoice | What the block does |
|---|---|
| 10 digits | Looks it up. Spaces and dots are ignored. |
| 8 digits | Pads it with 00 and looks it up. |
| 6 digits | Fails the step. A 6-digit code names no tariff line. |
| Anything else | Fails the step. |
1. Get the invoice lines
Section titled “1. Get the invoice lines”Read the lines with AI Agent, with an Answer shape that holds a list of lines, each with its description and commodity code. If the lines already come from your TMS, use those instead.
2. Look up each line
Section titled “2. Look up each line”Add For each item with the lines as Items, and connect Look up commodity code to its Item exit:
- Commodity code: the code on the Current item.
- Country of origin: the line’s origin as a two-letter code,
GBand notUK. Preferences and import controls then show only what applies to goods from there. - Rates on date: leave empty for today, or set a date to check an earlier import.
- Tariff: UK Global Tariff, or Northern Ireland (EU tariff), which lists no UK VAT, so VAT rates come back empty.
- Correctable failure handling: Request correction and retry, so a person or Agent can fix a malformed code in that one field and the block runs again.
The block needs no connection, because the tariff is public.
3. Collect what you want to check
Section titled “3. Collect what you want to check”Wire both the Found and Not found exits to the loop’s Collect input. Under Each item returns, add the line’s description and code, then the lookup’s Declarable, Third Country Duty and Import Controls. Mark the lookup’s fields Optional, because a line on Not found has none of them.
Leave If an item fails on Stop after in-progress items, so a tariff outage stops the run and doesn’t pass as a clean check.
4. Check every row
Section titled “4. Check every row”Connect Done to Checklist. Under Comparison, choose Check every row of a list… and pick the loop’s Results. Set Name rows by to Commodity code, so the review shows which line failed. Add the column Declarable, compared with the fixed value Yes.
A code the tariff does not list has no value in that column. Checklist can’t compare it, so it counts as a finding, the same as a code that exists but can’t be declared.
Set Ask a person to When a check fails, and give it the invoice as Source documents. See Reconcile two documents or lists.
5. Check that quotas have room
Section titled “5. Check that quotas have room”A quota lets a set amount of goods in at a lower duty until it runs out. To catch a line whose quota is already used up, have the lookup compare each line’s quantity with what the quota has left.
- In step 1, add each line’s quantity to the Answer shape, in the unit its quota counts. That is usually net weight in kilograms; the lookup’s Quotas output shows each quota’s unit.
- In Look up commodity code, open Quotas and set Quantity for quotas to the line’s quantity. Set Country of origin too: without it, a code that has quotas always gives No.
- Under Each item returns, add the lookup’s Quota room and Quota problem, both Optional.
- In Checklist, add the column Quota room, compared with the fixed value Yes.
Quota room is Yes for a code with no quotas, so those lines pass. It is No when a quota is Exhausted or Closed, has less left than the line needs, or has no balance to count, as licensed and value quotas don’t, and when the code’s quotas count in different units. Quota problem then names the quota, for example Quota 058619 has 1,240 kg left, 12,000 kg needed.
The balance is the one the tariff shows at the moment of the lookup. It can fall before the declaration is made, so check it again close to the import for large lines.
What goes wrong
Section titled “What goes wrong”- The AI misreads a digit. A misread code can still be a real code, so a clean lookup doesn’t prove the invoice was read correctly. Compare the description that comes back with the one on the invoice, or have a person check high-value lines.
- The code is real but only for another date. Not found means the tariff doesn’t list that code on the date you asked about. Check Rates on date before you treat it as wrong.
- Rate limits and server errors fail the step and can be retried. A request times out after 20 seconds.
Try it
Section titled “Try it”The block reads HMRC’s public tariff directly, so a draft run calls it for real and you can try this on your own invoices straight away.