International Trade Flows API (UN Comtrade)

Official yearly or monthly trade between countries from UN Comtrade: exports or imports of a reporting country with a partner, for all goods or one HS product code, in US dollars, with weight and quantity when reported.

$0.50 per 1,000 records

You pay only for the records you get. Zero records cost zero. 10,000 free records of this API to start (5,000 at the base price of $1 per 1,000), no card.

Try it
Ready-made, maintained by usRecords, 9 fieldsv1.0

Data from comtradeapi.un.org/public/v1/preview/C/A/HS?reporterCode=124&period=2024&partnerCode=0&cmdCode=TOTAL&flowCode=X

Get this data

Try it here with a few records, download the sample, fill a Google Sheet, or call it from your own code.

Try it

Reporter
Reporting country, as a two-letter or three-letter code or a name, such as CA, USA or Germany.
Example: CA
Partneroptional
Partner country (code or name), World for the total, or All for every partner (up to 500 rows).
Example: World
Periodoptional
Year such as 2024, or year and month such as 202406 with frequency monthly.
Example: 2024
Frequencyoptional
Annual or monthly figures.
Hs codeoptional
Harmonized System product code of 2, 4 or 6 digits, several separated by commas, or TOTAL for all goods.
Example: TOTAL
Flowoptional
Direction of trade seen by the reporting country.

Run it on this page, or call it from your code with the endpoint in the developer section. A free key covers 10,000 records of this API, no card. Create a free key

For developers: the API and MCPThe endpoint, code in curl, JavaScript and Python, every input, and files for your tools
Endpoint
POSThttps://pullrow.dev/v1/apis/un-comtrade-trade-flows/run
  • Small runs answer in the same request; longer ones answer 202 with a run to poll.
  • fields returns only the fields you name. The examples send the ones picked on this page.
  • Idempotency-Key is optional. A retry with it is never charged twice.
  • You pay for records returned. Zero records cost zero.

Every run option, explained

Calling it needs a key
10,000 free records of this API to start. No card.
curl
curl -X POST "https://pullrow.dev/v1/apis/un-comtrade-trade-flows/run" \
  -H "Authorization: Bearer $PULLROW_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"input":{"reporter":"CA"},"max_items":50}'

Inputs

Send them as input in the request body. Leave one out to use its default.

reportertextrequired
Reporting country, as a two-letter or three-letter code or a name, such as CA, USA or Germany.
example: CA
partnertext
Partner country (code or name), World for the total, or All for every partner (up to 500 rows).
default: Worldexample: World
periodnumber
Year such as 2024, or year and month such as 202406 with frequency monthly.
example: 2024
frequencytext
Annual or monthly figures.
default: annualone of: annual, monthly
hs_codetext
Harmonized System product code of 2, 4 or 6 digits, several separated by commas, or TOTAL for all goods.
default: TOTALexample: TOTAL
flowtext
Direction of trade seen by the reporting country.
default: exportsexample: importsone of: exports, imports

What's in each record

9 fields.

Basics

  • Reporter

    Reporting country.

    Example Canada

  • Partner country or World

    Example World

  • Period

    Year, or year and month, the figure covers.

    Example 2024

  • Flow

    exports or imports.

    Example imports

  • Hs code

    Product code (Harmonized System) or TOTAL.

    Example 0201

  • Description

    Name of the product group.

    Example Meat of bovine animals; fresh or chilled

  • Trade value (USD)

    Value of the trade in US dollars.

    Example 846,316,155.891

  • Net weight (kg)

    Net weight in kilograms, when reported.

    Example 79,076,414

  • Quantity

    Quantity in the product's standard unit, when reported.

    Example 79,076,414

Technical detailsField names and types for developers

Field names and types

The names your code reads in each record. "Filled" counts how many of the 3 sample records carry the field.

Field nameTypeShown on this page asFilled
reportertextReporter3 of 3
partnertextPartner country or World3 of 3
periodtextPeriod3 of 3
flowtextFlow3 of 3
hs_codetextHs code3 of 3
descriptiontextDescription3 of 3
trade_value_usdnumberTrade value (USD)3 of 3
net_weight_kgnumberNet weight (kg)3 of 3
quantitynumberQuantity3 of 3

How it reads the site

Runs on a reader we built and maintain by hand for this site.

Sample records

Sample records
RecordReporterPartner country or WorldPeriodFlowHs codeDescriptionTrade value (USD)Net weight (kg)Quantity
1CanadaWorld2024imports0201Meat of bovine animals; fresh or chilled846,316,155.89179,076,41479,076,414
2CanadaWorld2024imports2709Petroleum oils and oils obtained from bituminous minerals; crude15,154,800,354.10524,774,635,123.5824,774,635,123.58
3CanadaWorld2024imports8703Motor cars and other motor vehicles; principally designed for the transport of persons (other than those of heading no. 8702), including station wagons and racing cars40,529,774,655.8852,238,724,546.3881,462,390

Sample records from the example output this API publishes. Email addresses and phone numbers in them are masked. Hover over a column name to see the field name your code reads.

Reliability

Counted from real runs. Our own health checks are left out. A run succeeded when it finished and the site neither blocked it nor broke it.

Incidents and repairs

How it is kept working What a repair can't do

A ready-made API, maintained by us. It is not part of the daily check or the automatic rebuild yet.

  • You pay only for records returned. A run that returns none costs nothing.
Known limits
  • The free preview service returns at most 500 rows per request, so a broad question (all partners with all products) is cut at 500 rows; ask for one partner or one HS code to get the rest.
  • Countries report on their own schedule: the latest year is often incomplete or missing, and some countries publish with a delay of a year or more. A period with no data returns no rows.
  • Values are as reported to the United Nations, in US dollars. Exports are usually valued free-on-board, imports including freight; mirror data from partners can differ.
  • Weight and quantity are empty for many products and for total-trade rows.
  • HS codes can be 2, 4 or 6 digits (or TOTAL); the goods classification is the Harmonized System as of the version the country used.
  • The source asks users to stay within fair-use limits; runs keep about one request per second. Credit UN Comtrade when you publish the data.

Version history

A run uses the live version unless the request names another one with version.