UN Comtrade International Trade Statistics Scraper avatar

UN Comtrade International Trade Statistics Scraper

Pricing

from $28.50 / 1,000 results

Go to Apify Store
UN Comtrade International Trade Statistics Scraper

UN Comtrade International Trade Statistics Scraper

Scrape the United Nations Comtrade free preview API for international trade flows. Pull imports, exports, re-imports and re-exports between reporters and partners by HS commodity code and year, including value, quantity, net weight, gross weight and customs procedure.

Pricing

from $28.50 / 1,000 results

Rating

0.0

(0)

Developer

ParseForge

ParseForge

Maintained by Community

Actor stats

0

Bookmarked

2

Total users

1

Monthly active users

3 days ago

Last modified

Share

ParseForge Banner

๐ŸŒ UN Comtrade International Trade Statistics Scraper

๐Ÿš€ Export bilateral trade flows in seconds. Pull imports, exports, re-imports and re-exports between 200+ reporting countries and partners, by HS commodity code and year. Includes CIF and FOB values, quantities, net and gross weights. No sign-up needed.

๐Ÿ•’ Last updated: 2026-05-15 ยท ๐Ÿ“Š 47 fields per record ยท ๐ŸŒ 200+ countries ยท ๐Ÿงพ 5,000+ HS commodity codes ยท ๐Ÿ“… 1962-present

The UN Comtrade Scraper pulls from the official United Nations Comtrade source, the world's most comprehensive bilateral merchandise trade database. Every record carries 47 fields, including reporter and partner identifiers (UN M49 codes plus ISO 3166-1 alpha-3), commodity codes across every HS revision (HS 1988 through HS 2022), customs procedure, mode of transport, and a complete suite of value and quantity measures (CIF, FOB, primary value, net weight, gross weight, alternate quantity).

Coverage spans 200+ reporter countries, every UN partner economy, all four flow directions (Imports, Exports, Re-imports, Re-exports), and 8 HS classification revisions. Annual data goes back to 1962 for many reporters. Choose any commodity (TOTAL aggregate or specific 2- or 6-digit HS code), specify the year, optionally restrict to a single partner, and download the result as CSV, Excel, JSON, or XML in under three minutes.

๐ŸŽฏ Target Audience๐Ÿ’ก Primary Use Cases
Trade economists, supply chain analysts, customs and policy researchers, ESG teams, journalists, market researchers, academic institutionsBilateral trade balances, import/export volume tracking, commodity sourcing analysis, sanctions monitoring, tariff impact studies, trade-flow visualisations

๐Ÿ“‹ What the UN Comtrade Scraper does

Eleven filtering inputs combine in a single run:

  • ๐Ÿณ๏ธ Reporter filter. Pick any UN M49 country code (842 = USA, 156 = China, 276 = Germany, 392 = Japan, 826 = United Kingdom, 250 = France) or pull a multi-reporter comparison.
  • ๐Ÿค Partner filter. Restrict to a single trading partner, leave empty for every partner row, or chain a second partner code for 3-way trade analysis.
  • ๐Ÿ“ฆ Commodity filter. TOTAL aggregate, broad chapters (27 = mineral fuels, 84 = machinery, 85 = electrical machinery, 87 = vehicles), or specific 6-digit HS codes.
  • ๐Ÿ”„ Flow direction. Imports, Exports, Re-imports, Re-exports.
  • ๐Ÿ“… Period. Single year or comma-separated list across multiple years.
  • ๐Ÿงพ Classification revision. HS current, plus HS 2022, 2017, 2012, 2007, 2002, 1996, 1988 for time-series consistency.
  • ๐Ÿšš Customs procedure and mode of transport. Drill down to specific clearance regimes or transport modes.
  • ๐Ÿ“ Aggregation control. Roll up rows by named dimensions or keep the raw breakdown.

Each record returns reporter and partner ISO codes, descriptive labels, commodity description, CIF and FOB values, primary value, net and gross weights, quantities with their unit of measure, estimation flags, and a deep link back to the official Comtrade trade-flow viewer.

๐Ÿ’ก Why it matters: bilateral trade data underpins every supply-chain risk model, sanctions impact study, and country-level export competitiveness analysis. Building this pipeline yourself means handling complex paging, M49-to-ISO joins, dimension labelling, and multi-classification reconciliation. This Actor handles it all and keeps your dataset fresh on every run.


๐ŸŽฌ Full Demo

๐Ÿšง Coming soon: a 3-minute walkthrough showing how to go from sign-up to a downloaded bilateral trade dataset.


โš™๏ธ Input

InputTypeDefaultBehavior
maxItemsinteger10Records to return. Free plan caps at 10, paid plan at 1,000,000.
reporterCodestring"842"UN M49 reporter code. Comma-separate for multiple reporters.
partnerCodestring""UN M49 partner code. Empty = every partner row, "0" = World aggregate.
partner2Codestring""Second partner code for 3-way trade analysis.
periodstring"2023"Year or comma-separated years.
cmdCodestring"TOTAL"HS commodity code. TOTAL = all commodities, or any 2- or 6-digit HS code.
clCodestring"HS"HS classification revision (HS, H6, H5, H4, H3, H2, H1, H0).
flowCodestring"M"M = imports, X = exports, RM = re-imports, RX = re-exports.
customsCodestring"C00"Customs procedure. C00 = all procedures.
motCodestring"0"Mode of transport. 0 = all modes.
aggregateBystring""Comma-separated dimension names to aggregate by, or empty for raw rows.

Example: Germany imports from every partner in 2023, all commodities.

{
"maxItems": 200,
"reporterCode": "276",
"partnerCode": "",
"period": "2023",
"cmdCode": "TOTAL",
"flowCode": "M"
}

Example: USA vehicle exports (HS chapter 87) to Mexico across three years.

{
"maxItems": 100,
"reporterCode": "842",
"partnerCode": "484",
"period": "2021,2022,2023",
"cmdCode": "87",
"flowCode": "X"
}

โš ๏ธ Good to Know: UN Comtrade's preview tier returns up to 500 rows per query. For very large multi-country, multi-year pulls, split your request into smaller, well-scoped runs. Some smaller reporting economies have data lags of 6 to 12 months. Re-export and re-import flows are not reported by every country.


๐Ÿ“Š Output

Each trade-flow record contains 47 fields. Download the dataset as CSV, Excel, JSON, or XML.

๐Ÿงพ Schema

FieldTypeExample
๐Ÿ†” periodnumber2023
๐Ÿ“… refYearnumber2023
๐Ÿณ๏ธ reporterCodenumber842
๐Ÿณ๏ธ reporterISOstring"USA"
๐Ÿท๏ธ reporterDescstring"USA"
๐Ÿ”„ flowCodestring"M"
๐Ÿ”„ flowDescstring"Import"
๐Ÿค partnerCodenumber156
๐Ÿค partnerISOstring"CHN"
๐Ÿท๏ธ partnerDescstring"China"
๐Ÿ“ฆ cmdCodestring"TOTAL"
๐Ÿ“ฆ cmdDescstring | null"All Commodities"
๐Ÿšš customsCodestring"C00"
๐Ÿš› motCodestring"0"
๐Ÿ’ฐ cifvaluenumber | null426885050000
๐Ÿ’ต fobvaluenumber | nullnull
๐Ÿ’ฒ primaryValuenumber | null426885050000
โš–๏ธ netWgtnumber | null12345678
โš–๏ธ grossWgtnumber | nullnull
๐Ÿงฎ qtynumber | nullnull
๐Ÿ”— urlstring"https://comtradeplus.un.org/TradeFlow?..."
๐Ÿ•’ scrapedAtISO 8601"2026-05-15T00:00:00.000Z"

(Plus 25 more fields covering classification metadata, alternate quantities, weight estimation flags, and second-partner data.)

๐Ÿ“ฆ Sample record


โœจ Why choose this Actor

Capability
๐ŸŒGlobal coverage. 200+ reporting countries with data going back to 1962 for many reporters.
๐Ÿ”„All flow directions. Imports, Exports, Re-imports, Re-exports in a single schema.
๐Ÿงพ8 classification revisions. HS current plus every back-revision (HS 2022, 2017, 2012, 2007, 2002, 1996, 1988) for time-series consistency.
๐Ÿค3-way trade support. Optional second partner code unlocks transit and triangular trade analysis.
๐Ÿท๏ธPre-joined ISO codes. UN M49 numeric codes are mapped to ISO 3166-1 alpha-3 (USA, CHN, DEU, JPN) so joins to other datasets just work.
โšกFast. Hundreds of rows in seconds, multi-year pulls in under a minute.
๐ŸšซNo authentication. Pulls from a public preview tier. No login or registration needed.

