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

# Publish workflow

> Strict gate: blocks if the draft is pristine (== latest published, 422), runs full semantic validation + a trial build, then creates a new numbered version copying the draft. Returns the new version with computed `changed_fields`.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/workflows/{id}/publish
openapi: 3.1.0
info:
  title: Sidenet API
  version: 1.0.0
  description: >-
    Sidenet HTTP endpoints exposed by the Sidenet Studio. All routes require an
    api key that can be generated through the studio in studio.sidenet.ai.
servers:
  - url: https://api.sidenet.ai
security:
  - bearerAuth: []
paths:
  /v1/workflows/{id}/publish:
    post:
      tags:
        - Workflows
      summary: Publish workflow
      description: >-
        Strict gate: blocks if the draft is pristine (== latest published, 422),
        runs full semantic validation + a trial build, then creates a new
        numbered version copying the draft. Returns the new version with
        computed `changed_fields`.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            example: 4c2f9e18-7a63-4d05-b1e8-93a7c0f2d641
      requestBody:
        content:
          application/json:
            schema:
              type: object
              properties:
                change_message:
                  type: string
                  example: Route refunds over $500 to a human
      responses:
        '201':
          description: The new immutable version, copied from the draft
          content:
            application/json:
              schema:
                type: object
                properties:
                  version:
                    type: object
                    properties:
                      id:
                        type: string
                        format: uuid
                      workflow_id:
                        type: string
                        format: uuid
                      version_number:
                        type: integer
                        description: >-
                          0 is the mutable draft; every published version is 1
                          or above.
                      rev:
                        type: integer
                        description: >-
                          Server-owned change counter, bumped on every save of
                          the draft. Read-only — useful to tell whether a draft
                          moved since you last read it.
                      definition:
                        type: object
                        description: >-
                          The steps + flow graph, plus the optional
                          `output_text` result-message template. Its JSON Schema
                          — the same one the builder UI validates against — is
                          served by GET /v1/workflows/definition-schema.
                      input_schema:
                        type: object
                        nullable: true
                        description: >-
                          JSON Schema for the run input. Null means
                          unconstrained.
                      output_schema:
                        type: object
                        nullable: true
                        description: >-
                          JSON Schema for the run output. Null means
                          unconstrained.
                      change_message:
                        type: string
                        nullable: true
                      created_at:
                        type: string
                        format: date-time
                      updated_at:
                        type: string
                        format: date-time
                    description: >-
                      The published version. `version_number` is 1 higher than
                      the last publish. Publishing does NOT activate it — POST
                      /v1/workflows/{id}/activate does.
                  changed_fields:
                    type: array
                    description: >-
                      Which of `definition`, `input_schema` and `output_schema`
                      differ from the previous published version. All three on a
                      first publish.
                    items:
                      type: string
        '404':
          description: Not found
        '422':
          description: Nothing to publish or invalid definition
        '500':
          description: Publish failed
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Organization API key, generated in studio.sidenet.ai. Backend only —
        never in a browser.

````