> The index of all pages is at https://docs.afffast.com/llms.txt.

# API versioning

How the dated Api-Version header works, and how we change the API.

The API has two parts in its version. The URL has a major version: `/v1`. A dated version selects the details: `Api-Version: 2026-11-16`. The [changelog](https://docs.afffast.com/docs/changelog.md) lists each dated version.

## How a request gets its version

- The `Api-Version` request header is optional. Its value is a date in the format `YYYY-MM-DD`.
- The **first request** of a workspace pins a version. It is the version of the header, or the newest version when there is no header.
- A later request without the header uses the version that the workspace pinned.
- A header on a later request changes that one request. It does not change the pinned version.
- Each response has an `Api-Version` header with the version that the request used.
- An unknown or malformed value returns `400` [`api_version_unsupported`](https://docs.afffast.com/errors/api-version-unsupported.md). The message lists the known versions.
- The events of a webhook have the field `api_version`: the version of the workspace when the event was made.

```bash
curl https://api.afffast.com/v1/workspace \
  -H "Authorization: Bearer $AFFFAST_API_KEY" \
  -H "Api-Version: 2026-11-16"
```

## What can change inside a version

Inside one dated version, we make **additive** changes only. You must write your code so that it accepts them:

- A new operation, a new optional parameter or a new field in a response.
- A new value in an enum, for example a new event type or a new network.
- A new error code for a new feature.

A change that breaks a client gets a **new dated version**. Examples: remove or rename a field, change the type of a field, make an optional parameter required. We keep an old dated version for at least 24 months. The changelog says when we plan to remove a version.

Do not depend on the order of the fields, the text of a `message` or the length of an ID.

## The present versions

The newest version is `2026-11-16`. Each version has an entry in the [changelog](https://docs.afffast.com/docs/changelog.md).
