# Global Trade Data - Imports, Exports & Tariffs by Country (`themineworks/global-trade-data`) Actor

Affordable Global trade data: imports, exports & tariffs by country. $2/1,000 results, 25 free, pay-per-result, no subscription. Works in Claude, ChatGPT & any MCP-compatible AI agent.

- **URL**: https://apify.com/themineworks/global-trade-data.md
- **Developed by:** [The Mine Works](https://apify.com/themineworks) (community)
- **Categories:** Business, Developer tools, MCP servers
- **Stats:** 3 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

Pay per usage

This Actor is paid per platform usage. The Actor is free to use, and you only pay for the Apify platform usage, which gets cheaper the higher subscription plan you have.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-usage

## What's an Apify Actor?

Actors are a software tools running on the Apify platform, for all kinds of web data extraction and automation use cases.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

In JavaScript/TypeScript projects, use official [JavaScript/TypeScript client](https://docs.apify.com/api/client/js.md):

```bash
npm install apify-client
```

In Python projects, use official [Python client library](https://docs.apify.com/api/client/python.md):

```bash
pip install apify-client
```

In shell scripts, use [Apify CLI](https://docs.apify.com/cli/docs.md):

````bash
# MacOS / Linux
curl -fsSL https://apify.com/install-cli.sh | bash
# Windows
irm https://apify.com/install-cli.ps1 | iex
```bash

In AI frameworks, you might use the [Apify MCP server](https://docs.apify.com/platform/integrations/mcp.md).

If your project is in a different language, use the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).


# README

## Global Trade Data — Imports & Exports by Country & Product

Pull **import and export trade values between any two countries**, broken down by product, straight from the **World Bank WITS** TradeStats database. India, China, the US, the EU and 200+ economies, going back years. Built for **trade and supply-chain intelligence, market research, economics and policy analysis**. No API key. You only pay for data points delivered.

**Keywords:** world trade data, import export data API, WITS API, bilateral trade, trade statistics, China India US trade, customs data, supply chain intelligence, trade by product.

---

### Why this actor

Country-to-country trade data is some of the most useful economic data there is — but the official sources (UN Comtrade, US Census) now sit behind API keys, and WITS itself returns SDMX, a famously awkward statistical format with dimension-indexed payloads. This actor handles all of that and gives you **one flat, analysis-ready record per trade flow**:

- **Bilateral trade** — pick a reporter country and one or more partners (or `WLD` for the world).
- **Imports, exports, or both** — in a single run.
- **Product breakdown** — the standard ~29 product sections (Animal, Vegetable, Machinery, Textiles, …), or a specific code for advanced users.
- **Multi-year** — pass a year range to build a time series.
- **Clean output** — reporter, partner, year, flow, product, and trade value in US$ thousand.
- **No API key** — built on the World Bank's open WITS API.

---

### What you can build with it

- **Supply-chain & sourcing intelligence** — see exactly how much of each product category flows between two countries, and how it's trending.
- **Market sizing** — quantify a country's imports of your product category to size an export opportunity.
- **Trade-war / tariff analysis** — track how China↔US or India↔China flows shift year over year by product.
- **Economics & policy research** — assemble bilateral trade matrices without wrestling with SDMX.
- **Dashboards** — feed a country-pair trade dashboard on a schedule.

---

### Input

| Field | Type | Default | Description |
|---|---|---|---|
| `reporter` | string | `USA` | Reporter country, 3-letter ISO (e.g. `USA`, `IND`, `CHN`). |
| `partners` | string[] | `["CHN"]` | Partner countries, ISO3. Use `WLD` for world total. |
| `yearFrom` / `yearTo` | integer | 2021 | Year range. |
| `flows` | string[] | both | `imports`, `exports`, or both. |
| `productCode` | string | `all` | `all` = ~29 product sections; or a specific HS/SITC code. |
| `maxResults` | integer | 1000 | Max data points to return. |

#### Example input

```json
{
  "reporter": "IND",
  "partners": ["CHN", "USA", "ARE"],
  "yearFrom": 2018,
  "yearTo": 2021,
  "flows": ["imports", "exports"],
  "maxResults": 2000
}
````

***

### Output

Each trade flow is one dataset record:

```json
{
  "reporter_code": "USA",
  "reporter": "United States",
  "partner_code": "CHN",
  "partner": "China",
  "year": "2021",
  "flow": "imports",
  "product_code": "16-24_FoodProd",
  "product_name": "Food Products",
  "indicator_code": "MPRT-TRD-VL",
  "indicator": "Import Trade Value (US$ Thousand)",
  "value_usd_thousand": 2728506.284,
  "scraped_at": "2026-06-11T13:00:00.000Z"
}
```

A final `{"_type": "summary"}` record reports how many data points were returned.

***

### Pricing

**Your first 25 data points are free — every Apify account, no card, no trial clock.** After that it is a flat **$0.002 per data point**.

- First 25 points free per account (lifetime), then $0.002/point ($2 per 1,000)
- **Zero charge on empty runs** — parameters that return no data cost nothing
- No monthly minimum, no rental
- A bilateral, both-flows, single-year query (~58 points) costs about $0.07 after the free tier

***

### FAQ

**Do I need an API key?** No. This is built on the World Bank's open WITS API.

**Which countries are covered?** 200+ reporting economies, including India, China, the US, the EU members, and most of the world.

**How recent is the data?** WITS trade data runs with the usual official statistical lag — typically through the prior year or two. Pass a year range to see what's available.

**Can I get a specific product, not just the sections?** Yes — pass a specific HS/SITC code in `productCode`. Leave it as `all` for the standard ~29-section breakdown.

**What's the difference from UN Comtrade?** WITS is built largely on Comtrade data but is openly accessible without a key. For the most granular tariff-line detail, Comtrade (key required) goes deeper; for clean country-by-product trade values, WITS is ideal and key-free.

# Actor input Schema

## `reporter` (type: `string`):

The country whose trade you want, as a 3-letter ISO code (e.g. USA, IND, CHN, DEU, GBR).

## `partners` (type: `array`):

Trading-partner countries as 3-letter ISO codes (e.g. CHN, IND). Use WLD for the world total. Leave empty for WLD.

## `yearFrom` (type: `integer`):

Earliest year. WITS trade data typically runs through the prior year or two.

## `yearTo` (type: `integer`):

Latest year.

## `flows` (type: `array`):

Which direction(s) to return.

## `productCode` (type: `string`):

WITS product code. Use 'all' for the standard product-section breakdown (~29 groups). Advanced users can pass a specific HS/SITC code.

## `maxResults` (type: `integer`):

Maximum number of trade data points to return.

## Actor input object example

```json
{
  "reporter": "USA",
  "partners": [
    "CHN"
  ],
  "yearFrom": 2021,
  "yearTo": 2021,
  "flows": [
    "imports",
    "exports"
  ],
  "productCode": "all",
  "maxResults": 100
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "reporter": "USA",
    "partners": [
        "CHN"
    ],
    "yearFrom": 2021,
    "yearTo": 2021,
    "flows": [
        "imports",
        "exports"
    ],
    "maxResults": 100
};

// Run the Actor and wait for it to finish
const run = await client.actor("themineworks/global-trade-data").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = {
    "reporter": "USA",
    "partners": ["CHN"],
    "yearFrom": 2021,
    "yearTo": 2021,
    "flows": [
        "imports",
        "exports",
    ],
    "maxResults": 100,
}

# Run the Actor and wait for it to finish
run = client.actor("themineworks/global-trade-data").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "reporter": "USA",
  "partners": [
    "CHN"
  ],
  "yearFrom": 2021,
  "yearTo": 2021,
  "flows": [
    "imports",
    "exports"
  ],
  "maxResults": 100
}' |
apify call themineworks/global-trade-data --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=themineworks/global-trade-data",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

```json
{
    "openapi": "3.0.1",
    "info": {
        "title": "Global Trade Data - Imports, Exports & Tariffs by Country",
        "description": "Affordable Global trade data: imports, exports & tariffs by country. $2/1,000 results, 25 free, pay-per-result, no subscription. Works in Claude, ChatGPT & any MCP-compatible AI agent.",
        "version": "0.1",
        "x-build-id": "iixsmHlTlrMnlqqXP"
    },
    "servers": [
        {
            "url": "https://api.apify.com/v2"
        }
    ],
    "paths": {
        "/acts/themineworks~global-trade-data/run-sync-get-dataset-items": {
            "post": {
                "operationId": "run-sync-get-dataset-items-themineworks-global-trade-data",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for its completion, and returns Actor's dataset items in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        },
        "/acts/themineworks~global-trade-data/runs": {
            "post": {
                "operationId": "runs-sync-themineworks-global-trade-data",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor and returns information about the initiated run in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK",
                        "content": {
                            "application/json": {
                                "schema": {
                                    "$ref": "#/components/schemas/runsResponseSchema"
                                }
                            }
                        }
                    }
                }
            }
        },
        "/acts/themineworks~global-trade-data/run-sync": {
            "post": {
                "operationId": "run-sync-themineworks-global-trade-data",
                "x-openai-isConsequential": false,
                "summary": "Executes an Actor, waits for completion, and returns the OUTPUT from Key-value store in response.",
                "tags": [
                    "Run Actor"
                ],
                "requestBody": {
                    "required": true,
                    "content": {
                        "application/json": {
                            "schema": {
                                "$ref": "#/components/schemas/inputSchema"
                            }
                        }
                    }
                },
                "parameters": [
                    {
                        "name": "token",
                        "in": "query",
                        "required": true,
                        "schema": {
                            "type": "string"
                        },
                        "description": "Enter your Apify token here"
                    }
                ],
                "responses": {
                    "200": {
                        "description": "OK"
                    }
                }
            }
        }
    },
    "components": {
        "schemas": {
            "inputSchema": {
                "type": "object",
                "required": [
                    "reporter"
                ],
                "properties": {
                    "reporter": {
                        "title": "Reporter country (ISO3)",
                        "type": "string",
                        "description": "The country whose trade you want, as a 3-letter ISO code (e.g. USA, IND, CHN, DEU, GBR)."
                    },
                    "partners": {
                        "title": "Partner countries (ISO3)",
                        "type": "array",
                        "description": "Trading-partner countries as 3-letter ISO codes (e.g. CHN, IND). Use WLD for the world total. Leave empty for WLD.",
                        "items": {
                            "type": "string"
                        }
                    },
                    "yearFrom": {
                        "title": "From year",
                        "type": "integer",
                        "description": "Earliest year. WITS trade data typically runs through the prior year or two.",
                        "default": 2021
                    },
                    "yearTo": {
                        "title": "To year",
                        "type": "integer",
                        "description": "Latest year.",
                        "default": 2021
                    },
                    "flows": {
                        "title": "Trade flows",
                        "type": "array",
                        "description": "Which direction(s) to return.",
                        "items": {
                            "type": "string",
                            "enum": [
                                "imports",
                                "exports"
                            ]
                        }
                    },
                    "productCode": {
                        "title": "Product code",
                        "type": "string",
                        "description": "WITS product code. Use 'all' for the standard product-section breakdown (~29 groups). Advanced users can pass a specific HS/SITC code.",
                        "default": "all"
                    },
                    "maxResults": {
                        "title": "Max data points",
                        "minimum": 1,
                        "maximum": 50000,
                        "type": "integer",
                        "description": "Maximum number of trade data points to return.",
                        "default": 1000
                    }
                }
            },
            "runsResponseSchema": {
                "type": "object",
                "properties": {
                    "data": {
                        "type": "object",
                        "properties": {
                            "id": {
                                "type": "string"
                            },
                            "actId": {
                                "type": "string"
                            },
                            "userId": {
                                "type": "string"
                            },
                            "startedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "finishedAt": {
                                "type": "string",
                                "format": "date-time",
                                "example": "2025-01-08T00:00:00.000Z"
                            },
                            "status": {
                                "type": "string",
                                "example": "READY"
                            },
                            "meta": {
                                "type": "object",
                                "properties": {
                                    "origin": {
                                        "type": "string",
                                        "example": "API"
                                    },
                                    "userAgent": {
                                        "type": "string"
                                    }
                                }
                            },
                            "stats": {
                                "type": "object",
                                "properties": {
                                    "inputBodyLen": {
                                        "type": "integer",
                                        "example": 2000
                                    },
                                    "rebootCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "restartCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "resurrectCount": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "computeUnits": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "options": {
                                "type": "object",
                                "properties": {
                                    "build": {
                                        "type": "string",
                                        "example": "latest"
                                    },
                                    "timeoutSecs": {
                                        "type": "integer",
                                        "example": 300
                                    },
                                    "memoryMbytes": {
                                        "type": "integer",
                                        "example": 1024
                                    },
                                    "diskMbytes": {
                                        "type": "integer",
                                        "example": 2048
                                    }
                                }
                            },
                            "buildId": {
                                "type": "string"
                            },
                            "defaultKeyValueStoreId": {
                                "type": "string"
                            },
                            "defaultDatasetId": {
                                "type": "string"
                            },
                            "defaultRequestQueueId": {
                                "type": "string"
                            },
                            "buildNumber": {
                                "type": "string",
                                "example": "1.0.0"
                            },
                            "containerUrl": {
                                "type": "string"
                            },
                            "usage": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "integer",
                                        "example": 1
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            },
                            "usageTotalUsd": {
                                "type": "number",
                                "example": 0.00005
                            },
                            "usageUsd": {
                                "type": "object",
                                "properties": {
                                    "ACTOR_COMPUTE_UNITS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATASET_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "KEY_VALUE_STORE_WRITES": {
                                        "type": "number",
                                        "example": 0.00005
                                    },
                                    "KEY_VALUE_STORE_LISTS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_READS": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "REQUEST_QUEUE_WRITES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_INTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "DATA_TRANSFER_EXTERNAL_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_RESIDENTIAL_TRANSFER_GBYTES": {
                                        "type": "integer",
                                        "example": 0
                                    },
                                    "PROXY_SERPS": {
                                        "type": "integer",
                                        "example": 0
                                    }
                                }
                            }
                        }
                    }
                }
            }
        }
    }
}
```
