# HSコードを調べる

Source: https://won.dev/ja/docs/trade/hs-codes-search

`GET https://api.won.dev/v1/trade/hs-codes`

英語の商品説明（`office chair`）から商品のHSコードを探すか、プレフィックス（`9401`）の下にあるコードを一覧にします。無料です。商品名しかわからないときは、まずこれを呼んでください。ほかの貿易エンドポイントは、`product` のキーワードより `hs_code` を使ったほうが正確に答えます。6桁のコードは世界共通なので、そのまま `hs_code` として検索エンドポイントに渡せます。

- **課金：** 無料。
- **モード：** `proxy` ([各モードの意味](/ja/docs/trade#modes))

## パラメーター [#parameters]

パラメーターはクエリ文字列で渡し、リストはカンマ区切りにします。

| パラメーター | 型 | 必須 | 説明（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. |

## レスポンス [#response]

エラーについては[エラーコード](/ja/docs/errors)を参照してください。

| フィールド | 型 | 説明（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. |

## 例 [#example]

```bash
curl "https://api.won.dev/v1/trade/hs-codes?q=sofa&limit=2" \
  -H "Authorization: Bearer $WON_API_KEY"
```

```json
{
  "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
  }
}
```