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

# Update a flow

> Updates the configuration of an existing flow, including name, description, execution logic, conditions, and target settings. Returns the updated resource (200) after a successful update.



## OpenAPI

````yaml /en/api-reference/openapi.en-v1.json put /v1/organizations/{organization_id}/flows/{flow_id}
openapi: 3.0.3
info:
  title: Public Portal API
  version: 1.0.0
  description: Public REST API for portal
servers:
  - url: https://api.staging.flxwvdexternal.com
    description: Staging API server.
security:
  - bearerAuth: []
tags: []
paths:
  /v1/organizations/{organization_id}/flows/{flow_id}:
    put:
      tags:
        - Flows
      summary: Update a flow
      description: >-
        Updates the configuration of an existing flow, including name,
        description, execution logic, conditions, and target settings. Returns
        the updated resource (200) after a successful update.
      operationId: updateFlow
      parameters:
        - name: organization id
          in: path
          required: true
          schema:
            type: string
            maxLength: 24
            pattern: ^[0-9a-f]{24}$
          description: The unique identifier of the organization
          example: 507f1f77bcf86cd799439011
        - name: flow_id
          in: path
          required: true
          schema:
            type: string
            maxLength: 24
            pattern: ^[0-9a-f]{24}$
          description: Unique identifier for the flow to update
          example: 507f1f77bcf86cd799439012
        - name: Accept-Language
          in: header
          required: false
          schema:
            type: string
            enum:
              - en-EN
              - es-ES
              - pt-BR
              - ca-ES
              - eu-ES
            default: es-ES
          description: >-
            Language code for text fields supporting multiple languages. When
            creating or updating resources, this specifies the language for the
            provided text values. When retrieving resources, this determines
            which language variant the multilingual text fields return. Accepted
            values: 'en-EN' (English), 'es-ES' (Spanish), 'pt-BR' (Portuguese),
            'ca-ES' (Catalan), 'eu-ES' (Basque). The default is 'es-ES' if not
            provided.
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateFlowV1Request'
            examples:
              update-flow-configuration:
                summary: Update flow with new configuration
                value:
                  name:
                    en-EN: Daily Copy Flow Updated
                    es-ES: Updated Daily Copy Process
                  description:
                    en-EN: Updated Automated Daily Copy Process
                    es-ES: Updated Automated Copy Process
                  detection_only: false
                  cooldown_minutes: 120
                  enabled: true
                  init_text:
                    en-EN: Starting updated copy process...
                    es-ES: Starting updated copy process...
                  ok_text:
                    en-EN: Copy Completed Successfully
                  ko_text:
                    en-EN: Copy failed. Please check the logs.
                  target:
                    type: workspaces
                    ids:
                      - 507f1f77bcf86cd799439012
                      - 507f1f77bcf86cd799439013
                  microservice_id: 507f1f77bcf86cd799439014
                  conditions:
                    - condition_type_id: 507f1f77bcf86cd799439015
                      operator: gte
                      compare_to: '90'
                      period: null
                      check_every: 600
      responses:
        '200':
          description: >-
            Flow updated successfully. The response contains the updated
            resource.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FlowV1'
        '400':
          $ref: '#/components/responses/BadRequest'
          description: >-
            Invalid request. Common causes: - Mandatory fields are missing -
            Invalid field values - Invalid condition configuration - Invalid
            microservice identifier
        '401':
          $ref: '#/components/responses/Unauthorized'
          description: Unauthorized - authentication required
        '404':
          $ref: '#/components/responses/NotFound'
          description: Flow or organization not found
        '422':
          $ref: '#/components/responses/UnprocessableEntity'
          description: >-
            Unprocessable entity. Common causes: - Referenced microservice not
            found - Target referenced entities (Workspaces, Workspace groups,
            report groups) not found or do not belong - Invalid condition type -
            Flow cannot be enabled
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    UpdateFlowV1Request:
      type: object
      properties:
        name:
          $ref: '#/components/schemas/MultilangField'
          description: >-
            Flow name. At least one language key is required; each value between
            1 and 512 characters.
        description:
          $ref: '#/components/schemas/MultilangField'
          description: >-
            Flow description. At least one language key is required; each value
            between 1 and 512 characters.
        detection_only:
          type: boolean
        cooldown_minutes:
          type: number
          minimum: 10
          maximum: 1440
          description: Waiting time in minutes. Must be between 10 and 1440.
        enabled:
          type: boolean
          description: >-
            Indicates if the flow is enabled. PUT expects a complete definition;
            this field is required.
        init_text:
          $ref: '#/components/schemas/MultilangField'
          nullable: true
          description: >-
            Initial text message. Mandatory in PUT. Send null to clear;
            otherwise, an object with at least one language key; each value
            between 1 and 512 characters.
        ok_text:
          $ref: '#/components/schemas/MultilangField'
          nullable: true
          description: >-
            Success text message. Mandatory in PUT. Send null to clear;
            otherwise, object with at least one language key; each value between
            1 and 512 characters.
        ko_text:
          $ref: '#/components/schemas/MultilangField'
          nullable: true
          description: >-
            Error text message. Mandatory in PUT. Send null to clear; otherwise,
            an object with at least one language key; each value between 1 and
            512 characters.
        target:
          type: object
          properties:
            type:
              type: string
              enum:
                - all_workspaces
                - workspaces
                - workspace_groups
                - reporting_groups
            ids:
              type: array
              items:
                type: string
                maxLength: 512
          required:
            - type
        microservice_id:
          type: string
          maxLength: 24
          pattern: ^[0-9a-f]{24}$
        conditions:
          type: array
          items:
            $ref: '#/components/schemas/FlowConditionInputV1'
      required:
        - name
        - description
        - detection_only
        - cooldown_minutes
        - enabled
        - init_text
        - ok_text
        - ko_text
        - target
        - microservice_id
        - conditions
    FlowV1:
      type: object
      description: >-
        Flow detail as returned by GET flow by id. Organization is implied by
        the route `/v1/organizations/{organization_id}/flows/{flow_id}`. Target
        workspaces/groups are normalized in target.ids (hexadecimal strings of
        MongoDB ObjectId).
      properties:
        id:
          type: string
          maxLength: 24
          pattern: ^[0-9a-f]{24}$
        created_at:
          type: string
          format: date-time
        name:
          type: string
          description: Resolved to Accept-Language when multilingual
        description:
          type: string
          description: Resolved to Accept-Language when multilingual
        type:
          type: string
          enum:
            - session
            - workspace
        version:
          type: number
        detection_only:
          type: boolean
        cooldown_minutes:
          type: number
          description: Waiting time in minutes
        enabled:
          type: boolean
        conditions:
          type: array
          items:
            $ref: '#/components/schemas/FlowConditionV1'
          description: Omitted or empty when the flow has no conditions
        trigger:
          type: string
          nullable: true
        target:
          $ref: '#/components/schemas/FlowTargetSelectorV1'
          description: >-
            Execution destination: type selects the scope; ids list Workspace
            _id values, Workspace group _id values, or Reporting Group _id
            (empty when type is ALL_WORKSPACES)
        microservice_id:
          type: string
          nullable: true
          description: Linked microservice ID when present
        init_text:
          type: string
          nullable: true
          description: Resolved to Accept-Language when multilingual
        ok_text:
          type: string
          nullable: true
          description: Resolved to Accept-Language when multilingual
        ko_text:
          type: string
          nullable: true
          description: Resolved to Accept-Language when multilingual
        execution_metrics:
          $ref: '#/components/schemas/FlowExecutionMetricsV1'
          nullable: true
          description: Present when metrics are calculated for this flow
      required:
        - id
        - created_at
        - name
        - description
        - type
        - version
        - detection_only
        - cooldown_minutes
        - enabled
        - target
    MultilangField:
      type: object
      description: >-
        Multilanguage field. Keys are language codes (en-EN, es-ES, pt-BR,
        eu-ES, ca-ES). At least one key must be present. Each value must be
        between 1 and 512 characters.
      properties:
        en-EN:
          type: string
          minLength: 1
          maxLength: 512
        es-ES:
          type: string
          minLength: 1
          maxLength: 512
        pt-BR:
          type: string
          minLength: 1
          maxLength: 512
        eu-ES:
          type: string
          minLength: 1
          maxLength: 512
        ca-ES:
          type: string
          minLength: 1
          maxLength: 512
      additionalProperties: false
    FlowConditionInputV1:
      type: object
      properties:
        condition_type_id:
          type: string
          maxLength: 24
          pattern: ^[0-9a-f]{24}$
        operator:
          type: string
          enum:
            - eq
            - gt
            - lt
            - gte
            - lte
            - startsWith
            - endsWith
            - contains
            - at
        compare_to:
          type: string
          maxLength: 512
        period:
          type: number
          nullable: true
        check_every:
          type: number
      required:
        - condition_type_id
        - operator
        - compare_to
        - check_every
    FlowConditionV1:
      type: object
      properties:
        condition_type_id:
          type: string
        metric:
          type: string
        operator:
          type: string
        compare_to:
          type: string
        period:
          type: number
          nullable: true
        check_every:
          type: number
      required:
        - condition_type_id
        - metric
        - operator
        - compare_to
        - check_every
    FlowTargetSelectorV1:
      type: object
      properties:
        type:
          type: string
          enum:
            - all_workspaces
            - workspaces
            - workspace_groups
            - reporting_groups
          description: >-
            ALL_WORKSPACES: ids are always []. WORKSPACES: ids are Workspace
            document _id (24 hex). WORKSPACE_GROUPS / REPORTING_GROUPS: ids are
            group _id values.
        ids:
          type: array
          items:
            type: string
            maxLength: 24
            pattern: ^[0-9a-f]{24}$
      required:
        - type
        - ids
    FlowExecutionMetricsV1:
      type: object
      properties:
        targeted_workspaces:
          type: number
        evaluations_per_day:
          type: number
        possible_executions_per_day:
          type: number
        total_possible_executions_per_day:
          type: number
      required:
        - targeted_workspaces
        - evaluations_per_day
        - possible_executions_per_day
        - total_possible_executions_per_day
    ErrorResponse:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
            code:
              type: string
            details:
              type: string
          required:
            - message
            - code
      required:
        - error
  responses:
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    Unauthorized:
      description: Unauthorized
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    NotFound:
      description: Not Found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    UnprocessableEntity:
      description: Unprocessable Entity
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    TooManyRequests:
      description: Too Many Requests
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    InternalServerError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````