๐Ÿ“Š Bilateral trade data is the foundation of every customs intelligence platform, supply-chain risk model, and country-level export competitiveness benchmark.


๐Ÿ“ˆ How it compares to alternatives

ApproachCostCoverageRefreshFiltersSetup
โญ UN Comtrade Scraper (this Actor)$5 free credit, then pay-per-use200+ reporters, 1962-presentLive per runreporter, partner, commodity, flow, year, classificationโšก 2 min
Official trade-data portalsFreeCountry-by-countryQuarterlyWeb form only๐Ÿข Hours per query
Commercial trade-intelligence platforms$5,000+/yearGlobalWeeklyManyโณ Setup + license
Manual CSV downloadsFreeLimited per queryManualFew๐Ÿ•’ Hours of cleanup

Pick this Actor when you need clean, structured bilateral trade data with full HS classification support and no licensing overhead.


๐Ÿš€ How to use

  1. ๐Ÿ“ Sign up. Create a free account with $5 credit (takes 2 minutes).
  2. ๐ŸŒ Open the Actor. Go to the UN Comtrade Scraper page on the Apify Store.
  3. ๐ŸŽฏ Set input. Pick a reporter (842 = USA), commodity (TOTAL or a specific HS code), flow (M for imports), and year.
  4. ๐Ÿš€ Run it. Click Start and let the Actor collect your trade data.
  5. ๐Ÿ“ฅ Download. Grab your results in the Dataset tab as CSV, Excel, JSON, or XML.

โฑ๏ธ Total time from sign-up to downloaded dataset: 3-5 minutes. No coding required.


๐Ÿ’ผ Business use cases

๐Ÿ“ฆ Supply Chain & Sourcing

  • Track import volumes for a critical commodity over 5 years
  • Identify alternate sourcing countries when a primary supplier is disrupted
  • Benchmark unit costs across competing supplier countries
  • Map dependency on single-country imports of strategic goods

๐Ÿ“Š Trade Intelligence & Consulting

  • Build bilateral trade balance dashboards for client briefings
  • Detect tariff-driven trade diversion across HS chapters
  • Track sanctions impact on commodity flows year-over-year
  • Power export-opportunity scorecards for trade-promotion agencies

๐Ÿ›๏ธ Policy & Public Sector

  • Monitor compliance with bilateral trade agreements
  • Quantify export performance after tariff adjustments
  • Track strategic-goods flows for export-control programs
  • Inform trade negotiation positions with bilateral data

๐Ÿ’ผ Finance & ESG

  • Macro-trade overlays for sovereign credit research
  • Country-risk and supply-chain exposure scoring
  • ESG due diligence on conflict-mineral and forced-labour sources
  • Commodity-flow indicators feeding macro investment models

๐Ÿ”Œ Automating UN Comtrade Scraper

Control the scraper programmatically for scheduled runs and pipeline integrations:

  • ๐ŸŸข Node.js. Install the apify-client NPM package.
  • ๐Ÿ Python. Use the apify-client PyPI package.
  • ๐Ÿ“š See the Apify documentation for full details.

The Apify Schedules feature lets you trigger this Actor on any cron interval. Annual or quarterly refreshes keep downstream trade dashboards in sync automatically.


๐ŸŒŸ Beyond business use cases

Bilateral trade data powers more than commercial workflows. The same structured records support research, education, civic projects, and personal initiatives.

๐ŸŽ“ Research and academia

  • Empirical trade economics papers and dissertations
  • Cross-country panel datasets for econometrics courses
  • Reproducible studies with cited, versioned dataset pulls
  • Open-data exercises on globalisation and trade flows

๐ŸŽจ Personal and creative

  • Data-journalism visualisations of import dependencies
  • Personal portfolios with global trade-flow maps
  • Sankey diagrams of bilateral commodity flows
  • Hobbyist analyses of niche industries

