海关数据 API
查找公司
按公司名称或网站查找公司并获取 ID。找到才计费。
GET https://api.won.dev/v1/trade/companies/lookup
按公司名称或网站查找公司,返回公司 ID,所有公司接口都使用这个 ID。找到结果时收取 $0.02,无论返回几个候选;找不到免费。名称按货运单据上的写法匹配,因此同一家公司可能返回多个国家或拼写不同的候选,可以根据 country 和 shipments 挑选。按网站只能查到曾在搜索结果中出现过的公司;查不到时请改用公司名称。
- 计费:
trade_lookup$0.02:按名称或网站查找一次,且至少找到一家公司。 - 数据模式:
waterfall(各模式的含义)
参数
参数放在查询字符串里,多个值用英文逗号分隔。
| 参数 | 类型 | 必填 | 说明(API 原文) |
|---|---|---|---|
q | string | 是 | A company name, such as Acme Furniture, or its website, such as acme.com. |
country | string | 否 | Only companies in this country. An ISO code such as US, or an English name such as United States. |
limit | integer | 否 | How many candidates to return, 1 to 10. Default: 5. |
max_cost | number | 否 | 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 | 否 | If true, only return the maximum cost of this call. Nothing runs, nothing is charged. Default: false. |
响应
传入 dry_run: true 时不执行查询,data 中只返回本次调用的最高费用,见预估费用。错误说明见错误码。
| 字段 | 类型 | 说明(API 原文) |
|---|---|---|
data | object[] | The candidates, best match first. |
data[].id | string | Company ID, such as co_8f3k2m9x4p1q. |
data[].name | string | Name as written on shipping documents. |
data[].country | string | null | ISO 3166-1 alpha-2 country code, such as US. |
data[].website | string | null | Bare domain, such as example.com. Often null. |
data[].shipments | integer | null | All shipment records of the company, when known. |
data[].last_shipment | string | null | Date of its latest record, YYYY-MM-DD. |
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 | 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 | 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. |
示例
curl "https://api.won.dev/v1/trade/companies/lookup?q=northfield%20home%20furnishings&country=US" \
-H "Authorization: Bearer $WON_API_KEY"{
"data": [
{
"id": "co_8f3k2m9x4p1q",
"name": "SAMPLE NORTHFIELD HOME FURNISHINGS INC",
"country": "US",
"website": "northfield-home.example",
"shipments": 1840,
"last_shipment": "2026-11-11"
}
],
"query": {
"q": "northfield home furnishings",
"country": "US",
"limit": 5
},
"notice": null,
"usage": {
"unit": "trade_lookup",
"records": 1,
"already_paid": 0,
"cost": 0.02,
"balance": 48.08,
"replayed": false
}
}用测试 key(won_test_...)发送这个请求,会返回同一批样例公司,不收费。