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

# Save Version

> Saves the stored draft as the next numbered version, an immutable snapshot. Saving a version never changes what production runs; deploy it with PUT /workflows/{id}/live. Needs edit access.

A workflow has two graphs. The draft (the test graph) is what you save with [Update Workflow](https://docs.lyzr.ai/enterprise/api/superflow/workflows/update.md) and what the Studio canvas runs. A version is an immutable snapshot of the draft, and the live version is the one production runs. This endpoint saves the current draft as the next version. To make it the live version, call [Deploy Version](https://docs.lyzr.ai/enterprise/api/superflow/versions/deploy.md).


## OpenAPI

````yaml openapi/superflow.yaml POST /workflows/{id}/publish
openapi: 3.0.3
info:
  title: Lyzr SuperFlow API
  version: '1.0'
  description: >-
    SuperFlow orchestration API covering workflow CRUD, versions and deployment,
    validation, the node catalog, the execution lifecycle (run, pause, resume,
    terminate, rerun), scheduling, and human-in-the-loop approvals. Agent CRUD
    and agent inference are served by the platform API and are not part of this
    surface.
servers:
  - url: https://inference.studio.lyzr.ai/api
security:
  - ApiKeyAuth: []
tags:
  - name: workflows
    description: >-
      Create, read, update, delete, validate, lock, and share workflow
      definitions.
  - name: workflow-versions
    description: Save the draft as a version and choose which version production runs.
  - name: node-catalog
    description: The contract for every node type, used to build and validate workflows.
  - name: workflow-execution
    description: Run workflows and control the execution lifecycle.
  - name: workflow-schedules
    description: Cron-driven recurring triggers for stored workflows.
  - name: approvals
    description: Human-in-the-loop approval requests raised by running workflows.
paths:
  /workflows/{id}/publish:
    post:
      tags:
        - workflow-versions
      summary: Save a version
      description: >-
        Saves the stored draft as the next numbered version, an immutable
        snapshot. Saving a version never changes what production runs; deploy it
        with PUT /workflows/{id}/live. Needs edit access.
      operationId: publishWorkflow
      parameters:
        - name: id
          in: path
          required: true
          description: Workflow ID
          schema:
            type: string
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PublishRequest'
      responses:
        '201':
          description: Created. Returns the new version.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WorkflowVersionSummary'
        '409':
          description: >-
            Conflict. Another publish for this workflow happened at the same
            moment; retry.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: >-
            Unprocessable. The draft could not start a run because it has no
            nodes, does not have exactly one trigger, uses an unknown node type,
            or connects from an output a node does not have.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '423':
          description: >-
            Locked. The owner has locked the workflow, so a shared editor cannot
            publish it.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    PublishRequest:
      type: object
      properties:
        message:
          type: string
          description: Optional note describing the version.
          example: Add approval step
    WorkflowVersionSummary:
      type: object
      properties:
        version_id:
          type: string
        number:
          type: integer
          example: 3
        message:
          type: string
          example: Add approval step
        created_by:
          type: string
        created_at:
          type: string
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: x-api-key
      description: >-
        Lyzr API key. Studio session keys (agk_, ags_) and durable sk- keys are
        accepted. Required on every endpoint except GET /node-types and a
        webhook-triggered execute that carries X-Webhook-Secret.

````

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