๐Ÿค Non-profit and civic

  • Investigative journalism on sanctions evasion and conflict commodities
  • Civic transparency around national trade balances
  • NGO research on resource-extraction supply chains
  • OpenData community contributions

๐Ÿงช Experimentation

  • Train ML models on commodity-price-versus-flow relationships
  • Validate trade-tech product hypotheses with real data
  • Prototype agent pipelines that resolve HS commodity codes
  • Test dashboard concepts with live bilateral trade feeds

๐Ÿค– Ask an AI assistant about this scraper

Open a ready-to-send prompt about this ParseForge actor in the AI of your choice:


โ“ Frequently Asked Questions

๐Ÿงฉ How does it work?

Configure your reporter, partner, commodity, flow direction, and year filters in the input form, click Start, and the Actor pulls structured rows from the official UN Comtrade source. M49 numeric codes are mapped to ISO 3166-1 alpha-3 automatically so the rows are ready to join with any other country dataset.

๐Ÿ“ How accurate is the data?

UN Comtrade is the global reference for bilateral merchandise trade. Records are reported by national customs authorities and may differ between reporter and partner (mirror discrepancy is a known characteristic of trade data). For very recent periods, expect reporting lags of 6 to 12 months for some economies.

๐Ÿ” How often is the dataset refreshed?

The official Comtrade source updates as national authorities submit revisions. Every run of this Actor pulls live data, so your dataset reflects the current state at run time.

๐Ÿ“ฆ Which classification revisions are supported?

All 8: HS current, HS 2022 (H6), HS 2017 (H5), HS 2012 (H4), HS 2007 (H3), HS 2002 (H2), HS 1996 (H1), and HS 1988 (H0). Use back-revisions when building consistent long time series.

๐ŸŒ Can I pull every partner row in one query?

Yes. Leave partnerCode empty and the Actor returns one row per partner, typically 100+ rows per reporter for a TOTAL commodity query.

๐Ÿ”„ What's the difference between Imports, Exports, Re-imports, and Re-exports?

Imports (M) are foreign goods entering the reporter for domestic use. Exports (X) are domestic goods leaving the reporter. Re-imports (RM) are domestic goods returning unchanged after a temporary export. Re-exports (RX) are foreign goods leaving after entering the reporter. Not every country reports re-imports and re-exports.

โฐ Can I schedule regular runs?

Yes. Use Apify Schedules to run this Actor on any cron interval (annual, quarterly, monthly) and keep downstream trade dashboards in sync.

UN Comtrade publishes under the United Nations data policy that permits public use, including commercial use, with attribution. Review the official terms for your specific use case.

๐Ÿ’ณ Do I need a paid Apify plan to use this Actor?

No. The free Apify plan is enough for testing and small runs (10 records per run). A paid plan lifts the limit and gives you access to scheduling, higher concurrency, and larger datasets.

๐Ÿ” What happens if a run fails or gets interrupted?

Apify automatically retries transient errors. If a run still fails, you can inspect the log in the Runs tab, fix the input, and re-run. Partial datasets from failed runs are preserved so you never lose progress.

๐Ÿ†˜ What if I need help?

Our support team is here to help. Contact us through the Apify platform or use the Tally form linked below.


๐Ÿ”Œ Integrate with any app

UN Comtrade Scraper connects to any cloud service via Apify integrations:

  • Make - Automate multi-step workflows
  • Zapier - Connect with 5,000+ apps
  • Slack - Get run notifications in your channels
  • n8n - Self-hosted automation pipelines
  • Pipedream - Event-driven workflow automation
  • Airbyte - Pipe trade data into your warehouse
  • GitHub - Trigger runs from commits and releases
  • Google Drive - Export datasets straight to Sheets

You can also use webhooks to trigger downstream actions when a run finishes. Push fresh trade data into your product backend, or alert your team in Slack.


๐Ÿ’ก Pro Tip: browse the complete ParseForge collection for more reference-data scrapers.


๐Ÿ†˜ Need Help? Open our contact form to request a new scraper, propose a custom data project, or report an issue.


โš ๏ธ Disclaimer: this Actor is an independent tool and is not affiliated with, endorsed by, or sponsored by the United Nations or UN Comtrade. All trademarks mentioned are the property of their respective owners. Only publicly available open trade statistics are collected.