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

# Restore Workflow Definition

> Restore a saved workflow definition as the current published version.



## OpenAPI

````yaml https://platform.tracecat.com/api/openapi.json post /workspaces/{workspace_id}/workflows/{workflow_id}/definitions/{version}/restore
openapi: 3.1.0
info:
  title: Tracecat API
  summary: Tracecat API
  description: The open source AI automation platform for security teams and agents.
  termsOfService: >-
    https://docs.google.com/document/d/e/2PACX-1vQvDe3SoVAPoQc51MgfGCP71IqFYX_rMVEde8zC4qmBCec5f8PLKQRdxa6tsUABT8gWAR9J-EVs2CrQ/pub
  contact:
    name: Tracecat Founders
    email: founders@tracecat.com
  license:
    name: AGPL-3.0
    url: https://www.gnu.org/licenses/agpl-3.0.html
  version: '1'
servers:
  - url: /api
security: []
tags:
  - name: public
    description: Public facing endpoints
  - name: workflows
    description: Workflow management
  - name: actions
    description: Action management
  - name: triggers
    description: Workflow triggers
  - name: secrets
    description: Secret management
  - name: variables
    description: Workspace variable management
paths:
  /workspaces/{workspace_id}/workflows/{workflow_id}/definitions/{version}/restore:
    post:
      tags:
        - workflows
      summary: Restore Workflow Definition
      description: Restore a saved workflow definition as the current published version.
      operationId: workflows-restore_workflow_definition
      parameters:
        - name: version
          in: path
          required: true
          schema:
            type: integer
            minimum: 1
            title: Version
        - name: workspace_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
            title: Workspace Id
        - name: workflow_id
          in: path
          required: true
          schema:
            anyOf:
              - type: string
                pattern: wf_[0-9a-zA-Z]+
              - type: string
                pattern: wf-[0-9a-f]{32}
            title: Workflow Id
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowRead'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
      security:
        - APIKeyCookie: []
        - ServiceAccountApiKeyBearer: []
