---
title: "Update state machine"
method: PATCH
path: "/api/v1/state-machines/{id}"
tags: ["state-machines"]
---

# Update state machine

`PATCH /api/v1/state-machines/{id}`

Partially updates a state machine by its identifier (name, transitions, active). The code and entity type are immutable. When transitions change, the resulting graph goes through the same structural save validations as creation. Deactivating (`active: false`) is blocked while a live strategy references the machine, and ORDER machines cannot be deactivated at all (canonical order flow of the account).

## Path parameters

- `id` string, uuid, required

## Request body

- StateMachineUpdate
  - `generateFulfillmentAction` StateMachineGenerateFulfillmentActionUpdate
    - `status` string, required
  - `name` string
  - `transitions` StateMachineTransitionUpdate[]
    - `from` string, required
    - `to` string, required
  - `states` StateMachineStateConfigUpdate[]
    - `status` string, required
  - `active` boolean

## Response `200`

State machine updated.

- StateMachineUpdateResponse
  - `states` object[], required
    - `status` string
    - `actions` string[]
  - `id` string, required
  - `entity_type` 'ORDER' | 'FULFILLMENT_ORDER', required
  - `code` string, required
  - `name` string, required
  - `transitions` object[], required
    - `from` string, required
    - `to` string, required
  - `active` boolean, required
  - `is_default` boolean, required
  - `version` number, required
  - `created_at` string, required
  - `updated_at` string, required

## Other responses

- `400` — Request payload, query string, or path parameter failed validation.
- `401` — Authentication is missing, malformed, expired, or refers to a session that is no longer active.
- `403` — The caller is authenticated but lacks the required permission for this action.
- `404` — One of the referenced resources (StateMachine, Status) was not found in the caller account.
- `409` — The state machine is referenced by at least one live strategy and cannot be deleted or deactivated.
- `422` — The payload passed schema validation but breaks a business rule: an ORDER machine cannot be deactivated, or a structural save validation failed.
- `500` — Unexpected server error. The response body never leaks internal details.

---

[API](https://skmtc.net/kruzer-corp/apis/oms-api.md) · [All operations](https://skmtc.net/kruzer-corp/apis/oms-api/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/kruzer-corp/oms-api/revisions/38ef6e16a7a8/schema)
