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

# Apply targeted edits to a flow config

> Change part of a flow without resending the whole graph. Replacing the entire config to fix one word puts every other node in the request too, so a small fix carries the risk of a large one.

The batch is atomic — one bad op writes nothing — and the result is validated by the same rules a full replace runs. Omit `internal_version` and the ops are applied to the row under a lock, so a fix to one node does not lose a race with a change to another.

Replacing the whole config to fix one word puts every other node in the request too, so a small fix carries the risk of a large one. This endpoint changes only what you name.

<Info>
  **Operations** — each item of `ops` is `{"op": "<name>", ...}`:

  | Scope              | Ops                                                                            |
  | ------------------ | ------------------------------------------------------------------------------ |
  | Flow inputs        | `set_input`, `remove_input`                                                    |
  | Nodes              | `add_node`, `replace_node`, `update_node`, `remove_node`                       |
  | One binding / port | `set_node_input`, `remove_node_input`, `set_node_output`, `remove_node_output` |
  | Flow output        | `set_output`, `set_output_field`, `remove_output_field`                        |

  `update_node` merges `patch` into the node, and merges `patch.data` one level deeper — so patching one field of `data` leaves the rest of the node alone. Lists are replaced wholesale; use the single-entry ops above to touch one binding or port.
</Info>

<Warning>
  The batch is atomic: if any op fails, nothing is written.
</Warning>

<Tip>
  `validate_only: true` applies and validates the batch without saving, and returns the config it would produce with `flow: null`. Omit `internal_version` and the ops are applied to the row under a lock, so a fix to one node does not lose a race with a change to another.
</Tip>


## OpenAPI

````yaml PATCH /v1/flows/{flow_id}/config
openapi: 3.1.0
info:
  title: Databar.ai API
  description: >-

    # Authentication


    Databar uses API keys to allow access to the API. You can find your API key
    in your workspace home page, but to use the REST API you’ll first need to
    schedule a call with us.

    Our API expects the API key to be included in all API requests to the server
    in the Header of your request with the key `x-apikey`.

    To find your API key, head over to your Databar workspace and click
    Integrations.


    **Example:**


    `bash

    curl https://api.databar.ai/v1/user/me -H x-apikey: {YOUR_API_KEY}`
  contact:
    email: info@databar.ai
  version: 0.1.2
servers:
  - url: https://api.databar.ai
    description: Production
security: []
paths:
  /v1/flows/{flow_id}/config:
    patch:
      tags:
        - Flows
      summary: Apply targeted edits to a flow config
      description: >-
        Change part of a flow without resending the whole graph. Replacing the
        entire config to fix one word puts every other node in the request too,
        so a small fix carries the risk of a large one.


        The batch is atomic — one bad op writes nothing — and the result is
        validated by the same rules a full replace runs. Omit `internal_version`
        and the ops are applied to the row under a lock, so a fix to one node
        does not lose a race with a change to another.
      operationId: patch_flow_config_v1_flows__flow_id__config_patch
      parameters:
        - name: flow_id
          in: path
          required: true
          schema:
            type: string
            title: Flow ID
          description: Flow identifier, e.g. `fl_ab12cd34`
        - name: x-apikey
          in: header
          required: true
          schema:
            type: string
            title: API Key
            description: API Key for authentication
          description: API Key for authentication
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/FlowConfigOpsIn'
      responses:
        '200':
          description: The saved flow and the resulting config
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FlowConfigOpsOut'
        '400':
          description: The batch could not be applied, or the result is not a valid flow
        '403':
          description: Forbidden
        '404':
          description: Flow not found
        '409':
          description: '`internal_version` is stale'
components:
  schemas:
    FlowConfigOpsIn:
      description: >-
        A small, ordered batch of targeted edits, applied atomically: if any op
        fails, nothing is written. Op names: `set_input`, `remove_input`,
        `add_node`, `replace_node`, `update_node`, `remove_node`,
        `set_node_input`, `remove_node_input`, `set_node_output`,
        `remove_node_output`, `set_output`, `set_output_field`,
        `remove_output_field`.
      properties:
        ops:
          type: array
          items:
            type: object
          title: Ops
          description: 'Operations, applied in order. Each is `{"op": "<name>", ...}`.'
        internal_version:
          anyOf:
            - type: string
            - type: 'null'
          title: Internal Version
          description: >-
            Optional. When set, the edit is refused if the flow changed since
            you read it. Omit it and the ops are applied to whatever is current.
        validate_only:
          type: boolean
          title: Validate Only
          default: false
          description: >-
            Apply and validate without saving; the response carries the config
            the batch would produce.
      type: object
      required:
        - ops
      title: FlowConfigOpsIn
    FlowConfigOpsOut:
      properties:
        valid:
          type: boolean
          title: Valid
        errors:
          type: array
          items:
            type: string
          title: Errors
          description: >-
            Why the resulting config would be rejected. Only ever non-empty
            under `validate_only`.
        config:
          type: object
          title: Config
        flow:
          anyOf:
            - $ref: '#/components/schemas/FlowDetail'
            - type: 'null'
          title: Flow
          description: The saved flow. Null when `validate_only` was set.
      type: object
      required:
        - valid
        - config
      title: FlowConfigOpsOut
    FlowDetail:
      description: >-
        A flow plus the pieces needed to edit it. `config` is the graph, `ui` is
        editor-only metadata the runtime ignores, and `internal_version` is the
        concurrency token you send back on a write.
      properties:
        id:
          type: string
          title: Id
        name:
          type: string
          title: Name
        description:
          type: string
          title: Description
        inputs:
          type: array
          items:
            $ref: '#/components/schemas/FlowInput'
          title: Inputs
        outputs:
          type: array
          items:
            $ref: '#/components/schemas/FlowOutput'
          title: Outputs
        config:
          type: object
          title: Config
          description: 'The flow definition: `inputs`, `nodes`, `output`.'
        ui:
          type: object
          title: Ui
          description: Editor-only metadata. The runtime never reads it.
        internal_version:
          type: string
          title: Internal Version
          description: >-
            Concurrency token. Send it back on PUT (required) and on PATCH when
            changing `config`.
        created_at:
          type: string
          title: Created At
        updated_at:
          type: string
          title: Updated At
      type: object
      required:
        - id
        - name
        - description
        - inputs
        - outputs
        - config
        - ui
        - internal_version
        - created_at
        - updated_at
      title: FlowDetail
    FlowInput:
      properties:
        id:
          type: string
          title: Id
          description: >-
            Unique identifier for this input (used as key in the `inputs` map
            when running the flow).
        description:
          type: string
          title: Description
        type:
          type: string
          title: Type
          description: Data type of the input, e.g. `text`.
        required:
          type: boolean
          title: Required
      type: object
      required:
        - id
        - description
        - type
        - required
      title: FlowInput
    FlowOutput:
      properties:
        id:
          type: string
          title: Id
        response_field_id:
          anyOf:
            - type: integer
            - type: 'null'
          title: Response Field Id
      type: object
      required:
        - id
      title: FlowOutput

````