components:
  schemas:
    WorkflowRead:
      properties:
        id:
          type: string
          pattern: wf_[0-9a-zA-Z]+
          title: Id
        title:
          type: string
          title: Title
        description:
          type: string
          title: Description
        status:
          type: string
          title: Status
        actions:
          additionalProperties:
            $ref: '#/components/schemas/ActionRead'
          type: object
          title: Actions
        workspace_id:
          type: string
          format: uuid
          title: Workspace Id
        version:
          anyOf:
            - type: integer
            - type: 'null'
          title: Version
        webhook:
          $ref: '#/components/schemas/WebhookRead'
        schedules:
          items:
            $ref: '#/components/schemas/ScheduleRead'
          type: array
          title: Schedules
        entrypoint:
          anyOf:
            - type: string
            - type: 'null'
          title: Entrypoint
        expects:
          anyOf:
            - additionalProperties:
                $ref: '#/components/schemas/ExpectedField-Output'
              type: object
            - type: 'null'
          title: Expects
        expects_schema:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Expects Schema
        returns:
          title: Returns
        config:
          anyOf:
            - $ref: '#/components/schemas/DSLConfig-Output'
            - type: 'null'
        alias:
          anyOf:
            - type: string
            - type: 'null'
          title: Alias
        git_sync_branch:
          anyOf:
            - type: string
            - type: 'null'
          title: Git Sync Branch
        error_handler:
          anyOf:
            - type: string
            - type: 'null'
          title: Error Handler
        folder_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Folder Id
        trigger_position_x:
          type: number
          title: Trigger Position X
          default: 0
        trigger_position_y:
          type: number
          title: Trigger Position Y
          default: 0
        graph_version:
          type: integer
          title: Graph Version
          default: 1
      type: object
      required:
        - id
        - title
        - description
        - status
        - actions
        - workspace_id
        - webhook
        - schedules
        - entrypoint
        - returns
        - config
      title: WorkflowRead
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ActionRead:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        type:
          type: string
          title: Type
        title:
          type: string
          title: Title
        description:
          type: string
          title: Description
        status:
          type: string
          title: Status
        inputs:
          type: string
          title: Inputs
        control_flow:
          $ref: '#/components/schemas/ActionControlFlow'
        is_interactive:
          type: boolean
          title: Is Interactive
        interaction:
          anyOf:
            - oneOf:
                - $ref: '#/components/schemas/ResponseInteraction'
                - $ref: '#/components/schemas/ApprovalInteraction'
              description: An interaction configuration
              discriminator:
                propertyName: type
                mapping:
                  approval:
                    $ref: '#/components/schemas/ApprovalInteraction'
                  response:
                    $ref: '#/components/schemas/ResponseInteraction'
            - type: 'null'
          title: Interaction
        position_x:
          type: number
          title: Position X
          default: 0
        position_y:
          type: number
          title: Position Y
          default: 0
        upstream_edges:
          items:
            $ref: '#/components/schemas/ActionEdge'
          type: array
          title: Upstream Edges
        ref:
          type: string
          title: Ref
          readOnly: true
      type: object
      required:
        - id
        - type
        - title
        - description
        - status
        - inputs
        - is_interactive
        - ref
      title: ActionRead
    WebhookRead:
      properties:
        id:
          type: string
          format: uuid
          title: Id
        secret:
          type: string
          title: Secret
        status:
          $ref: '#/components/schemas/WebhookStatus'
        entrypoint_ref:
          anyOf:
            - type: string
            - type: 'null'
          title: Entrypoint Ref
        allowlisted_cidrs:
          items:
            type: string
          type: array
          title: Allowlisted Cidrs
        filters:
          additionalProperties: true
          type: object
          title: Filters
        methods:
          items:
            $ref: '#/components/schemas/WebhookMethod'
          type: array
          title: Methods
          description: Methods to allow
        include_headers:
          type: boolean
          title: Include Headers
          default: false
        workflow_id:
          type: string
          title: Workflow Id
        url:
          type: string
          title: Url
        api_key:
          anyOf:
            - $ref: '#/components/schemas/WebhookApiKeyRead'
            - type: 'null'
      type: object
      required:
        - id
        - secret
        - status
        - workflow_id
        - url
      title: WebhookRead
    ScheduleRead:
      properties:
        id:
          type: string
          title: Id
        workspace_id:
          type: string
          format: uuid
          title: Workspace Id
        created_at:
          type: string
          format: date-time
          title: Created At
        updated_at:
          type: string
          format: date-time
          title: Updated At
        workflow_id:
          type: string
          title: Workflow Id
        inputs:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Inputs
        cron:
          anyOf:
            - type: string
            - type: 'null'
          title: Cron
        every:
          anyOf:
            - type: string
              format: duration
            - type: 'null'
          title: Every
        offset:
          anyOf:
            - type: string
              format: duration
            - type: 'null'
          title: Offset
        start_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Start At
        end_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: End At
        timeout:
          anyOf:
            - type: number
            - type: 'null'
          title: Timeout
        status:
          type: string
          enum:
            - online
            - offline
          title: Status
      type: object
      required:
        - id
        - workspace_id
        - created_at
        - updated_at
        - workflow_id
        - status
      title: ScheduleRead
    ExpectedField-Output:
      additionalProperties: true
      type: object
    DSLConfig-Output:
      properties:
        environment:
          type: string
          title: Environment
          description: >-
            The workflow's target execution environment. This is used to isolate
            secrets across different environments.If not provided, the default
            environment (default) is used.
          default: default
        timeout:
          type: number
          title: Timeout
          description: >-
            Workflow timeout in seconds. If set to 0, the workflow has no
            timeout.
          default: 0
      type: object
      title: DSLConfig
      description: |-
        This is the runtime configuration for the workflow.

        Activities don't need access to this.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    ActionControlFlow:
      properties:
        run_if:
          anyOf:
            - type: string
              maxLength: 1000
            - type: 'null'
          title: Run If
        for_each:
          anyOf:
            - anyOf:
                - type: string
                - items:
                    type: string
                  type: array
              maxLength: 1000
            - type: 'null'
          title: For Each
        join_strategy:
          $ref: '#/components/schemas/JoinStrategy'
          default: all
        retry_policy:
          $ref: '#/components/schemas/ActionRetryPolicy'
        start_delay:
          type: number
          title: Start Delay
          description: >-
            Delay before starting the action in seconds. If `wait_until` is also
            provided, the `wait_until` timer will take precedence.
          default: 0
        wait_until:
          anyOf:
            - type: string
            - type: 'null'
          title: Wait Until
          description: >-
            Wait until a specific date and time before starting. Overrides
            `start_delay` if both are provided.
        environment:
          anyOf:
            - type: string
            - type: 'null'
          title: Environment
          description: Override environment for this action's execution
        mask_output:
          type: boolean
          title: Mask Output
          description: >-
            If true, redact this action's result in workflow execution API
            responses while preserving internal workflow data flow between
            actions.
          default: false
      type: object
      title: ActionControlFlow
    ResponseInteraction:
      properties:
        type:
          type: string
          const: response
          title: Type
        timeout:
          anyOf:
            - type: number
            - type: 'null'
          title: Timeout
          description: The timeout for the interaction in seconds.
      type: object
      required:
        - type
      title: ResponseInteraction
      description: Configuration for a response interaction.
    ApprovalInteraction:
      properties:
        type:
          type: string
          const: approval
          title: Type
        timeout:
          anyOf:
            - type: number
            - type: 'null'
          title: Timeout
          description: The timeout for the interaction in seconds.
        required_approvers:
          type: integer
          title: Required Approvers
          description: Number of approvers required before the action can proceed.
          default: 1
        approver_groups:
          items:
            type: string
          type: array
          title: Approver Groups
          description: List of groups that are allowed to approve this action.
        message:
          type: string
          title: Message
          description: Custom message to display to approvers.
          default: ''
        approve_if:
          anyOf:
            - type: string
            - type: 'null'
          title: Approve If
          description: Condition to approve the action.
      type: object
      required:
        - type
      title: ApprovalInteraction
      description: Configuration for an approval interaction.
    ActionEdge:
      properties:
        source_id:
          type: string
          title: Source Id
        source_type:
          type: string
          enum:
            - trigger
            - udf
          title: Source Type
        source_handle:
          type: string
          enum:
            - success
            - error
          title: Source Handle
      type: object
      required:
        - source_id
        - source_type
      title: ActionEdge
      description: |-
        Represents an incoming edge to an action.

        Stored in Action.upstream_edges to represent incoming connections.
    WebhookStatus:
      type: string
      enum:
        - online
        - offline
    WebhookMethod:
      type: string
      enum:
        - GET
        - POST
    WebhookApiKeyRead:
      properties:
        preview:
          type: string
          title: Preview
        created_at:
          type: string
          format: date-time
          title: Created At
        last_used_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Last Used At
        revoked_at:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: Revoked At
        is_active:
          type: boolean
          title: Is Active
          default: false
      type: object
      required:
        - preview
        - created_at
      title: WebhookApiKeyRead
    JoinStrategy:
      type: string
      enum:
        - any
        - all
      title: JoinStrategy
    ActionRetryPolicy:
      properties:
        max_attempts:
          type: integer
          title: Max Attempts
          description: >-
            Total number of execution attempts. 0 means unlimited, 1 means no
            retries.
          default: 1
        timeout:
          type: integer
          title: Timeout
          description: Timeout for the action in seconds.
          default: 300
        retry_until:
          anyOf:
            - type: string
            - type: 'null'
          title: Retry Until
          description: Retry until a specific condition is met.
      type: object
      title: ActionRetryPolicy
  securitySchemes:
    APIKeyCookie:
      type: apiKey
      in: cookie
      name: fastapiusersauth
    ServiceAccountApiKeyBearer:
      type: http
      description: Tracecat service account API key.
      scheme: bearer

````