> ## Documentation Index
> Fetch the complete documentation index at: https://help.statisfy.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Change a flow with small edits

> Add, remove or change steps, or replace the trigger, without sending the whole spec. The edits apply in order to the saved spec, which is then checked and saved as PUT does: all or nothing. Send the version (and graph_hash) you read. Refused while the flow is on.



## OpenAPI

````yaml /api/statisfy-api.openapi.json patch /v1/automations/flows/{flow_id}
openapi: 3.1.0
info:
  description: >-
    The agent-first Statisfy API. Authenticate with an API key (`Authorization:
    Bearer stfy_live_…`), then call `GET /v1/meta/capabilities` to discover
    every operation and its schemas.
  title: Statisfy API
  version: 1.0.0
servers:
  - url: https://api.statisfy.com
    description: Production
security: []
paths:
  /v1/automations/flows/{flow_id}:
    patch:
      tags:
        - automations
      summary: Change a flow with small edits
      description: >-
        Add, remove or change steps, or replace the trigger, without sending the
        whole spec. The edits apply in order to the saved spec, which is then
        checked and saved as PUT does: all or nothing. Send the version (and
        graph_hash) you read. Refused while the flow is on.
      operationId: automations_edit_flow
      parameters:
        - in: path
          name: flow_id
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              additionalProperties: false
              properties:
                edits:
                  description: Applied in order, all or nothing
                  items:
                    anyOf:
                      - $ref: '#/components/schemas/AddStep'
                      - $ref: '#/components/schemas/RemoveStep'
                      - $ref: '#/components/schemas/SetSettings'
                      - $ref: '#/components/schemas/ReplaceTrigger'
                  maxItems: 50
                  minItems: 1
                  title: Edits
                  type: array
                graph_hash:
                  anyOf:
                    - type: string
                    - type: 'null'
                  default: null
                  description: >-
                    The graph_hash you read. Required for a flow built or
                    changed in the editor: if it changed again since, 409
                  title: Graph Hash
                version:
                  description: >-
                    The version you read (GET .../spec); a newer one is refused
                    (409)
                  title: Version
                  type: integer
              required:
                - version
                - edits
              type: object
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SavedFlowSpec'
          description: Successful Response
      security:
        - HTTPBearer: []
components:
  schemas:
    AddStep:
      additionalProperties: false
      properties:
        add:
          description: The component, e.g. SendSlackMessageComponentV2
          title: Add
          type: string
        after:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: The step it follows, or "trigger"
          title: After
        between:
          anyOf:
            - maxItems: 2
              minItems: 2
              prefixItems:
                - type: string
                - type: string
              type: array
            - type: 'null'
          default: null
          description: '[a, b]: put it between a step and the step it leads to'
          title: Between
        branch:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: 'After a condition: the branch, "true" or "false"'
          title: Branch
        id:
          anyOf:
            - type: string
            - type: 'null'
          default: null
          description: >-
            The new step's id, for later edits and {{steps.<id>.field}}; default
            s1, s2, …
          title: Id
        settings:
          additionalProperties: true
          title: Settings
          type: object
      required:
        - add
      title: AddStep
      type: object
    RemoveStep:
      additionalProperties: false
      properties:
        remove:
          description: >-
            A last step to remove (one that leads to no other); every next
            naming it goes too
          title: Remove
          type: string
      required:
        - remove
      title: RemoveStep
      type: object
    SetSettings:
      additionalProperties: false
      properties:
        set:
          description: The step, or "trigger"
          title: Set
          type: string
        settings:
          additionalProperties: true
          description: Merged into the step's settings; null removes one
          title: Settings
          type: object
      required:
        - set
        - settings
      title: SetSettings
      type: object
    ReplaceTrigger:
      additionalProperties: false
      properties:
        settings:
          additionalProperties: true
          title: Settings
          type: object
        trigger:
          description: The new trigger component; the steps after the trigger stay
          title: Trigger
          type: string
      required:
        - trigger
      title: ReplaceTrigger
      type: object
    SavedFlowSpec:
      properties:
        editor_url:
          description: The flow in Agent Studio
          title: Editor Url
          type: string
        enabled:
          title: Enabled
          type: boolean
        flow_id:
          title: Flow Id
          type: string
        name:
          title: Name
          type: string
        nodes:
          additionalProperties:
            type: string
          description: step id -> node id in the editor
          title: Nodes
          type: object
        trigger:
          description: The audience in words
          title: Trigger
          type: string
        version:
          title: Version
          type: integer
      required:
        - flow_id
        - name
        - version
        - enabled
        - trigger
        - editor_url
      title: SavedFlowSpec
      type: object
  securitySchemes:
    HTTPBearer:
      scheme: bearer
      type: http
      description: >-
        An API key, sent as `Authorization: Bearer stfy_live_…`. See
        [Authentication](/rest-api/authentication) for how to get one and which
        scopes it needs.

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.