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

# Update workflow

> Updates supplied fields. Supplied arrays replace existing arrays; steps or variables publish a new version. Concurrency fields are required. ACTIVE workflows run on new matching events.



## OpenAPI

````yaml /openapi.yaml patch /v1/workflows/{id}
openapi: 3.1.0
info:
  title: Quentli REST API
  version: 1.0.0
  description: OpenAPI spec for Quentli REST endpoints.
servers:
  - url: https://api.quentli.com
    description: Production API
  - url: https://api.staging.quentli.com
    description: Staging API for production-like validation
security:
  - organizationApiKey: []
  - oauthAccessToken: []
tags:
  - name: Auth
  - name: Management
  - name: Billing
  - name: Catalog
  - name: Customers
  - name: Invoices
  - name: Payment Methods
  - name: Payment Sessions
  - name: Payments
  - name: Subscriptions
  - name: Tax Invoices
  - name: Webhooks
  - name: Messaging
paths:
  /v1/workflows/{id}:
    patch:
      tags:
        - Management
      summary: Update workflow
      description: >-
        Updates supplied fields. Supplied arrays replace existing arrays; steps
        or variables publish a new version. Concurrency fields are required.
        ACTIVE workflows run on new matching events.
      operationId: workflows_update
      parameters:
        - schema:
            type: string
            description: Identifier of the workflow.
          required: true
          description: Identifier of the workflow.
          name: id
          in: path
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateWorkflowArgs'
      responses:
        '200':
          description: Workflow updated
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowPayload'
        '400':
          description: Invalid request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserError'
        '401':
          description: Authentication required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserError'
        '403':
          description: Permission denied
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserError'
        '404':
          description: Workflow not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserError'
