海关数据 API
查 HS 编码
根据商品描述查询 HS 编码,或列出某个前缀下的所有编码。免费。
GET https://api.won.dev/v1/trade/hs-codes
根据英文商品描述(如 office chair)查询 HS 编码,或者列出某个前缀(如 9401)下的所有编码。免费。如果只知道商品名称,请先调用这个接口:其他贸易接口用 hs_code 查询,比用 product 关键词更准确。六位编码全球通用,可以直接作为 hs_code 传给搜索接口。
- 计费: 免费。
- 数据模式:
proxy(各模式的含义)
参数
参数放在查询字符串里,多个值用英文逗号分隔。
| 参数 | 类型 | 必填 | 说明(API 原文) |
|---|---|---|---|
q | string | 是 | A product in plain English, such as office chair or led lamp, or the first digits of a code, such as 9401. |
limit | integer | 否 | How many codes to return, 1 to 50. Default: 10. |
fields | string[] | 否 | Pass us_duty to add the general US duty rate of every tariff line under each code. |
响应
错误说明见错误码。
| 字段 | 类型 | 说明(API 原文) |
|---|---|---|
data | object[] | The best matches first. |
data[].code | string | HS code, digits only: 2, 4 or 6 digits. |
data[].description | string | Official description of the code. |
data[].parent | string | null | The code one level up. Null for a chapter. |
data[].us_duty | object[] | US general duty rates of the tariff lines under this code. |
data[].us_duty[].code | string | Eight-digit US tariff line. |
data[].us_duty[].description | string | Text of the tariff line. |
data[].us_duty[].general | string | General (most-favored-nation) rate of duty, as published. |
query | object | The request as it was understood: country names as codes, the default dates filled in. |
notice | string | null | 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 | object | Nothing is charged here. The balance, for reference. |
usage.cost | number | What this call cost, in US dollars. |
usage.balance | number | The balance left after this call, in US dollars. |
usage.replayed | boolean | True when this is a repeat of a request from the last 24 hours. Repeats are free. |
示例
curl "https://api.won.dev/v1/trade/hs-codes?q=sofa&limit=2" \
-H "Authorization: Bearer $WON_API_KEY"{
"data": [
{
"code": "940161",
"description": "Seats (other than those of heading 9402), whether or not convertible into beds, and parts thereof > Other seats, with wooden frames > Upholstered",
"parent": "9401"
},
{
"code": "940171",
"description": "Seats (other than those of heading 9402), whether or not convertible into beds, and parts thereof > Other seats, with metal frames > Upholstered",
"parent": "9401"
}
],
"query": {
"q": "sofa",
"limit": 2
},
"notice": null,
"usage": {
"cost": 0,
"balance": 48.08,
"replayed": false
}
}