跳到正文
Won.dev
海关数据 API

搜索货运记录

按商品或公司搜索报关单和提单。按返回的记录数计费。

POST https://api.won.dev/v1/trade/shipments/search

返回报关单和提单,一票货一条记录:谁在什么时候把什么货、以多少数量发给了谁,途经哪些港口。每返回一条记录收取 $0.005,空结果免费。可以按商品(hs_code 或 product)或公司(importer 或 exporter)筛选,也可以两者组合。记录没有申报金额时,value_usd 为 null,美国提单就属于这种情况。同一票货可能出现两次,一次在进口国的记录中,一次在出口国的记录中,reported_by 标明记录来自哪一方。库中重复的记录只返回一次;按公司 ID 筛选时,会剔除同名其他公司的记录,所以一页的结果可能少于 limit。可以根据 total 判断是继续翻页还是缩小查询;如需计数或求和,请用 POST /trade/stats/query,不要靠翻页统计。

  • 计费: trade_record $0.005:一条货运记录。
  • 数据模式: proxy (各模式的含义)

参数

参数放在 JSON 请求体里。POST 请求还支持 Idempotency-Key 请求头,见幂等。

参数类型必填说明(API 原文)
hs_codestring否HS code, digits only, 6 to 10 digits. Six digits are the same in every country; a longer code is one country's own tariff line, matched by prefix. Find the code of a product with GET /trade/hs-codes.
productstring否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.
importerstring否Only shipments this company received: its co_ ID, which matches exactly, or its name.
exporterstring否Only shipments this company sent: its co_ ID, which matches exactly, or its name.
importer_countrystring否Country the goods are imported into: an ISO code such as US, or an English name such as United States.
exporter_countrystring否Country the goods are exported from: an ISO code such as VN, or an English name such as Vietnam.
sincestring否First day of the date range, YYYY-MM-DD. Default: the first day of the month 12 months before until.
untilstring否Last day of the date range, YYYY-MM-DD. Default: up to the latest records.
sortdate_desc | date_asc否date_desc returns the latest records first, date_asc the earliest. Default: date_desc.
fieldsstring[]否The fields each shipment has, besides id. Default: date, importer, exporter, hs_code, description, quantity, quantity_unit, weight_kg, value_usd, origin_country, loading_port, unloading_port, transport, reported_by. Also available: unit_price_usd, incoterm, brand, bill_of_lading, description_full. default stands for the default set, so default,unit_price_usd adds one field and date,importer returns only those two.
limitinteger否How many results to return, 1 to 100. You pay for the results returned. Default: 10.
cursorstring否To get the next page, pass next_cursor of the previous response back unchanged, with the same parameters.
max_costnumber否Spending cap for this call in US dollars. If the call could cost more, it fails with budget_exceeded before anything is charged.
dry_runboolean否If true, only return the maximum cost of this call. Nothing runs, nothing is charged. Default: false.

响应

传入 dry_run: true 时不执行查询,data 中只返回本次调用的最高费用,见预估费用。错误说明见错误码。

