Skip to Content
Won.dev

Trade data API

Customs records, buyers and suppliers, contacts and market statistics over one REST API, billed by the results it returns.

The trade data API answers what an exporter, a sourcing team or their agent asks: who buys this product, who supplies my competitor, how do I reach them, how big is the market. Every endpoint is JSON over HTTPS.

Authentication

Send your API key in the Authorization header. Authentication covers live and test keys, budgets and how requests are made.

curl "https://api.won.dev/v1/trade/hs-codes?q=office%20chair" \
  -H "Authorization: Bearer $WON_API_KEY"

GET endpoints take their parameters in the query string, with lists comma-separated (include=partners,contacts). POST endpoints take a JSON body. A parameter the endpoint does not know is an error, never silently ignored, and one invalid_input response lists every parameter that needs fixing.

Endpoints

EndpointRequestBilled by
Find HS codesGET /trade/hs-codesFree
Check data coverageGET /trade/coverageFree
Find buyers or suppliersPOST /trade/companies/searchtrade_company $0.01
Search shipment recordsPOST /trade/shipments/searchtrade_record $0.005
Look up a companyGET /trade/companies/lookuptrade_lookup $0.02
Get a companyGET /trade/companies/{id}trade_company_profile $0.04, trade_company $0.01, trade_record $0.005, person_email $0.03, company_channels $0.02
List a company's shipmentsGET /trade/companies/{id}/shipmentstrade_record $0.005
List a company's trading partnersGET /trade/companies/{id}/partnerstrade_company $0.01
Find contacts at a companyGET /trade/companies/{id}/contactsperson_email $0.03
Find leadsPOST /trade/leads/findtrade_company $0.01, person_email $0.03, company_channels $0.02
Get market statisticsPOST /trade/stats/querytrade_stats $0.10, trade_official_stats $0.02

A typical flow

  1. GET /trade/hs-codes?q=office chair finds the HS code of the product. Free.
  2. POST /trade/companies/search ranks its buyers or suppliers.
  3. GET /trade/companies/{id}/contacts finds the people to approach at one of them. POST /trade/leads/find does steps 2 and 3 in one call.
  4. POST /trade/stats/query sizes the market and shows which countries it is in.

Billing by result

You pay for the results a call returns, never for the call itself.

UnitPriceWhat is counted
trade_record$0.005One shipment record.
trade_company$0.01One company in a list of buyers, suppliers or partners, or the company of a lead.
trade_company_profile$0.04One company profile.
trade_lookup$0.02One lookup by name or website that finds at least one company.
person_email$0.03One contact with a work email on the company's own domain that passed verification.
company_channels$0.02The shared mailboxes, phone numbers or messaging contacts found on one company's website, however many.
trade_stats$0.10One market statistics query with results.
trade_official_stats$0.02One market statistics query answered from official statistics only.
  • An empty result is free. So is a failed request.
  • The same request again within 24 hours is free: it returns the stored answer with usage.replayed: true and cost: 0. An answer whose notice says a part could not be loaded is not stored: the repeat loads it again, and what you already paid for is not charged a second time.
  • A result your organization paid for in the last 30 days comes back free, whichever request or endpoint returns it, and usage.already_paid counts it. A lookup and a market statistics query answer one question, so each one is charged. See usage.
  • The same request sent while the first one is still running fails with request_in_progress. Wait retry_after seconds and send it again.
  • dry_run: true returns the most the call can cost, and how many results match when that is already known. Nothing runs and nothing is charged.
  • max_cost caps one call in US dollars. If the call could cost more, it fails with budget_exceeded before anything is charged, and the hint names the limit that fits.
  • The balance has to cover the most a call can cost. That amount is reserved while the call runs, and only what came back is charged.
  • POST requests take an Idempotency-Key header: any unique string. A retry with the same key and the same body returns the first response and is not charged again. The same key with a different body fails with idempotency_conflict. See Idempotency.

Every response ends with usage: what the call cost and the balance left.

{
  "usage": {
    "unit": "trade_company",
    "records": 25,
    "cost": 0.25,
    "balance": 48.75,
    "replayed": false
  }
}

A dry_run response:

{
  "data": {
    "dry_run": true,
    "max_cost": 0.25,
    "breakdown": [
      {
        "unit": "trade_company",
        "max_records": 25,
        "unit_price": 0.01,
        "max_cost": 0.25
      }
    ]
  },
  "total": 4087,
  "query": {
    "role": "importer",
    "hs_code": "940161",
    "importer_country": "US",
    "limit": 25
  },
  "notice": null,
  "usage": {
    "unit": "trade_company",
    "records": 0,
    "cost": 0,
    "balance": 49,
    "replayed": false
  }
}

Modes

Each endpoint has one fixed way of using the data sources behind it. You never choose a source and never see one's name; the mode tells you what to expect of the answer and of the bill.

  • proxy: one source answers. We normalize the fields, give every company, shipment and person a stable ID, and bill by row.
  • merge: several sources each contribute the part they are good at, in one response. A part that cannot be loaded is null and is not charged.
  • waterfall: sources are tried in a fixed order, cheapest first, until the result qualifies. Only a qualifying result is charged, at one fixed price, whichever step found it.
  • composite: an endpoint that chains the three, such as leads.

Pagination

List endpoints take limit and cursor, and return total, has_more and next_cursor. Pass next_cursor as cursor with the same parameters to get the next page. A cursor works only with the query that produced it and expires after 24 hours. A query can be paged through its first 10,000 results; beyond that, narrow it with a shorter date range, a country or a longer hs_code. See Pagination.

In every response

Every answer has the same top-level fields, in the same order: see Responses.

  • query: the request as it was understood, with defaults filled in and countries, codes and dates normalized. Check it when a result surprises you. query.data_through is the date of the newest record the answer could include.
  • notice: null, or one or two sentences about this result: why it is empty, what is left out, what to call next. Agents should read it.
  • IDs are stable and typed by prefix: co_ for a company, shp_ for a shipment, per_ for a person. Pass a company's ID to the company endpoints.
  • Dates are YYYY-MM-DD, countries are ISO 3166 two-letter codes, money is in US dollars. See Reading the numbers for what the counts and values mean.

Test keys

A key that starts with won_test_ gets fixed sample data from every endpoint: made-up companies named SAMPLE ..., people who do not exist, the same response shapes and the same validation. It costs nothing and never reaches a data source, so use it in tests and while you build. The examples in these docs show the same sample companies.

On this page