Skip to Content
Won.dev

Authentication

Every request carries an API key as a bearer token. Live and test keys, budgets, and how requests are made.

Every request to the API and to the MCP server carries an API key in the Authorization header.

curl https://api.won.dev/v1/account \
  -H "Authorization: Bearer $WON_API_KEY"

API keys

Create keys in the console, on the API keys page. A key is shown once, right after you create it: keep it in an environment variable or a secret manager, never in code that runs in a browser. Members of an organization can see its keys; owners and admins can create, edit and revoke them. An organization can have 20 keys at a time: revoke one you no longer use to make room.

PrefixWhat it does
won_live_Returns real data and spends the organization's balance.
won_test_Returns fixed sample data from every trade data and enrichment endpoint and runs cold email in a sandbox that sends nothing. It is never charged.

A test key has the same parameters, validation, response shapes and rate limit as a live key, so code written against one works with the other.

Budgets

Give each program or agent a key of its own, with a budget: the most that key may ever spend, whatever the code or the agent asks for. A call that could go past it fails with budget_exceeded before anything is charged. GET /account shows what is left in data.key.remaining.

max_cost caps a single call in the same way. See Billing by result.

When a key is refused

StatusCodeWhy
401unauthorizedThe header is missing, or the key is unknown or revoked.
402budget_exceededThe call could cost more than max_cost or what is left of the key's budget.
402insufficient_balanceThe balance cannot cover the most the call can cost.
429rate_limitedThe key sent too many requests in a row. See Rate limits.

The MCP server also answers a 401 with WWW-Authenticate: Bearer realm="won.dev". A refused request does nothing and costs nothing.

Making requests

  • The base URL is https://api.won.dev/v1. Every endpoint answers with JSON.
  • GET and DELETE take their parameters in the path and the query string, with lists comma-separated: include=partners,contacts.
  • POST and PATCH take a JSON body, sent with Content-Type: application/json.
  • A parameter the endpoint does not know is an error, never silently ignored. One invalid_input answer lists every parameter that needs fixing, see Errors.
  • POST, PATCH and DELETE take an Idempotency-Key header, so that a retry does not do the same thing twice. See Idempotency.
  • The OpenAPI 3.1 document is at https://api.won.dev/v1/openapi.json.
  • Every page of these docs is also Markdown: add .md to its URL, or send Accept: text/markdown.

On this page