# Versioning

Source: https://won.dev/docs/versioning

The version of the API is in its path: `https://api.won.dev/v1`. Code written against `/v1` keeps working as `/v1` grows, and a change that could break it only ever comes as a new version.

## What may be added [#additive]

These come to `/v1` at any time, without notice, so a client should accept them:

- New endpoints, and new tools on the [MCP server](/docs/mcp).
- New optional parameters.
- New fields in a response, anywhere in it.
- New values where a field lists kinds, such as a new `error.code`, event type or billing unit. Treat one you do not know like the closest one you do: an unknown error code by its HTTP status.
- Other wording of `message`, `hint` and `notice`, which are written to be read, not parsed. Branch on `error.code`.

## What never changes within a version [#stable]

- An endpoint, a parameter or a field is never removed or renamed, and never changes its type or meaning.
- An optional parameter never becomes required.
- An ID keeps its prefix and keeps working.

Anything that would break these comes only as a new version, such as `/v2`. The old version goes on next to it, and each of its endpoints is retired as below.

## When an endpoint is going away [#deprecation]

An endpoint is deprecated at least **6 months** before it stops working. From that day on:

- Every answer of it carries the `Deprecation` header ([RFC 9745](https://www.rfc-editor.org/rfc/rfc9745)), the time since which it is deprecated, the `Sunset` header ([RFC 8594](https://www.rfc-editor.org/rfc/rfc8594)), the date it stops working, and a `Link` to its page in these docs.
- The [OpenAPI document](https://api.won.dev/v1/openapi.json) marks it `deprecated: true`, and its description names what to use instead and the date.

```text
HTTP/2 200
Deprecation: @1798761600
Sunset: Thu, 01 Jul 2027 00:00:00 GMT
Link: <https://won.dev/docs/trade/companies-search>; rel="deprecation"
```

To hear of it in time, log a warning whenever an answer carries `Deprecation`. No endpoint is deprecated today.