UN Comtrade Trade Data Scraper icon

Business data

UN Comtrade Trade Data Scraper — Import/Export Stats

Query UN Comtrade's free preview API by country name, ISO code, or HS code and period — no numeric Comtrade codes to look up first — and get back flat, null-free import/export trade rows.

Free Apify credit covers a first run. No credit card to try.

What this Actor scrapes

UN Comtrade's public Preview API (Comtrade Plus public tier, comtradeapi.un.org/public/v1/preview/...) — the same free, keyless endpoint family that powers Comtrade Plus's own quick-look UI. Every combination of reporter country, partner country, period, commodity, and trade flow you request comes back as one flat row with trade value, net weight, and quantity fields, when Comtrade reports them.

What we handle for you

  • Human-friendly input resolution — country name, ISO2, ISO3, or
  • Bounded multi-dimensional fan-out — query multiple reporters,
  • Null-free labelsreporter_name, partner_name, and
  • 🛡️ We rotate browser fingerprints (curl-cffi impersonation across
  • 🔁 We retry with exponential backoff on 408/429/5xx and honour
  • 🧱 One bad combination never crashes the run. A transport error or
  • 🧊 A zero-match combination still succeeds. A narrow filter that

Use cases

  • Trade and supply-chain analysis — pull import/export flows for a
  • Customs and commodity research — check trade value and volume for a
  • Sourcing and procurement due diligence — compare a candidate
  • Academic and journalistic trade datasets — build a clean,

Input

Paste this into the Apify Console, or send it as the run input over the API. Proxy settings are on by default; you rarely need to touch them.

FieldTypeRequiredWhat it does
reporters array yes Reporting countries — name, ISO2, ISO3, or UN numeric code, e.g. United States, USA, 840.
partners array yes Trade partner countries — same accepted formats as reporters. World (or 0) means all partners combined.
periods array yes Years for annual frequency (2023) or YYYYMM for monthly (202301). Must match the selected frequency.
commodities array yes HS code (any digit-length prefix), TOTAL for all commodities, or a free-text description resolved to the closest curated HS chapter/heading.
flow string yes Direction of trade to fetch.
frequency string yes Annual (YYYY periods) or monthly (YYYYMM periods) data.
{
  "reporters": [
    "United States"
  ],
  "partners": [
    "World"
  ],
  "periods": [
    2023
  ],
  "commodities": [
    "TOTAL"
  ],
  "flow": "export",
  "frequency": "annual",
  "proxyConfiguration": {
    "useApifyProxy": true
  }
}

Output

One row per result, schema-validated before it is written. Export JSON, CSV, Excel or XML from the run, or read it over the API.

reporter_codereporter_namereporter_iso2reporter_iso3partner_codepartner_namepartner_iso2partner_iso3periodfrequencyflowhs_codehs_descriptiontrade_value_usdnet_weight_kgqty

{
  "reporter_code": "842",
  "reporter_name": "United States of America",
  "reporter_iso2": "US",
  "reporter_iso3": "USA",
  "partner_code": "0",
  "partner_name": "World",
  "partner_iso2": null,
  "partner_iso3": null,
  "period": "2023",
  "frequency": "annual",
  "flow": "export",
  "hs_code": "TOTAL",
  "hs_description": "All commodities",
  "trade_value_usd": 2018756349021.0,
  "net_weight_kg": null,
  "qty": null,
  "qty_unit": null,
  "is_preview_capped": false,
  "scraped_at": "2026-09-03T06:58:00Z"
}

Pricing

EventPriceWhen
Actor start$0.20Once per run, covers warm-up and proxy session setup.
Result emitted$0.0025Per result written to the dataset.

You pay only for results that land. Cap any run with maxTotalChargeUsd. See pricing & billing for worked examples.

Limitations

  • The Preview API's free tier caps rows returned per single
  • The full cartesian product of your inputs (reporters × partners ×
  • Goods trade only (typeCode=C, HS classification) — services trade and
  • The embedded country and HS reference tables are static data shipped

Ready to run it?

Open the listing on Apify, paste the input above, and watch rows land. If it ever breaks, it is our problem before it is yours.

Related Actors

Teams that run this also run