components:
  schemas:
    UpdateWorkflowArgs:
      type: object
      properties:
        input:
          type: object
          properties:
            name:
              type: string
              minLength: 1
              maxLength: 191
              validationMessages:
                invalid_type:
                  es: Debes proporcionar un nombre para la estrategia.
                  en: Please provide a strategy name.
                too_small:
                  es: Debes proporcionar un nombre para la estrategia.
                  en: Please provide a strategy name.
                too_big:
                  es: El nombre admite hasta {maximum} caracteres.
                  en: The name supports up to {maximum} characters.
            description:
              type:
                - string
                - 'null'
              maxLength: 1024
              validationMessages:
                too_big:
                  es: La descripción admite hasta {maximum} caracteres.
                  en: The description supports up to {maximum} characters.
            status:
              type: string
              enum:
                - DRAFT
                - ACTIVE
                - PAUSED
              validationMessages:
                invalid_value:
                  es: Selecciona un estado válido para la estrategia.
                  en: Select a valid strategy status.
            variables:
              type: array
              items:
                type: object
                properties:
                  key:
                    type: string
                    maxLength: 191
                    pattern: ^[a-zA-Z][a-zA-Z0-9_]*$
                  name:
                    type: string
                    minLength: 1
                    maxLength: 191
                  type:
                    type: string
                    enum:
                      - DATE_TIME
                      - INVOICE
                  required:
                    type: boolean
                required:
                  - key
                  - name
                  - type
                  - required
                additionalProperties: false
              maxItems: 50
            triggers:
              type: array
              items:
                type: object
                properties:
                  type:
                    type: string
                    enum:
                      - INVOICE_SEND_REMINDER_CREATED
                      - INVOICE_AUTOMATIC_CREATED
                  enabled:
                    type: boolean
                  expectedWorkflowId:
                    type:
                      - string
                      - 'null'
                    minLength: 1
                required:
                  - type
                  - enabled
                  - expectedWorkflowId
                additionalProperties: false
              maxItems: 2
            steps:
              type: array
              items:
                oneOf:
                  - type: object
                    properties:
                      type:
                        type: string
                        enum:
                          - ATTEMPT_CHARGE
                      invoiceVariableKey:
                        type: string
                        minLength: 1
                    required:
                      - type
                      - invoiceVariableKey
                    additionalProperties: false
                  - type: object
                    properties:
                      type:
                        type: string
                        enum:
                          - DELAY
                      amount:
                        type: integer
                        exclusiveMinimum: 0
                      unit:
                        type: string
                        enum:
                          - MINUTES
                          - HOURS
                          - DAYS
                          - WEEKS
                          - MONTHS
                          - YEARS
                          - BUSINESS_DAYS
                    required:
                      - type
                      - amount
                      - unit
                    additionalProperties: false
                  - type: object
                    properties:
                      type:
                        type: string
                        enum:
                          - WAIT_UNTIL
                      anchorKey:
                        type: string
                        minLength: 1
                      transformations:
                        type: array
                        items:
                          anyOf:
                            - type: object
                              properties:
                                function:
                                  type: string
                                  enum:
                                    - ADD
                                amount:
                                  type: integer
                                unit:
                                  type: string
                                  enum:
                                    - MINUTES
                                    - HOURS
                                    - DAYS
                                    - WEEKS
                                    - MONTHS
                                    - YEARS
                                    - BUSINESS_DAYS
                              required:
                                - function
                                - amount
                                - unit
                              additionalProperties: false
                            - type: object
                              properties:
                                function:
                                  type: string
                                  enum:
                                    - SET
                                setComponent:
                                  type: string
                                  enum:
                                    - HOUR
                                setValue:
                                  type: integer
                                  minimum: 0
                                  maximum: 23
                              required:
                                - function
                                - setComponent
                                - setValue
                              additionalProperties: false
                            - type: object
                              properties:
                                function:
                                  type: string
                                  enum:
                                    - SET
                                setComponent:
                                  type: string
                                  enum:
                                    - MINUTE
                                setValue:
                                  type: integer
                                  minimum: 0
                                  maximum: 59
                              required:
                                - function
                                - setComponent
                                - setValue
                              additionalProperties: false
                            - type: object
                              properties:
                                function:
                                  type: string
                                  enum:
                                    - START_OF
                                    - END_OF
                                periodUnit:
                                  type: string
                                  enum:
                                    - DAYS
                                    - WEEKS
                                    - MONTHS
                                    - YEARS
                                weekStartsOn:
                                  type: string
                                  enum:
                                    - SUNDAY
                                    - MONDAY
                                    - TUESDAY
                                    - WEDNESDAY
                                    - THURSDAY
                                    - FRIDAY
                                    - SATURDAY
                              required:
                                - function
                                - periodUnit
                              additionalProperties: false
                            - type: object
                              properties:
                                function:
                                  type: string
                                  enum:
                                    - SET
                                setComponent:
                                  type: string
                                  enum:
                                    - DAY_OF_MONTH
                                setValue:
                                  type: integer
                                  minimum: 1
                                  maximum: 31
                              required:
                                - function
                                - setComponent
                                - setValue
                              additionalProperties: false
                            - type: object
                              properties:
                                function:
                                  type: string
                                  enum:
                                    - SET
                                setComponent:
                                  type: string
                                  enum:
                                    - MONTH
                                setValue:
                                  type: integer
                                  minimum: 1
                                  maximum: 12
                              required:
                                - function
                                - setComponent
                                - setValue
                              additionalProperties: false
                            - type: object
                              properties:
                                function:
                                  type: string
                                  enum:
                                    - SET
                                setComponent:
                                  type: string
                                  enum:
                                    - YEAR
                                setValue:
                                  type: integer
                                  minimum: 1000
                                  maximum: 9999
                              required:
                                - function
                                - setComponent
                                - setValue
                              additionalProperties: false
                            - type: object
                              properties:
                                function:
                                  type: string
                                  enum:
                                    - NOT_BEFORE_TIME
                                hour:
                                  type: integer
                                  minimum: 0
                                  maximum: 23
                                minute:
                                  type: integer
                                  minimum: 0
                                  maximum: 59
                              required:
                                - function
                                - hour
                              additionalProperties: false
                            - type: object
                              properties:
                                function:
                                  type: string
                                  enum:
                                    - CLAMP_TO_WORKFLOW_START
                              required:
                                - function
                              additionalProperties: false
                            - type: object
                              properties:
                                function:
                                  type: string
                                  enum:
                                    - NEXT_QUINCENA
                              required:
                                - function
                              additionalProperties: false
                          validationMessages:
                            invalid_union:
                              es: >-
                                Revisa el ajuste del calendario. Usa cantidades
                                enteras y fechas y horas válidas.
                              en: >-
                                Check the calendar adjustment. Use whole numbers
                                and valid dates and times.
                        maxItems: 20
                    required:
                      - type
                      - anchorKey
                      - transformations
                    additionalProperties: false
                  - type: object
                    properties:
                      type:
                        type: string
                        enum:
                          - SEND_REMINDER
                      invoiceVariableKey:
                        type: string
                        minLength: 1
                      templateId:
                        type: string
                        minLength: 1
                        validationMessages:
                          invalid_type:
                            es: Debes proporcionar una plantilla
                            en: Please provide a template
                          too_small:
                            es: Debes proporcionar una plantilla
                            en: Please provide a template
                    required:
                      - type
                      - invoiceVariableKey
                      - templateId
                    additionalProperties: false
              minItems: 1
              maxItems: 100
              validationMessages:
                too_small:
                  es: Agrega al menos una acción.
                  en: Add at least one action.
                too_big:
                  es: El flujo admite hasta {maximum} pasos.
                  en: The workflow supports up to {maximum} steps.
            id:
              type: string
              minLength: 1
            expectedPublishedVersionId:
              type:
                - string
                - 'null'
              minLength: 1
            expectedUpdatedAt:
              anyOf:
                - type: string
                  description: Date string
                - type: string
                  format: date-time
                  description: Date object
          required:
            - id
            - expectedPublishedVersionId
            - expectedUpdatedAt
          additionalProperties: false
          localizedValidation: true
      required:
        - input
      additionalProperties: false
      localizedValidation: true
      description: >-
        Partial workflow update. Supplied arrays replace existing arrays;
        definition changes publish a new version. Concurrency fields are
        required.
    WorkflowPayload:
      type: object
      properties:
        workflow:
          $ref: '#/components/schemas/Workflow'
      required:
        - workflow
      description: The created or updated workflow.
    UserError:
      type: object
      properties:
        error:
          type: object
          properties:
            message:
              type: string
          required:
            - message
      required:
        - error
      additionalProperties: false
      description: Standard user-facing error response envelope.
    Workflow:
      type: object
      properties:
        id:
          type: string
          description: Unique identifier of the workflow.
          example: wf_1234567890abcdefghij
        createdAt:
          type: string
          format: date-time
          description: When the workflow was created.
        updatedAt:
          type: string
          format: date-time
          description: >-
            When the workflow was last updated. Send it back as
            expectedUpdatedAt.
        organizationId:
          type: string
          description: Organization that owns the workflow.
        key:
          type: string
          description: Stable workflow key.
        name:
          type: string
          description: Name of the workflow.
          example: Cobranza estándar
        description:
          type:
            - string
            - 'null'
          description: Optional description of the workflow.
        status:
          type: string
          enum:
            - DRAFT
            - ACTIVE
            - PAUSED
          description: Whether the workflow runs on new events.
        publishedVersionId:
          type:
            - string
            - 'null'
          description: >-
            Currently published version. Send it back as
            expectedPublishedVersionId.
        deletedAt:
          type:
            - string
            - 'null'
          format: date-time
          description: When the workflow was deleted, if applicable.
      required:
        - id
        - createdAt
        - updatedAt
        - organizationId
        - key
        - name
        - description
        - status
        - publishedVersionId
        - deletedAt
      description: An automation that runs collection and reminder steps for invoices.
  securitySchemes:
    organizationApiKey:
      type: http
      scheme: bearer
      description: 'Organization API key using `Authorization: Bearer sk_...`.'
    oauthAccessToken:
      type: http
      scheme: bearer
      bearerFormat: OAuth 2.1
      description: 'OAuth access token using `Authorization: Bearer qoa_at_...`.'

````

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