UN Comtrade Trade Data Scraper
Pricing
from $0.02 / 1,000 item extracteds
UN Comtrade Trade Data Scraper
Extract import/export trade rows from UN Comtrade by country, partner, HS code, flow, and period for sourcing and market analysis.
UN Comtrade Trade Data Scraper
Pricing
from $0.02 / 1,000 item extracteds
Extract import/export trade rows from UN Comtrade by country, partner, HS code, flow, and period for sourcing and market analysis.
You can access the UN Comtrade Trade Data Scraper programmatically from your own applications by using the Apify API. You can also choose the language preference from below. To use the Apify API, youโll need an Apify account and your API token, found in Integrations settings in Apify Console.
1import { ApifyClient } from 'apify-client';2
3// Initialize the ApifyClient with your Apify API token4// Replace the '<YOUR_API_TOKEN>' with your token5const client = new ApifyClient({6 token: '<YOUR_API_TOKEN>',7});8
9// Prepare Actor input10const input = {11 "reporterCodes": [12 "842",13 "156"14 ],15 "partnerCodes": [16 "0"17 ],18 "periods": [19 "2023",20 "2022"21 ],22 "commodityCodes": [23 "TOTAL",24 "01",25 "02",26 "03",27 "04",28 "05",29 "06",30 "07",31 "08",32 "09",33 "10",34 "11",35 "12",36 "13",37 "14",38 "15",39 "16",40 "17",41 "18",42 "19",43 "20",44 "21",45 "22",46 "23",47 "24"48 ],49 "flowCodes": [50 "M",51 "X"52 ],53 "frequency": "A",54 "classification": "HS",55 "tradeType": "C",56 "includeDescriptions": true,57 "maxRows": 20,58 "requestDelayMillis": 250,59 "failOnApiError": false60};61
62// Run the Actor and wait for it to finish63const run = await client.actor("automation-lab/un-comtrade-trade-data-scraper").call(input);64
65// Fetch and print Actor results from the run's dataset (if any)66console.log('Results from dataset');67console.log(`๐พ Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);68const { items } = await client.dataset(run.defaultDatasetId).listItems();69items.forEach((item) => {70 console.dir(item);71});72
73// ๐ Want to learn more ๐? Go to โ https://docs.apify.com/api/client/js/docsThe Apify API client for JavaScript is the official library that allows you to use UN Comtrade Trade Data Scraper API in JavaScript or TypeScript, providing convenience functions and automatic retries on errors.
Install the apify-client
$npm install apify-clientOther API clients include: