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

# Update workflow version

> Updates an existing workflow version. Accepts both public and secret keys.



## OpenAPI

````yaml https://app.stainless.com/api/spec/documented/triglit/openapi.documented.yml patch /v1/gateway/workflow-versions/{versionId}
openapi: 3.0.0
info:
  title: Triglit
  description: Documentação da API do Triglit
  version: '1.0'
  contact: {}
servers: []
security: []
tags: []
paths:
  /v1/gateway/workflow-versions/{versionId}:
    patch:
      tags:
        - Workflow Versions
      summary: Update workflow version
      description: >-
        Updates an existing workflow version. Accepts both public and secret
        keys.
      operationId: publicworkflowversions_updateWorkflowVersion_v1
      parameters:
        - name: versionId
          required: true
          in: path
          description: Workflow version identifier
          schema:
            example: wfv_abc123def456
            type: string
        - name: X-API-Key
          in: header
          description: Chave de API do tenant (publishable key ou secret key)
          required: true
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateWorkflowVersionDto'
      responses:
        '200':
          description: Workflow version updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowVersionResponseDto'
        '401':
          description: API key não fornecida, inválida ou não encontrada.
        '403':
          description: Tipo de chave não permitido para este endpoint.
        '404':
          description: Workflow version not found
      security:
        - ApiKeyAuth: []
      x-codeSamples:
        - lang: JavaScript
          source: >-
            import Triglit from 'triglit';


            const client = new Triglit({
              apiKey: 'My API Key',
            });


            const workflowVersion = await
            client.workflows.versions.update('wfv_abc123def456');


            console.log(workflowVersion.id);
components:
  schemas:
    UpdateWorkflowVersionDto:
      type: object
      properties:
        nodes:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                minLength: 1
              type:
                type: string
                minLength: 1
              version:
                type: string
                minLength: 1
              name:
                type: string
                minLength: 1
              description:
                type: string
              config:
                type: object
                additionalProperties:
                  nullable: true
              inputSchema:
                type: object
                additionalProperties:
                  nullable: true
              outputSchema:
                type: object
                additionalProperties:
                  nullable: true
              position:
                type: object
                properties:
                  x:
                    type: number
                  'y':
                    type: number
                required:
                  - x
                  - 'y'
            required:
              - id
              - type
              - version
              - name
              - config
              - inputSchema
              - outputSchema
              - position
        edges:
          type: array
          items:
            type: object
            properties:
              sourceNodeId:
                type: string
                minLength: 1
              targetNodeId:
                type: string
                minLength: 1
              sourceOutputKey:
                type: string
              targetInputKey:
                type: string
              condition:
                type: string
              label:
                type: string
            required:
              - sourceNodeId
              - targetNodeId
    WorkflowVersionResponseDto:
      type: object
      properties:
        id:
          type: string
          description: Unique workflow version identifier
          example: wfv_abc123def456
        workflowId:
          type: string
          description: Parent workflow identifier
          example: wf_abc123def456
        tenantId:
          type: string
          description: Tenant identifier
          example: tenant_123
        subTenantId:
          type: string
          description: Sub-tenant identifier
          example: sub_tenant_456
        version:
          type: number
          description: Version number
          example: 1
        nodes:
          description: Workflow nodes
          type: array
          items:
            $ref: '#/components/schemas/WorkflowNodeResponseDto'
        edges:
          description: Workflow edges
          type: array
          items:
            $ref: '#/components/schemas/WorkflowEdgeResponseDto'
        isActive:
          type: boolean
          description: Whether this version is active
          example: true
        createdAt:
          type: string
          description: Creation timestamp
          example: '2024-01-15T10:30:00.000Z'
        publishedAt:
          type: string
          description: Publication timestamp
          example: '2024-01-15T10:30:00.000Z'
      required:
        - id
        - workflowId
        - tenantId
        - version
        - nodes
        - edges
        - isActive
        - createdAt
    WorkflowNodeResponseDto:
      type: object
      properties:
        id:
          type: string
          description: Unique node identifier
          example: node_abc123def456
        type:
          type: string
          description: Node type
          example: trigger
          enum:
            - trigger
            - action
            - decision
        version:
          type: string
          description: Node version
          example: 1.0.0
        name:
          type: string
          description: Node display name
          example: Send Email
        description:
          type: string
          description: Node description
          example: Sends an email notification
        config:
          type: object
          description: Node configuration object
          example:
            recipientType: email
            template: welcome
          additionalProperties: true
        inputSchema:
          type: object
          description: Node input schema validation
          example:
            type: object
            properties:
              email:
                type: string
              subject:
                type: string
          additionalProperties: true
        outputSchema:
          type: object
          description: Node output schema definition
          example:
            type: object
            properties:
              success:
                type: boolean
              messageId:
                type: string
          additionalProperties: true
        canPause:
          type: boolean
          description: Whether this node can be paused during execution
          example: false
        position:
          description: Node position in the canvas
          allOf:
            - $ref: '#/components/schemas/PositionResponseDto'
      required:
        - id
        - type
        - version
        - name
        - config
        - inputSchema
        - outputSchema
        - canPause
        - position
    WorkflowEdgeResponseDto:
      type: object
      properties:
        id:
          type: string
          description: Unique edge identifier
          example: edge_abc123def456
        sourceNodeId:
          type: string
          description: Source node identifier
          example: node_abc123def456
        targetNodeId:
          type: string
          description: Target node identifier
          example: node_xyz789uvw123
        sourceOutputKey:
          type: string
          description: Output key from source node
          example: onSuccess
        targetInputKey:
          type: string
          description: Input key of target node
          example: input
        condition:
          type: string
          description: Conditional expression for edge execution
          example: result.success === true
        label:
          type: string
          description: Edge label for display purposes
          example: On Success
      required:
        - id
        - sourceNodeId
        - targetNodeId
    PositionResponseDto:
      type: object
      properties:
        x:
          type: number
          description: X coordinate position
          example: 100
        'y':
          type: number
          description: Y coordinate position
          example: 200
      required:
        - x
        - 'y'
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: Chave de API do tenant (publishable key ou secret key)

````