# Changelog and version policy

What changed in the SDK, and how the API is versioned.

## API version

The API has one version at a time, named by date. The current version is `2026-07-01`. Every response carries it as `api_version`.

The version changes only when the contract changes in a way that could break existing code.

> **Not released yet.** Planned for Owner approval of the release; confirm before relying on it.
>
>
> This policy is proposed and needs approval before launch.
>
> **Not a breaking change.** We may do these at any time, without a new version: add an endpoint, add an optional request field, add a field to a response or to a webhook body, add a webhook event type, add a value to a documented list of error codes. Write your code to ignore fields and event types it does not know.
>
> **A breaking change.** Removing or renaming a field, endpoint or event type, changing a field's type, making an optional field required, or changing what an existing request does. A breaking change gets a new dated version and is announced here before it takes effect.
>

## SDK 0.4.0, not yet released

No breaking changes. Code written for 0.3.0 compiles and runs unchanged, and 0.3.0 keeps verifying every delivery the server sends.

- The verified event returns the new body fields when the server sends them: `created` (when the event happened, the same on every retry and replay), `api_version`, `mode` (`'test'` or `'live'`) and `test: true` on a test event. All four are optional on `MintEvent`.
- Secret rotation overlap: for 24 hours after a rotation, `x-mint-signature` carries two `v1` values, the new secret's first. Verification accepts either. 0.3.0 already accepted several `v1` values; this release tests it against the server's signer.
- Typed webhook event `api_key.expiring`, with `ApiKeyExpiringEvent` and `ApiKeyExpiringData`. It is in `MINT_EVENT_TYPES`.

## SDK 0.3.0, 16 November 2026

No breaking changes. Code written for 0.2.0 compiles and runs unchanged.

- Price changes: `catalog.previewPriceChange`, `schedulePriceChange`, `listPriceChanges`, `getPriceChange` and `cancelPriceChange`. A change must be at least 30 days away; each subscriber moves at their first renewal on or after it.
- Typed webhook events: `subscription.renewal_upcoming`, `subscription.price_change_scheduled`, `subscription.price_change_applied`, `subscription.price_change_canceled` and `subscription.updated`. Every `subscription.*` event's `data.subscription` is a `SubscriptionSnapshot`.
- `MINT_EVENT_TYPES`: the list of every event the server delivers, at runtime.
- `MintApiError.details`: the server's `error.details` when present.
- `checkout.create({ lockItems: true })` fixes the plan, seats and interval on the checkout page.
- `catalog.updateProduct` and `catalog.getProduct`, including the two portal settings.

## SDK 0.2.0, 25 October 2026

**Breaking.** `checkout.create` items are now `{ planId | planCode, quantity?, meter? }`. Version 0.1 sent `items[].plan`, which the server refused. `interval` is removed, and `metadata` values must be strings.

- Catalogue: `catalog.upsertPlan`, `updatePlan` and `getPlan`.
- Subscriptions: `create`, `get`, `changePlan`, `previewChangePlan` and `cancel`.
- Invoices: `list`, `get`, `pdf`, `createOneOff`, `recordPayment` and `payLink`.
- `usage.send(events)`: an immediate, awaited send that throws on failure.
- Webhook event types `customer.updated`, `payment.succeeded` and `checkout.session.completed`.
- Calls that move money require an `idempotencyKey`.
- Fixed: a cache-miss read can no longer overwrite a newer `entitlements.updated` snapshot that arrived while the request was in flight.

## SDK 0.1.0, 19 October 2026

First release: the client, customers, cached entitlements, usage reporting, credits, subscription seats, webhook verification, checkout and portal sessions, typed errors and the React entry.
