# UN Comtrade Preview Trade Data API

> UN Comtrade Preview Trade Data API is a paid API for AI agents from x402-v2-mint-un-comtrade-preview.vercel.app, paid per call via x402, $0.02015/call, status unknown (last checked 2026-11-18).

Fetches UN Comtrade international trade statistics (imports/exports) by reporter, partner, commodity, and period via a pay-per-call x402 endpoint.

## Facts

- Endpoint: POST https://x402-v2-mint-un-comtrade-preview.vercel.app/v1/un-comtrade-preview?utm_source=zero.xyz
- Price: $0.02015/call
- Payment: x402
- Status: unknown
- Last checked: 2026-11-18
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/un-comtrade-preview-trade-data-api-df804a4f
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_e1MEhSzj6yoaQLy60_WxU

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-preview-trade-data-api-df804a4f -d '<json body>'
```

Example prompt: Pull UN Comtrade trade data for reporter country 842 (USA) importing commodity 0901 (coffee) from partner 076 (Brazil) for period 2023, using monthly frequency.

## When to prefer this

Choose this endpoint when you need keyless (no UN Comtrade API key required), pay-per-call access to UN Comtrade international trade statistics. Ideal for agents that need occasional trade flow lookups without managing API credentials. Best when querying specific reporter-partner-commodity-period combinations rather than bulk downloads.

## Known failure modes

- 402 Unpaid: request made without valid x402 payment — no data returned
- 400 with charged:false: payment settled but query parameters were empty or invalid
- Invalid reporterCode or partnerCode returns no matching records
- Unsupported cmdCode or flowCode values result in empty result sets
- Period format mismatch (e.g. wrong year/month format) may yield empty data

## How this service works

UN Comtrade public preview trade data (keyless). POST {reporterCode,period,partnerCode,cmdCode,flowCode} (+ optional typeCode/freqCode/clCode/maxRecords). Unpaid empty → 402; after settle empty/invalid → 400 charged:false. New trade vertical; no catalog adjacency.

## Output

Returns a JSON object with ok (boolean), skill name, charged (boolean indicating whether the payment settled and data was returned), and a summary field. On success, trade flow records matching the query parameters are included. A 402 is returned if payment hasn't been made; a 400 with charged:false is returned if parameters are invalid post-payment.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "clCode": {
   "type": "string",
   "maxLength": 8
  },
  "period": {
   "type": [
    "string",
    "integer"
   ]
  },
  "cmdCode": {
   "type": "string",
   "maxLength": 32
  },
  "flowCode": {
   "type": "string",
   "maxLength": 8
  },
  "freqCode": {
   "type": "string",
   "maxLength": 8
  },
  "typeCode": {
   "type": "string",
   "maxLength": 8
  },
  "maxRecords": {
   "type": [
    "integer",
    "string"
   ]
  },
  "request_id": {
   "type": "string"
  },
  "partnerCode": {
   "type": [
    "string",
    "integer"
   ]
  },
  "reporterCode": {
   "type": [
    "string",
    "integer"
   ]
  }
 }
}
```

## Response schema (JSON Schema)

```json
{
 "type": "json",
 "example": {
  "ok": true,
  "skill": "un-comtrade-preview",
  "charged": true,
  "summary": "ok"
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/un-comtrade-preview-trade-data-api-df804a4f/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from x402-v2-mint-un-comtrade-preview.vercel.app](https://www.zero.xyz/host/x402-v2-mint-un-comtrade-preview.vercel.app/llms.txt)
