---
title: API Versions
description: How a request to the Mergify API names a dated version, which version it gets when it names none, and how long Mergify serves each one.
---

The Mergify API is versioned by date. A version sets the operations the API
serves and what they accept and return. Mergify adds operations and fields to
every version it serves, but a change that would break a caller, such as
removing an operation, only comes in a new version: a script keeps working
until you move it.

Every version is served at `https://api.mergify.com/v1`. `/v1` is the API's
address, not its version.

| Version | What it changes |
| --- | --- |
| `2026-11-16` | The initial version: the API as it was before it had versions. |
| `2026-11-20` | [No longer serves 25 deprecated operations](/api/versions/2026-11-20). |

## Naming a version

A request names the version it is written for in its `Mergify-Version` header,
as a date:

```bash
curl -H "Authorization: Bearer <your-application-key>" \
     -H "Mergify-Version: 2026-11-16" \
     https://api.mergify.com/v1/application
```

The response names the version that served it in the same header,
`Mergify-Version: 2026-11-16` here.

A request naming a version Mergify does not serve is refused with `400`, error
code `API_VERSION_UNKNOWN`, and a `served_versions` field listing the dated
versions it serves: name one of those instead. On an on-premise installation, a client
newer than the installation gets the same `400`: [upgrade
Mergify](/enterprise/releases#upgrading), or use an older release of the client.

## Which version a request gets

```dot class="flow" title="A request gets the version it names. Naming none, it gets its organization's version with an application key, and the oldest version Mergify serves with any other credential."
digraph {
  REQ [label="A request", class="external"];
  NAMES [label="Names a\nversion?", class="mergify"];
  KEY [label="Application\nkey?", class="mergify"];
  NAMED [label="The version\nit names", class="config"];
  ORG [label="The\norganization's\nversion", class="config"];
  OLDEST [label="The oldest\nversion served", class="config"];

  REQ -> NAMES;
  NAMES -> NAMED [label="yes"];
  NAMES -> KEY [label=" no"];
  KEY -> ORG [label="yes"];
  KEY -> OLDEST [label=" no"];

  { rank=same; NAMES; NAMED; }
  { rank=same; KEY; ORG; }
}
```

An organization's version is set by the first request one of its
[application keys](/api/application-keys#creating-an-application-key) makes
without naming a version. It is set to the newest version released when the
organization's oldest application key was created: an organization new to the
API starts on the newest version, and one whose keys are older keeps the version
its scripts were written against.

To keep a caller on one version whatever the organization's is, name that
version in its requests.

The [Mergify CLI](/cli/usage) and the [test framework
plugins](/test-engine/test-frameworks) (pytest-mergify, rspec-mergify,
minitest-mergify and the JavaScript reporters) name the version their release
was built against, whatever the organization's version, until you upgrade them.
Keep them on their latest release.

## Trying the next version

Name `next` in the `Mergify-Version` header to try the version Mergify is
preparing: the breaking changes collected since the newest release. It changes
without notice and is not for production.

## How long a version is served

Mergify serves a version for at least 12 months after the version that
supersedes it is released.

Before a version stops being served, every response served at it carries the
date it stops in a `Mergify-Version-Sunset` header:

```http
Mergify-Version: 2026-11-16
Mergify-Version-Sunset: YYYY-MM-DD
```

Before that date, move its callers: name a newer version in their requests. The
Mergify CLI and the test framework plugins warn their users when a response
carries this header: upgrade them to a release that names a newer version.
