UN Comtrade Trade Statistics Scraper
Pricing
from $28.50 / 1,000 results
UN Comtrade Trade Statistics Scraper
Scrapes UN Comtrade international trade records by reporter, partner, commodity, and year. Returns flat rows with trade value, quantity, and classification codes.
Pricing
from $28.50 / 1,000 results
Rating
0.0
(0)
Developer
ParseForge
Maintained by CommunityActor stats
0
Bookmarked
9
Total users
0
Monthly active users
14 days ago
Last modified
Categories
Share
UN Comtrade Trade Statistics Scraper
Scrape UN Comtrade international trade statistics by reporter, partner, commodity, and year, up to a million records per run. Every row returns trade value, quantity, and classification codes. No API key or login. Export to CSV, JSON, Excel, or XML.
UN Comtrade's official API needs a subscription key and rate-limits you. This reads the public trade data directly, filtered by reporter, partner, commodity, flow, and period, and returns each match in one fixed schema.
| Who uses it | What they scrape UN Comtrade for |
|---|---|
| Trade analysts | Which countries are gaining share in a commodity |
| Market researchers | How much a country imports of a product |
| Economists | Bilateral trade flows between two countries |
| Logistics planners | Which trade lanes are growing |
What it does
This Actor collects UN Comtrade trade records by reporter, partner, commodity, and year, and returns each one as a flat row.
- ๐ Reporter and partner filters: query by UN M49 code, including World aggregates and multiple countries at once.
- ๐ฆ Commodity filters: HS codes from TOTAL down to 6-digit, across all HS revisions from 1988 to 2022.
- ๐ Period control: single year or comma-separated years, with raw or aggregated output.
- ๐ Flow direction: imports, exports, re-imports, and re-exports, with customs and transport filters.
Results export to CSV, JSON, Excel, or XML, or straight from the API.
What you can do with UN Comtrade data
๐ Track commodity trade trends.
A market researcher pulls monthly imports of HS 84 machinery for the USA and China over five years to see which country is gaining share.
๐ Map bilateral trade flows.
An economist queries exports from Germany to all partners for HS 87 vehicles to identify the top destinations.
๐ข Plan logistics routes.
A logistics planner collects trade volumes by mode of transport between the USA and Mexico to decide where to add capacity.
๐ Build trade dashboards.
A data analyst schedules weekly runs for a set of commodity codes and feeds the flat rows into a BI tool.
Why choose this scraper
| What you get | |
|---|---|
| No API key | Public UN Comtrade data without a subscription |
| Fixed schema | Every row has the same fields, ready for analysis |
| Up to 1M rows | Collect large datasets in a single run |
| Multiple formats | Export to CSV, JSON, Excel, or XML |
How it compares
No other Store actor targets UN Comtrade the same way, so the honest comparison is with the alternatives teams actually weigh.
| UN Comtrade Trade Statistics Scraper | Build it in-house | By hand | |
|---|---|---|---|
| Setup | Run it now, zero config | Days of engineering | None, but hours per pull |
| When UN Comtrade changes | Maintained for you | You fix it | You re-learn the page |
| Proxies, retries, anti-bot | Built in | Your problem | Browser only |
| Output | Fixed JSON schema, CSV/Excel export | Whatever you build | Copy-paste |
| Cost | Pay per result | Engineering time | Analyst hours |
Configure the run
Drive the Actor from reporter codes, partner codes, commodity codes, and years, alone or together, and filters run as each record is read so only matches reach your dataset. The Input tab lists every parameter.
A first run with the defaults:
{"reporterCode": "842","period": "2023","cmdCode": "TOTAL","clCode": "HS","flowCode": "M","customsCode": "C00","motCode": "0","maxItems": 10}
A larger pull:
{"reporterCode": "842","period": "2023","cmdCode": "TOTAL","clCode": "HS","flowCode": "M","customsCode": "C00","motCode": "0","maxItems": 200}
Pricing
Pay-per-result: $0.038 per result collected. You pay only for the results written to your dataset.
| Results collected | Approximate cost |
|---|---|
| 100 results | $3.80 |
| 1,000 results | $38.00 |
| 10,000 results | $380.00 |
New Apify accounts start with $5 in free credit.
Free users
Free-plan runs return up to 10 results as a preview. Upgrade your Apify plan to collect up to 1,000,000 results per run.
Run it
- Create a free Apify account with $5 in credit.
- Open the UN Comtrade Trade Statistics Scraper.
- Set your inputs and any filters, then click Start.
- Export the results as CSV, Excel, JSON, or XML from the Dataset tab.
Run it programmatically through the Apify API (run-sync-get-dataset-items) or the ApifyClient for JavaScript and Python.
Use with AI agents (MCP)
Give an AI agent live access to UN Comtrade through the Model Context Protocol. Add the Actor to Claude, Cursor, or any MCP client:
$claude mcp add --transport http apify "https://mcp.apify.com?tools=parseforge/un-comtrade-scraper"
Then prompt it in plain language to run the scraper and read back the results.
Troubleshooting
Why am I getting no results?
Check that your reporter and partner codes are valid UN M49 codes. Also verify the period is a year like 2023, not a date range.
Why do I get over 100 rows when I expected one?
You left the partner code empty, so the Actor returns one row per partner. Set partnerCode to 0 for a single World-aggregate row.
Why is my commodity filter not working?
Make sure the commodity code matches the classification you selected. For example, HS 84 is Machinery under the current HS, but may differ in older revisions.
Why does the run stop before collecting all records?
The maxItems field limits the number of records. Increase it up to 1,000,000 if you need more.
Why do I see different values for the same trade flow?
UN Comtrade reports both importer and exporter data, which can differ due to valuation and timing. Use the flowCode to pick the direction you want.
FAQ
| Question | Answer |
|---|---|
| Do I need a UN Comtrade API key? | No. This Actor reads the public data directly, so no subscription or key is required. |
| What is a reporter code? | A UN M49 code for the country that reports the trade. 842 is the USA, 156 is China, 276 is Germany, and 0 is the World aggregate. |
| Can I get all partners in one run? | Yes. Leave the partner code empty and the Actor returns one row per partner, typically over 100 rows. |
| What commodity codes can I use? | HS codes from TOTAL down to 6 digits. You can also choose older HS revisions like H4 for 2012 or H0 for 1988. |
| How do I get multiple years? | Set the period field to a comma-separated list, like 2021,2022,2023. |
| What is the difference between M and X flow codes? | M is imports, X is exports. RM and RX are re-imports and re-exports. |
| Can I aggregate the results? | Yes. Use the aggregateBy field with dimension names like reporterCode,cmdCode to get summarized rows instead of raw records. |
| What is the maximum number of records? | You can collect up to 1,000,000 records per run. |
| Which HS revisions are supported? | All revisions from HS 1988 (H0) to HS 2022 (H6), plus the current HS. |
| Can I filter by mode of transport? | Yes. The motCode field accepts a mode of transport code, with 0 for all modes. |
Related actors
Browse the full ParseForge collection for more scrapers.
๐ Need help? Email parseforge@protonmail.com with your run ID, your input, and what you expected.
โ ๏ธ Disclaimer. This Actor is unofficial and is not affiliated with, endorsed by, or sponsored by United Nations Statistics Division. It collects only publicly available data. You are responsible for using the collected data in compliance with the source's terms of service and applicable data-protection laws, including GDPR, CCPA, and PIPL. Do not use it to collect personal data unlawfully.
