# Buscar códigos HS

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

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

Encuentra el código HS de un producto a partir de una descripción en inglés (`office chair`), o lista los códigos bajo un prefijo (`9401`). Es gratis. Llámalo primero cuando solo conoces el nombre del producto: todos los demás endpoints de comercio exterior son más precisos con un `hs_code` que con palabras clave en `product`. Los códigos de seis dígitos son iguales en todos los países; pasa uno como `hs_code` a los endpoints de búsqueda.

- **Cobro:** Gratis.
- **Modo:** `proxy` ([qué significa cada modo](/es/docs/trade#modes))

## Parámetros [#parameters]

Los parámetros van en la cadena de consulta, con las listas separadas por comas.

| Parámetro | Tipo | Obligatorio | Descripción (texto original de la API) |
| --- | --- | --- | --- |
| `q` | string | sí | A product in plain English, such as `office chair` or `led lamp`, or the first digits of a code, such as `9401`. |
| `limit` | integer | no | How many codes to return, 1 to 50. Default: `10`. |
| `fields` | string[] | no | Pass `us_duty` to add the general US duty rate of every tariff line under each code. |

## Respuesta [#response]

Los errores se describen en [Errores](/es/docs/errors).

| Campo | Tipo | Descripción (texto original de la 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. |

## Ejemplo [#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
  }
}
```