More from the blog

Try it yourself — free credit, no card.

Start free →
How to size an import market with UN Comtrade (worked example: Indonesia, HS 2106) — FlintAPI Blog
FlintAPI
Models Pricing Playground Consulting Chat API Docs Sign In Start Free
[market-research trade-data comtrade market-entry]

How to size an import market with UN Comtrade (worked example: Indonesia, HS 2106)

2026-10-304 min read

Most "market size" numbers in decks are unverifiable. The free UN Comtrade API gives you the underlying

trade flows, and it takes about ten minutes to turn them into a defensible number. Below is the exact

method, with a worked example whose figures you can re-run yourself.

The number you actually want

For a product that is imported rather than produced locally, the fastest defensible proxy for market

size is **import value for the relevant HS code**. It is not total consumer spend, and it is not your

serviceable market — but it is a published, counterparty-reported figure that survives a client's

follow-up question.

Step 1 — pick the HS code, and be honest about its granularity

HS 2106 is "food preparations not elsewhere specified or included". It contains plant-based ready meals,

protein powders, supplements and more. If your product sits inside 2106, **the code cannot separate it

from the rest** — say so in the report rather than pretending the number is product-specific.

Sub-segment splits are the first thing to leave out, not to estimate.

Step 2 — call the API

GET https://comtradeapi.un.org/public/v1/preview/C/A/HS
      ?reporterCode=360&period=2023&cmdCode=2106&flowCode=M

`reporterCode` is the M49 code of the importing country (360 = Indonesia, 704 = Vietnam),

`flowCode=M` means imports.

Step 3 — the total is the World row, not the sum of everything

The response contains a row with `partnerCode = 0`. That is the aggregate. It equals the sum of the

single-partner rows — **if you add the aggregate to the partner rows you double the total.**

This is the single most common way this exercise goes wrong.

For Indonesia / HS 2106 / 2023:

| Row | Value (USD) |

|---|---|

| partnerCode = 0 (World) | **703,645,643** |

| sum of the 87 single-partner rows | **703,645,643** |

They match to the dollar. Use either, but not both.

Step 4 — read the partner concentration, not just the total

| Partner (M49) | Value (USD) | Share |

|---|---|---|

| China (156) | 156,669,628 | 22.27% |

| Singapore (702) | 103,182,165 | 14.66% |

| Malaysia (458) | 91,048,707 | 12.94% |

| Republic of Korea (410) | 72,121,246 | 10.25% |

| Thailand (764) | 43,370,510 | 6.16% |

The top five account for **66.28%**, which leaves **33.72%** spread across every other supplier —

that long tail is usually where a new entrant's realistic opening is.

One caveat the API forces on you: the payload does **not** carry partner names. `partnerDesc` is null.

The names above are mapped from the M49 country codes, and any report should say so, because a name

looks like data even when it is an annotation.

Step 5 — add one macro anchor

Import value means little without scale. The World Bank API gives it for free:

GET https://api.worldbank.org/v2/country/IDN/indicator/NY.GDP.MKTP.CD?format=json

Indonesia, 2025: GDP **USD 1,445,642,584,163.81**; population **285,721,236**; internet users **72.78%** (2024).

Each of those has its own year — carry the years into the table, because mixing years silently is how

"data" becomes "marketing".

What you cannot get from this exercise

- **Year-on-year change**, if the prior year returns HTTP 429. Write *not available*. Do not interpolate.

- **Prices, margins, or forecasts.** Trade data has none of them.

- **Who your buyer is.** Comtrade reports flows between countries, not companies.

If a number is missing, the honest output is a gap in the table. An estimated gap is worse than a blank

one, because the blank invites a question and the estimate invites trust it has not earned.

### Worked examples, if you want to see the format first

Each of these pages shows one number taken straight from the UN Comtrade API, with the exact query, the

retrieval date and the year-over-year change - so you can check the method before spending anything:

- [Indonesia, HS 2106, 2023](/import-data/idn-hs2106-2023.html)

- [Indonesia, HS 2701 (coal), 2023](/import-data/idn-hs2701-2023.html)

- [Indonesia, HS 1511 (palm oil), 2023](/import-data/idn-hs1511-2023.html)

- [Viet Nam, HS 0901 (coffee), 2023](/import-data/vnm-hs0901-2023.html)

A reproducible version of this

We package exactly this workflow into a spreadsheet: the total (with the World-row derivation stated),

the partner table with codes and shares, macro indicators with their years, and a sources sheet listing

every URL and every gap — plus the API query so you can re-run it.

- Free sample (Indonesia, HS 2106): [Indonesia_HS2106_Trade_Data.xlsx](/samples/Indonesia_HS2106_Trade_Data.xlsx)

- Second sample (Vietnam, HS 2106): [Vietnam_HS2106_Trade_Data.xlsx](/samples/Vietnam_HS2106_Trade_Data.xlsx)

- Order a pack for your own country and HS code: [verified trade data packs](/data-packs.html)

If any figure in a pack does not match the query, tell us and we fix it or refund.

Need this data as a spreadsheet you can check line by line?

Verified trade data packs — every figure carries its source URL →