字段类型说明(API 原文)
dataobject[]The results of this page.
data[].idstringShipment ID, such as shp_5k2m8x1q9d3f.
data[].datestring | nullDate of the record, YYYY-MM-DD.
data[].importerobjectThe buyer on the record.
data[].importer.idstring | nullCompany ID. Pass it to the company endpoints. Null when the party is not named.
data[].importer.namestring | nullName as written on the record.
data[].importer.countrystring | nullISO 3166-1 alpha-2 country code, such as US.
data[].exporterobjectThe seller on the record.
data[].exporter.idstring | nullCompany ID. Pass it to the company endpoints. Null when the party is not named.
data[].exporter.namestring | nullName as written on the record.
data[].exporter.countrystring | nullISO 3166-1 alpha-2 country code, such as US.
data[].hs_codestring | nullHS code as declared, digits only.
data[].descriptionstring | nullGoods description, at most 200 characters.
data[].description_truncatedbooleanPresent and true when description was cut. Ask for description_full.
data[].quantitynumber | nullQuantity as declared, in quantity_unit.
data[].quantity_unitstring | nullUnit of quantity as declared.
data[].weight_kgnumber | nullWeight in kilograms.
data[].value_usdnumber | nullDeclared value. Null when the record has none, as on US bills of lading.
data[].origin_countrystring | nullCountry of origin of the goods.
data[].loading_portstring | nullPort where the goods were loaded.
data[].unloading_portstring | nullPort where the goods were unloaded.
data[].transportsea | air | road | rail | other | nullMode of transport.
data[].reported_byobject | nullWhose customs declaration this record is. A US import can be recorded by a US bill of lading (US, import) and again by the exporter's declaration (VN, export).
data[].reported_by.countrystringISO 3166-1 alpha-2 country code, such as US.
data[].reported_by.flowimport | exportWhether that country recorded it as an import or as an export.
data[].unit_price_usdnumber | nullDeclared value for one unit of quantity, in US dollars.
data[].incotermstring | nullTrade term, such as FOB or CIF.
data[].brandstring | nullBrand named on the record.
data[].bill_of_ladingstring | nullBill of lading or declaration number, as on the customs record.
data[].description_fullstring | nullThe whole goods description, however long.
totalintegerHow many results match in all. Use it to decide between paging on and narrowing the query.
has_morebooleanWhether more results follow this page.
next_cursorstring | nullPass it as cursor to get the next page. Null on the last page.
queryobjectThe 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.
query.data_throughstring | nullDate of the latest record this query can see, YYYY-MM-DD. Records arrive weeks after a shipment, so recent months are incomplete.
noticestring | nullA plain sentence when there is something to know about this result: why a part is missing, or what to try next. Null otherwise.
usageobjectWhat this call was charged, and the balance left.
usage.unittrade_record | trade_company | trade_company_profile | trade_lookup | person_email | company_channels | trade_stats | trade_official_statsWhat is counted.
usage.recordsintegerHow many were returned and charged.
usage.already_paidintegerHow many more were returned for free, because this organization paid for them in the last 30 days.
usage.costnumberWhat this call cost, in US dollars.
usage.balancenumberThe balance left after this call, in US dollars.
usage.replayedbooleanTrue when this is a repeat of a request from the last 24 hours. Repeats are free.

示例

curl https://api.won.dev/v1/trade/shipments/search \
  -H "Authorization: Bearer $WON_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "hs_code": "940161",
  "importer_country": "US",
  "limit": 1
}'
{
  "data": [
    {
      "id": "shp_5k2m8x1q9d3f",
      "date": "2026-11-11",
      "importer": {
        "id": "co_8f3k2m9x4p1q",
        "name": "SAMPLE NORTHFIELD HOME FURNISHINGS INC",
        "country": "US"
      },
      "exporter": {
        "id": "co_2c7h5n0w6r8t",
        "name": "SAMPLE DONG NAI COMFORT FURNITURE CO LTD",
        "country": "VN"
      },
      "hs_code": "940161",
      "description": "UPHOLSTERED SOFA WITH WOODEN FRAME, FABRIC COVER",
      "quantity": 291,
      "quantity_unit": "CTN",
      "weight_kg": 8115.4,
      "value_usd": null,
      "origin_country": "VN",
      "loading_port": "Cat Lai",
      "unloading_port": "Savannah, Georgia",
      "transport": "sea",
      "reported_by": {
        "country": "US",
        "flow": "import"
      }
    }
  ],
  "total": 1165783,
  "has_more": true,
  "next_cursor": "cur_Qm93c2VyLTEuMXJ6ZzQ",
  "query": {
    "hs_code": "940161",
    "importer_country": "US",
    "since": "2025-11-01",
    "until": "2026-11-20",
    "sort": "date_desc",
    "data_through": "2026-11-11"
  },
  "notice": null,
  "usage": {
    "unit": "trade_record",
    "records": 1,
    "already_paid": 0,
    "cost": 0.005,
    "balance": 48.08,
    "replayed": false
  }
}

用测试 key(won_test_...)发送这个请求,会返回同一批样例公司,不收费。

本页内容