# Buscar registros de embarque

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

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

Devuelve declaraciones aduaneras y conocimientos de embarque, un registro por embarque: quién envió qué a quién, cuándo, cuánto y por qué puertos. Cuesta USD 0.005 por cada registro devuelto; un resultado vacío es gratis. Filtra por producto (`hs_code` o `product`), por una empresa (`importer` o `exporter`), o por ambos. `value_usd` es null cuando el registro no declara ninguno, como en los conocimientos de embarque de EE. UU. Un mismo embarque puede aparecer dos veces, una en los registros del país importador y otra en los del exportador: `reported_by` dice de quién es el registro. Un registro que está guardado dos veces se devuelve una sola vez, y con un ID de empresa se dejan fuera los registros de otras empresas con el mismo nombre, así que una página puede traer menos de `limit`. Usa `total` para decidir si sigues paginando o acotas la consulta; para contar o sumar, usa `POST /trade/stats/query` en lugar de paginar.

- **Cobro:** `trade_record` USD 0.005: Un registro de embarque.
- **Modo:** `proxy` ([qué significa cada modo](/es/docs/trade#modes))

Una clave de prueba (`won_test_...`) responde esta solicitud con las mismas empresas de muestra, sin costo.

## Parámetros [#parameters]

Los parámetros van en el cuerpo JSON. Las solicitudes `POST` también aceptan el encabezado `Idempotency-Key`; consulta [Idempotencia](/es/docs/idempotency).

| Parámetro | Tipo | Obligatorio | Descripción (texto original de la API) |
| --- | --- | --- | --- |
| `hs_code` | string | no | 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`. |
| `product` | string | no | 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. |
| `importer` | string | no | Only shipments this company received: its `co_` ID, which matches exactly, or its name. |
| `exporter` | string | no | Only shipments this company sent: its `co_` ID, which matches exactly, or its name. |
| `importer_country` | string | no | Country the goods are imported into: an ISO code such as `US`, or an English name such as `United States`. |
| `exporter_country` | string | no | Country the goods are exported from: an ISO code such as `VN`, or an English name such as `Vietnam`. |
| `since` | string | no | First day of the date range, `YYYY-MM-DD`. Default: the first day of the month 12 months before `until`. |
| `until` | string | no | Last day of the date range, `YYYY-MM-DD`. Default: up to the latest records. |
| `sort` | `date_desc` \| `date_asc` | no | `date_desc` returns the latest records first, `date_asc` the earliest. Default: `date_desc`. |
| `fields` | string[] | no | 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. |
| `limit` | integer | no | How many results to return, 1 to 100. You pay for the results returned. Default: `10`. |
| `cursor` | string | no | To get the next page, pass `next_cursor` of the previous response back unchanged, with the same parameters. |
| `max_cost` | number | no | Spending cap for this call in US dollars. If the call could cost more, it fails with `budget_exceeded` before anything is charged. |
| `dry_run` | boolean | no | If true, only return the maximum cost of this call. Nothing runs, nothing is charged. Default: `false`. |

## Respuesta [#response]

Con `dry_run: true` no se ejecuta nada y `data` trae solo lo máximo que puede costar la llamada; consulta [Simulaciones](/es/docs/responses#dry-run). Los errores se describen en [Errores](/es/docs/errors).

| Campo | Tipo | Descripción (texto original de la API) |
| --- | --- | --- |
| `data` | object[] | The results of this page. |
| `data[].id` | string | Shipment ID, such as `shp_5k2m8x1q9d3f`. |
| `data[].date` | string \| null | Date of the record, `YYYY-MM-DD`. |
| `data[].importer` | object | The buyer on the record. |
| `data[].importer.id` | string \| null | Company ID. Pass it to the company endpoints. Null when the party is not named. |
| `data[].importer.name` | string \| null | Name as written on the record. |
| `data[].importer.country` | string \| null | ISO 3166-1 alpha-2 country code, such as `US`. |
| `data[].exporter` | object | The seller on the record. |
| `data[].exporter.id` | string \| null | Company ID. Pass it to the company endpoints. Null when the party is not named. |
| `data[].exporter.name` | string \| null | Name as written on the record. |
| `data[].exporter.country` | string \| null | ISO 3166-1 alpha-2 country code, such as `US`. |
| `data[].hs_code` | string \| null | HS code as declared, digits only. |
| `data[].description` | string \| null | Goods description, at most 200 characters. |
| `data[].description_truncated` | boolean | Present and true when `description` was cut. Ask for `description_full`. |
| `data[].quantity` | number \| null | Quantity as declared, in `quantity_unit`. |
| `data[].quantity_unit` | string \| null | Unit of `quantity` as declared. |
| `data[].weight_kg` | number \| null | Weight in kilograms. |
| `data[].value_usd` | number \| null | Declared value. Null when the record has none, as on US bills of lading. |
| `data[].origin_country` | string \| null | Country of origin of the goods. |
| `data[].loading_port` | string \| null | Port where the goods were loaded. |
| `data[].unloading_port` | string \| null | Port where the goods were unloaded. |
| `data[].transport` | `sea` \| `air` \| `road` \| `rail` \| `other` \| null | Mode of transport. |
| `data[].reported_by` | object \| null | Whose 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.country` | string | ISO 3166-1 alpha-2 country code, such as `US`. |
| `data[].reported_by.flow` | `import` \| `export` | Whether that country recorded it as an import or as an export. |
| `data[].unit_price_usd` | number \| null | Declared value for one unit of `quantity`, in US dollars. |
| `data[].incoterm` | string \| null | Trade term, such as `FOB` or `CIF`. |
| `data[].brand` | string \| null | Brand named on the record. |
| `data[].bill_of_lading` | string \| null | Bill of lading or declaration number, as on the customs record. |
| `data[].description_full` | string \| null | The whole goods description, however long. |
| `total` | integer | How many results match in all. Use it to decide between paging on and narrowing the query. |
| `has_more` | boolean | Whether more results follow this page. |
| `next_cursor` | string \| null | Pass it as `cursor` to get the next page. Null on the last page. |
| `query` | object | 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. |
| `query.data_through` | string \| null | Date of the latest record this query can see, `YYYY-MM-DD`. Records arrive weeks after a shipment, so recent months are incomplete. |
| `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 | What this call was charged, and the balance left. |
| `usage.unit` | `trade_record` \| `trade_company` \| `trade_company_profile` \| `trade_lookup` \| `person_email` \| `company_channels` \| `trade_stats` \| `trade_official_stats` \| `market_search` \| `market_listings` \| `market_estimates` | What is counted. |
| `usage.records` | integer | How many were returned and charged. |
| `usage.already_paid` | integer | How many more were returned for free, because this organization paid for them in the last 30 days. |
| `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/shipments/search \
  -H "Authorization: Bearer $WON_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "hs_code": "940161",
  "importer_country": "US",
  "limit": 1
}'
```

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