For developers

How AI agents can classify products and compute landed cost

A guide for developers and AI agents: how to turn a product description into an HS/HTS code and a full landed-cost estimate programmatically, using PortRobin's public API and MCP server — with the honesty rules that keep the numbers trustworthy.

March 19, 2026 · 7 min read

Classification and duty calculation are exactly the kind of task AI agents should own: structured inputs, a fixed schema of rules, and an answer that has to be sourced rather than guessed. The catch is that a language model on its own will happily invent an HTS code and a plausible-looking duty rate — which is worse than useless when a wrong number means a CBP penalty. PortRobin is built so agents get the reasoning from AI and the rate from a schedule of record.

The two-part problem

Getting a landed cost has two distinct steps, and they have different trust models. Classification — turning "men's cotton hoodie" into 6110.20.2079 — is a judgment task where AI genuinely helps, provided it's grounded in the real heading texts and the General Rules of Interpretation. Rating — turning that code plus an origin into a duty figure — is a lookup task where the only acceptable source is the official schedule. PortRobin splits them deliberately.

The rule that makes this safe: the model may propose the code and explain why, but the rate always comes from the dataset, never the model. A code with no sourced rate returns "verify on the HTS", not a fabricated number.

Start free

Classifying a product via the API

Send a product description (and optionally an origin) to the classification endpoint. You get back candidate HTS lines ranked by confidence, each with the heading text, a plain-English gloss, and the reasoning for the match. Your agent can then present the top candidate, ask a clarifying question, or fall back to a broader heading — the same workflow a human classifier follows, just faster.

See the classification endpoint, request/response schema and rate limits.

Classification API docs

Computing landed cost via the API

Pass the resolved HTS code, the customs value, the origin and the freight/insurance figures to the landed-cost endpoint. It resolves the base rate, applies the relevant Section 301 / 232 and other Chapter 99 measures for the origin, adds MPF and HMF, and returns an itemised breakdown — every line tagged with its source and verification date. If a rate can't be sourced, the response says so rather than smoothing over the gap.

Landed-cost endpoint — inputs, the itemised breakdown schema, and the honesty flags.

Landed-cost API docs

Using the MCP server

For agent frameworks that speak the Model Context Protocol, PortRobin exposes the same capabilities as MCP tools — classify a product, look up a code, compute landed cost — so an AI agent can call them natively inside a conversation or workflow. The tool results carry the same sourced-or-null contract as the REST API, which means an agent can reason about whether it has a trustworthy number or needs to tell the user to verify.

  • classify — description in, ranked HTS candidates with reasoning out.
  • lookup — an HTS code in, its official description, rate and measures out.
  • landed_cost — code, value and origin in, an itemised sourced breakdown out.
  • Every tool returns a source URL and date, or an explicit "verify" state.

Connect the MCP server to your agent and start classifying and costing products in-conversation.

API & MCP for agents

Why the honesty contract matters for agents

An agent is only as good as the worst number it will confidently repeat. By returning null instead of a guess when a rate isn't verified, PortRobin lets your agent do the right thing: flag the uncertainty, suggest a binding ruling, or route to a human. That's the difference between an agent that helps an importer and one that gets them fined.

Machine-readable index of everything an agent can use — endpoints, tools and data.

Read llms.txt

Get an API key and classify your first product programmatically today.

Start building free

Classify a product and see its real duty

Describe any product to get its HS/HTS code with the reasoning, the sourced duty rate including Section 301 and 232, and the full landed cost.