本文へスキップ
Won.dev
ドキュメントAPIリファレンス
貿易データAPI

市場統計を取得する

通関記録と公式統計から、市場規模、国別シェア、月ごとの推移を返します。

ある商品または1社について、市場の規模、その分布、動きを示します。合計値、輸出入それぞれの側の国、月ごとの推移です。答えの中では2種類の数字を分けています。records は当社の通関記録の件数を数え、申告された金額を合計したものです。傾向や1社の発注サイクルを見るのに向いていますが、市場全体の数字ではありません。国によってカバー範囲が違い、米国の船荷証券には金額がないためです。official は統計機関が公表する数字で、市場規模や国別シェアにはこちらを使ってください。hs_code を指定し、輸入国か輸出国を指定したときに返り、200以上の国と地域をカバーします。自国の統計がある国はその数字を、ない国は取引相手国がその国との貿易について報告した数字を使い、mirror と示します。米国、EU、英国では当月から約2か月遅れ、ほかの国ではたいていもっと遅れます。coverage.recorded_value_share で、記録された金額が公式の金額のどれだけにあたるかがわかります。結果のある照会は $0.10、official だけを求めたかそれしか見つからなかった場合は $0.02 です。結果がなければ無料です。partial と示された月はまだデータがそろっていない途中の月なので、減少と読み違えないでください。期間は最大36か月です。

  • 課金: trade_stats $0.10:結果のある市場統計の照会1回。trade_official_stats $0.02:公式統計だけ、または金額のない通関件数だけで答えた市場統計の照会1回。
  • モード: merge (各モードの意味)

テストキー(won_test_...)でこのリクエストを送ると、同じサンプル企業が無料で返ります。

POST
/trade/stats/query

認証

apiKey
headerAuthorizationBearer <APIキー>

Authorization: Bearer won_live_..., a key from the console.

ヘッダーパラメータ

Idempotency-Key?string

Any unique string. A retry with the same key and the same body returns the first response and is not charged again.

長さlength <= 255

リクエストボディ

application/json
  1. body
hs_code?string

HS code, digits only. 6 to 10 digits for shipment records. Official statistics alone (basis: ["official"]) also take a 2-digit chapter or a 4-digit heading, such as 9401.

長さlength <= 20
product?string

Product keywords in English, such as office chair. A fuzzy match on the goods description. Use it when you do not know the HS code; an hs_code is more precise.

長さ2 <= length <= 100
company?string

Only the records of this company: its co_ ID, or its name. Shows what one buyer or seller trades over time. Needs role. An ID with no hs_code, product or country, over the last 12 months (the default range), counts the company itself by its ID. Otherwise it is matched by its name as it stands in the records, so companies that share the name count together. records.company_match says which. Official statistics do not exist by company.

長さ2 <= length <= 200
role?string

With company: count what it imports, or what it exports.

取りうる値"importer""exporter"
importer_country?string

Country the goods are imported into: an ISO code such as US, or an English name such as United States. EU is the European Union as a whole, in official statistics only.

長さlength <= 80
exporter_country?string

Country the goods are exported from: an ISO code such as VN, or an English name such as Vietnam. EU is the European Union as a whole, in official statistics only.

長さlength <= 80
since?string

First day of the date range, YYYY-MM-DD. Default: the first day of the month 12 months before until.

長さlength <= 10
until?string

Last day of the date range, YYYY-MM-DD. Default: up to the latest records.

長さlength <= 10
basis?array<>

Which numbers to return. Default: both. official alone is cheaper and answers from official statistics only.

要素1 <= items <= 2
デフォルト
[  "records",  "official"]
top?integer

How many countries each breakdown lists, 1 to 50.

範囲1 <= value <= 50
デフォルト20
max_cost?number

Spending cap for this call in US dollars. If the call could cost more, it fails with budget_exceeded before anything is charged.

範囲0 < value
dry_run?boolean

If true, only return the maximum cost of this call. Nothing runs, nothing is charged.

デフォルトfalse

レスポンスボディ

The result. With dry_run, only the maximum cost.

application/json
  1. response
data*

The statistics, one part for each kind of number.

query*

The request as it was understood: country names as codes, the default dates filled in. data_through says how recent the records behind the answer are.

notice*|

A plain sentence when there is something to know about this result: why a part is missing, or what to try next. Null otherwise.

usage*

What this call was charged, and the balance left.

リクエストの例
curl -X POST 'https://api.won.dev/v1/trade/stats/query' \  -H 'Content-Type: application/json' \  -d '{  "hs_code": "940161",  "importer_country": "US"}'
レスポンスの例
{  "data": {    "records": {      "shipments": 1165783,      "recorded_value_usd": 2620186000,      "by_importer_country": [        {          "country": "US",          "shipments": 1021440        }      ],      "by_exporter_country": [        {          "country": "VN",          "shipments": 932019        },        {          "country": "MY",          "shipments": 104871        },        {          "country": "MX",          "shipments": 58330        }      ],      "by_month": [        {          "month": "2026-07",          "shipments": 118420,          "recorded_value_usd": 251340118.2,          "partial": false        },        {          "month": "2026-08",          "shipments": 121077,          "recorded_value_usd": 259871402.75,          "partial": false        },        {          "month": "2026-09",          "shipments": 126295,          "recorded_value_usd": 270019576.35,          "partial": false        },        {          "month": "2026-10",          "shipments": 98114,          "recorded_value_usd": 204118330.1,          "partial": true        },        {          "month": "2026-11",          "shipments": 5526,          "recorded_value_usd": 3393700.19,          "partial": true        }      ]    },    "official": {      "reporter": "US",      "flow": "import",      "period": {        "since": "2025-11",        "until": "2026-09"      },      "value_usd": 4813000000,      "value_basis": "customs",      "cif_value_usd": 5102000000,      "by_partner_country": [        {          "country": "VN",          "value_usd": 2888000000,          "share": 0.6        },        {          "country": "MX",          "value_usd": 722000000,          "share": 0.15        },        {          "country": "CN",          "value_usd": 481000000,          "share": 0.1        }      ],      "by_month": [        {          "month": "2026-07",          "value_usd": 428000000        },        {          "month": "2026-08",          "value_usd": 417000000        },        {          "month": "2026-09",          "value_usd": 401000000        }      ],      "source": "official_statistics"    },    "coverage": {      "recorded_value_share": 0.6321    }  },  "query": {    "hs_code": "940161",    "importer_country": "US",    "since": "2025-11-01",    "until": "2026-11-20",    "basis": [      "records",      "official"    ],    "top": 20,    "data_through": "2026-11-11"  },  "notice": null,  "usage": {    "unit": "trade_stats",    "records": 1,    "already_paid": 0,    "cost": 0.1,    "balance": 47.98,    "replayed": false  }}

最終更新日