Keep installed clients compatible #

View this page as Markdown

On this page

Prompt:

Stop app versions older than 2.3.0 from calling the backend, and send those users to the store.

Also works: "Which versions of our app are people still using?" "Can I ship this backend change without breaking the old app?" "Force an update of the mobile app."

The app sends its identity and version on every call, in the header x-turnzero-cloud-client (step 1). read_app_sign_in shows which versions are in use (step 2). configure_app_sign_in raises the minimum version (step 3). After that, the platform refuses a request from an older version with status 426 and minimum_version. The app shows an update message. If update_url contains a store link, the app can open it. Otherwise update_url is null.

What your AI does #

  • Reads the mobile-backend skill (read_context, id skill:mobile-backend) and follows its version rules.
  • Calls configure_app_sign_in with the client's minimum_version and update_url on the environment's realm, and reports any warnings the call returns.
  • Reads the x-turnzero-cloud-version header on a backend response to confirm which deployed version handled it.
  • Asks you for the new minimum and the store link. Before it changes the minimum or the backend, it tells you which installed versions the change would refuse.

What you need #

  • A native app declared on the realm with its client_id, as Sign in from a native app describes.
  • The app's store link, where a refused user is sent to update.

Before your AI starts #

For the AI assistant: Check the following before starting.

  • A connected, signed-in AI assistant (Connect your AI assistant).
  • The realm's declared clients, read with read_app_sign_in on each environment.
  • The app's release version, in the major.minor.patch form the store build uses.

Steps #

1. Send the version header from the app #

The app sends its identity and version on every request to the backend, in the header x-turnzero-cloud-client. Use the declared client_id, then a slash and the app's version, as in com.example.app/2.3.1. The version is major.minor.patch. It may add a pre-release label, such as 2.4.0-beta.1. A pre-release counts as lower than its release, so 2.4.0-beta.1 is below 2.4.0.

Set the header in the one function the app uses for every backend request, next to the bearer token. Handle the refusal from step 3 in the same function. The sample below shows that shared request function in JavaScript. session and showUpdateScreen are your app's own.

const CLIENT = 'com.example.app/2.3.1';

export async function api(path, init = {}) {
  const response = await fetch(`https://<label>.ai.host${path}`, {
    ...init,
    headers: { ...init.headers, authorization: `Bearer ${session.token}`, 'x-turnzero-cloud-client': CLIENT },
  });
  if (response.status === 426) {
    // Below the minimum version, tell the user to update. Link to the store when configured.
    const { update_url } = await response.json();
    showUpdateScreen({
      message: 'Update the app to continue.',
      ...(update_url ? { url: update_url } : {}),
    });
    throw new Error('client_upgrade_required');
  }
  return response;
}

The version check lets a request through if the header is missing, names an undeclared client, or has an unrecognized format. Other access checks still apply. Your backend receives the header as the app sent it.

2. Read the versions in use #

The platform records which versions of each declared client send requests. It updates this record at most once a minute. read_app_sign_in lists the versions seen in the last day under each client, in versions_seen, highest version first. This includes requests the platform refused because the version was too old. A listed version sent a request, which may have stopped before the backend.

{
  "client_id": "com.example.app",
  "redirect_uris": ["com.example.app:/callback"],
  "minimum_version": "2.0.0",
  "update_url": "https://apps.apple.com/app/id123456789",
  "versions_seen": [
    { "version": "2.3.1", "last_seen": "2026-09-27T09:41:00.000Z" },
    { "version": "2.2.0", "last_seen": "2026-09-27T08:15:00.000Z" }
  ]
}

A version drops off the list a day after its last request. Each client’s list holds up to 50 versions at a time. Once the list is full, it records no additional versions. Each environment's realm keeps its own list, so read the realm of the environment you are changing. Treat the list as a record of requests, including requests refused for an old version.

3. Raise the minimum version #

Read the realm's clients first. Send the full clients list to configure_app_sign_in with the new minimum_version and the intended update_url on that client. Keep the other clients and their settings. The realm saves the change immediately and needs no deploy. A router may still use its cached client list. If a request sees the earlier minimum, wait briefly and check again.

To lower or clear the minimum, call configure_app_sign_in with the full clients list again. To clear it, omit minimum_version from the client you are changing. Keep every other client's current fields, minimum version and update URL.

Your app's manifest may list this environment's clients in its realm member. If so, you still set the minimum with configure_app_sign_in. The call sends every listed client with the fields the manifest gives it, in any order. It changes only minimum_version and update_url. Also send every client's current minimum_version and update_url: a client the call lists without them loses them. Each later submission of the manifest keeps the raised minimum and the update URL.

Also raise the minimum when the platform stops supporting the version of a backend package's interface that your app uses. This happens when that version's compatibility window ends. Set the minimum to the first app version built against a contract still in service. The platform enforces the declared value.

When the service can read recent sightings, warnings lists versions seen in the last day that the new minimum would refuse and the old minimum accepted. The minimum can change even if the sightings are unavailable.

{
  "warnings": [
    { "code": "clients_in_use", "client_id": "com.example.app", "versions": ["2.2.0"] }
  ]
}

Cloud checks the version on backend requests. A declared client below the minimum gets HTTP 426 (client_upgrade_required) before the request reaches your code or counts against a request limit. The check skips the realm's routes under /__account/, so an older build can still sign in. Because the version check can return minimum_version and update_url before sign-in, keep private information out of both fields.

To verify the minimum, sign in with a build below it. Call a backend route with that build's x-turnzero-cloud-client header and expect 426. Sign in with a supported build and repeat the same call with that build's header. Check that the request reaches your backend.

{
  "error": "client_upgrade_required",
  "detail": "Version 2.2.0 of com.example.app is below 2.3.0, the oldest version this application accepts; update the app at https://apps.apple.com/app/id123456789 and try again.",
  "minimum_version": "2.3.0",
  "update_url": "https://apps.apple.com/app/id123456789"
}

Tell the user to update the app. Include a link to update_url when configured. If update_url is null, show the instruction without a link. Do not retry the request.

If iOS and Android share a client_id, they share one update_url. Give each platform its own client_id for separate store links, or use one update page that sends people to the right store.

4. Read the version that responded #

Every response from your backend includes the header x-turnzero-cloud-version. Its value is the deployed version that handled the request, numbered as list_versions numbers it. An environment with no deployed version responds without this header.

5. Before a promote #

A promote changes the backend that every installed app calls. On an application with one environment, each deploy goes straight to production and does the same. First read the versions in use on the production realm. If the new backend drops something an installed version still calls, act first. Raise the minimum, or keep the backend compatible. An installed copy can still need the old behavior even if it sent no requests in the past day.

A deploy, a promote, or a rollback never changes a minimum version, and none of them gives a warning.

Expected result #

The app sends its version in x-turnzero-cloud-client on each request. read_app_sign_in lists that version in the client's versions_seen. After you raise the minimum, the platform refuses a request from an older version with status 426 and minimum_version. It also gives the store link in update_url if one is configured, or null otherwise. A request from a current version reaches the backend, and the response names the deployed version that served it.

Refusals #

See the refusals reference for other platform errors.

Refusal Status Cause Remedy
client_upgrade_required 426 The app sent a version below its client's minimum_version on this realm. Show an update message and offer the store link if update_url is present. Otherwise point to the app's normal update channel. If the setting seems wrong, ask the app owner to verify it. Change the minimum with configure_app_sign_in only at the owner's direction.
invalid_request 400 A minimum_version is not major.minor.patch, or an update_url is not an https URL. Send minimum_version as the three numbers alone, such as 2.3.0, and update_url as an https store link.