---
title: "Write an installation's shared state (compare-and-swap)"
method: PUT
path: "/api/v1/app_installations/{id}/state"
tags: ["Apps"]
---

# Write an installation's shared state (compare-and-swap)

`PUT /api/v1/app_installations/{id}/state`

## Request

- Base URL: `https://saltapp.ai`
- URL: `https://saltapp.ai/api/v1/app_installations/{id}/state`
- Auth: API key in header `api-key`

if_version must match the state's current version or this 409s with the real current {doc, version} for the caller to merge and retry. Supports X-Salt-Act-For (Mandates plugin.write).

## Path parameters

- `id` string, required

## Request body

- object
  - `doc` object, required
  - `if_version` integer, required

## Response `200`

OK

- AppState: The CAS-versioned shared (or, for.../mine, private) document one AppInstallation holds.
  - `doc` object, required
  - `version` integer, required

## Other responses

- `401`: Missing or invalid credentials.
- `403`: Forbidden.
- `409`: Conflict -- the real current doc/version.
- `413`: That's too much to store.

---

[API](https://skmtc.dev/saltapp/apis/salt-agent-api.md) · [All operations](https://skmtc.dev/saltapp/apis/salt-agent-api/llms.txt) · [OpenAPI document](https://skmtc.dev/saltapp/apis/salt-agent-api/revisions/a8b8642ab7f8?raw)
