# UN Comtrade Bilateral Trade Flows API

> UN Comtrade Bilateral Trade Flows API is a paid API for AI agents from api.ssh.autos, paid per call via x402, $0.01/call, status unknown (last checked 2026-11-14).

Fetches bilateral international trade flow data from UN Comtrade by reporter country, partner country, HS commodity code, and year

## Facts

- Endpoint: POST https://api.ssh.autos/v1/comtrade/trade?utm_source=zero.xyz
- Price: $0.01/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-14
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/un-comtrade-bilateral-trade-flows-api-a48de59b
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_XnQWlt5YmBRqgdRWAtT-M

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability un-comtrade-bilateral-trade-flows-api-a48de59b -d '<json body>'
```

Example prompt: Pull UN Comtrade bilateral trade data for the US reporting on exports to China for HS code 8517 (mobile phones) in 2022, give me up to 5 records.

## When to prefer this

Use this endpoint when you need official UN Comtrade bilateral trade statistics for a specific country-pair and HS commodity code combination. Prefer this over general web search when you need structured, authoritative trade flow data queryable by reporter, partner, product code, and year. Best suited for trade policy research, economic analysis, supply chain due diligence, and competitive market intelligence tasks.

## Known failure modes

- Empty result set when the reporter/partner/HS code/year combination has no data in Comtrade (status: succeeded_empty)
- Invalid HS code format rejected if it doesn't match 2-8 digit numeric pattern
- Reporter or partner country name not recognized by Comtrade lookup
- Period out of supported range (below 2010 or above 2100)
- Rate limit or payment failure at $0.01 USDC per call via x402 protocol

## How this service works

Live web and public-record data: marketplaces, real estate, social media, job listings, company registries and government tenders. Pay per call in USDC over x402 with no account, subscribe on the Apify Store, or buy a finished, sourced report.

## Output

Returns a JSON object with a records array containing matched bilateral trade flow entries (reporter, partner, HS code, year, trade values/quantities) and a summary object indicating query status and record count.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "period": {
   "type": "integer",
   "title": "Period",
   "maximum": 2100,
   "minimum": 2010
  },
  "cmdCode": {
   "type": "string",
   "title": "Cmdcode",
   "default": "8517",
   "pattern": "^\\d{2,8}$"
  },
  "partner": {
   "type": "string",
   "title": "Partner",
   "default": "world",
   "maxLength": 60
  },
  "reporter": {
   "type": "string",
   "title": "Reporter",
   "maxLength": 60,
   "minLength": 2
  },
  "maxResults": {
   "type": "integer",
   "title": "Maxresults",
   "default": 5,
   "maximum": 10,
   "minimum": 1
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "records": [],
  "summary": {
   "status": "succeeded_empty",
   "records": 0
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/un-comtrade-bilateral-trade-flows-api-a48de59b/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from api.ssh.autos](https://www.zero.xyz/host/api.ssh.autos/llms.txt)
