# Encontrar compradores ou fornecedores

Source: https://won.dev/pt-BR/docs/trade/companies-search

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

Ranqueia as empresas que importam ou exportam um produto: compradores com `role: importer`, fornecedores com `role: exporter`. Custa US$ 0,01 por empresa retornada; um resultado vazio é grátis. `shipments` conta registros aduaneiros e `recorded_value_usd` soma só os registros que declaram um valor, então nenhum dos dois é participação de mercado: para o tamanho do mercado, use `POST /trade/stats/query`. `country` é onde a mercadoria foi declarada, não necessariamente onde a empresa está registrada. As linhas de uma mesma empresa são unificadas, então uma página pode trazer menos que `limit`. Cerca de uma empresa em cada três tem `website`; `POST /trade/leads/find` e o endpoint de contatos buscam o restante. Próximo passo: `GET /trade/companies/{id}` para o perfil de uma empresa, ou `POST /trade/leads/find` para receber esta lista com contatos numa única chamada.

- **Cobrança:** `trade_company` US$ 0,01: Uma empresa numa lista de compradores, fornecedores ou parceiros, ou a empresa de um lead.
- **Modo:** `proxy` ([o que cada modo significa](/pt-BR/docs/trade#modes))

Uma chave de teste (`won_test_...`) responde a esta requisição com as mesmas empresas de exemplo, sem custo.

## Parâmetros [#parameters]

Os parâmetros vão no corpo JSON. Requisições `POST` também aceitam o cabeçalho `Idempotency-Key`; veja [Idempotência](/pt-BR/docs/idempotency).

| Parâmetro | Tipo | Obrigatório | Descrição (texto original da API) |
| --- | --- | --- | --- |
| `role` | `importer` \| `exporter` | sim | `importer` returns the companies that buy the product: buyers. `exporter` returns the companies that sell it: suppliers. |
| `hs_code` | string | não | 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 | não | 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_country` | string | não | Country the goods are imported into: an ISO code such as `US`, or an English name such as `United States`. |
| `exporter_country` | string | não | Country the goods are exported from: an ISO code such as `VN`, or an English name such as `Vietnam`. |
| `trading_with` | string | não | Only companies that trade with this one: its `co_` ID, or its name. With `role: importer` these are the buyers of that exporter, with `role: exporter` the suppliers of that importer. Either way it is matched by its name as it stands in the records, so companies that share the name count together. |
| `exclude_forwarders` | boolean | não | Leave out freight forwarders and logistics companies, which stand on bills of lading in place of the real buyer or seller. Default: `true`. |
| `sort` | `shipments` \| `recorded_value` | não | `shipments` ranks by number of records. `recorded_value` ranks by declared value; only records that carry a value count, so it favors routes whose exporting country publishes values. Default: `shipments`. |
| `since` | string | não | First day of the date range, `YYYY-MM-DD`. Default: the first day of the month 12 months before `until`. |
| `until` | string | não | Last day of the date range, `YYYY-MM-DD`. Default: up to the latest records. |
| `limit` | integer | não | How many results to return, 1 to 100. You pay for the results returned. Default: `10`. |
| `cursor` | string | não | To get the next page, pass `next_cursor` of the previous response back unchanged, with the same parameters. |
| `max_cost` | number | não | 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 | não | If true, only return the maximum cost of this call. Nothing runs, nothing is charged. Default: `false`. |

## Resposta [#response]

Com `dry_run: true` nada é executado e `data` traz só o máximo que a chamada pode custar; veja [Simulações](/pt-BR/docs/responses#dry-run). Os erros estão descritos em [Erros](/pt-BR/docs/errors).

| Campo | Tipo | Descrição (texto original da API) |
| --- | --- | --- |
| `data` | object[] | The results of this page. |
| `data[].id` | string | Company ID, such as `co_8f3k2m9x4p1q`. |
| `data[].name` | string | Name as written on shipping documents. |
| `data[].role` | `importer` \| `exporter` | The side it is on in these records. |
| `data[].country` | string \| null | Country the company imports into or exports from in these records. |
| `data[].shipments` | integer | Number of shipment records. A count of records, not a market share: countries that publish every declaration are over-represented. |
| `data[].recorded_value_usd` | number \| null | Sum of the declared values of the records that have one, in US dollars. A lower bound: US bills of lading carry no value. |
| `data[].website` | string \| null | Bare domain, such as `example.com`. Often null. |
| `data[].sample_product` | string \| null | A goods description from one of its records. |
| `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. |

## Exemplo [#example]

```bash
curl https://api.won.dev/v1/trade/companies/search \
  -H "Authorization: Bearer $WON_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
  "role": "importer",
  "hs_code": "940161",
  "importer_country": "US",
  "limit": 2
}'
```

```json
{
  "data": [
    {
      "id": "co_8f3k2m9x4p1q",
      "name": "SAMPLE NORTHFIELD HOME FURNISHINGS INC",
      "role": "importer",
      "country": "US",
      "shipments": 1840,
      "recorded_value_usd": 21480350.4,
      "website": "northfield-home.example",
      "sample_product": "UPHOLSTERED SOFA WITH WOODEN FRAME, FABRIC COVER"
    },
    {
      "id": "co_3d9t6w1b7n5z",
      "name": "SAMPLE HARBORSIDE SEATING CO",
      "role": "importer",
      "country": "US",
      "shipments": 962,
      "recorded_value_usd": 9310772.15,
      "website": "harborside-seating.example",
      "sample_product": "RECLINER SOFA SET, LEATHER, 3 SEATER"
    }
  ],
  "total": 4087,
  "has_more": true,
  "next_cursor": "cur_Zx81kQp4b2JtMW0uMXJ6ZzQ",
  "query": {
    "role": "importer",
    "hs_code": "940161",
    "importer_country": "US",
    "exclude_forwarders": true,
    "sort": "shipments",
    "since": "2025-11-01",
    "until": "2026-11-20",
    "data_through": "2026-11-11"
  },
  "notice": null,
  "usage": {
    "unit": "trade_company",
    "records": 2,
    "already_paid": 0,
    "cost": 0.02,
    "balance": 48.08,
    "replayed": false
  }
}
```