# Versioning and deprecation

The merchant API is versioned in the path: every operation is under `/v1`. Within a version, changes are **additive**: a new operation, a new optional request field, a new response field, a new enum value, a new event. Your integration must tolerate fields and values it does not know.

## What never changes within /v1

- The shape of an existing field, its type, or whether it is required.
- The meaning of an existing error key or status.
- The envelope and headers of webhook deliveries; a payload change is a new `version` on the event.

## Deprecation

When an operation or field is retired, it keeps answering for **90 days** with two headers:

```http
Deprecation: @1762041600
Sunset: Sun, 31 Jan 2027 00:00:00 GMT
Link: <http://docs.staging.regoria.com/guides/changelog>; rel="deprecation"
```

`Deprecation` says when the deprecation began (RFC 9745, Unix seconds), `Sunset` when the operation stops answering (RFC 8594). Log these headers in your client and alert on them. Nothing is deprecated today.

## The changelog and the spec fingerprint

Every change is written up in the [changelog](http://docs.staging.regoria.com/guides/changelog) with the date and the operations affected. The published OpenAPI document carries `info.x-kit-fingerprint`, a hash of the whole contract; `GET /v1/openapi.json` (any valid key) returns the same document, so your build can detect that the API changed since your SDK or types were generated:

```bash
curl https://api.sandbox.staging.regoria.com/v1/openapi.json -H "Authorization: Bearer $API_KEY" | jq -r '.info["x-kit-fingerprint"]'
```

The SDKs are versioned with the spec they were generated from and send it as `X-SDK: typescript/1.2.0`.

## When /v2 comes

A breaking change ships as a new path version, documented side by side, with `/v1` answering for at least the deprecation period after `/v2` is announced.
