> ## 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.

# Save workflow draft

> Partial save of the draft definition/schemas. Runs structural validation only — work-in-progress graphs are allowed. `output_schema` is optional and NOT enforced at run time — leave it unset unless you need a declared boundary contract; the actual output shape is whatever the last flow position returns (see the step-level schemas: tool `outputSchema`, agent step `output_schema`).



## OpenAPI

````yaml /api-reference/openapi.json patch /v1/workflows/{id}/draft
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}/draft:
    patch:
      tags:
        - Workflows
      summary: Save workflow draft
      description: >-
        Partial save of the draft definition/schemas. Runs structural validation
        only — work-in-progress graphs are allowed. `output_schema` is optional
        and NOT enforced at run time — leave it unset unless you need a declared
        boundary contract; the actual output shape is whatever the last flow
        position returns (see the step-level schemas: tool `outputSchema`, agent
        step `output_schema`).
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            example: 4c2f9e18-7a63-4d05-b1e8-93a7c0f2d641
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                definition:
                  type: object
                  description: >-
                    The steps + flow graph. Validate it against GET
                    /v1/workflows/definition-schema. Its optional top-level
                    `output_text` is the result-message template posted after a
                    successful run — {{ $.input.<field> }} / {{
                    $.steps.<id>.<path> }} placeholders resolve against the run;
                    omitted, the message is a completion notice with the output
                    attached.
                  example:
                    steps:
                      classify:
                        kind: agent
                        config:
                          prompt: Classify the request.
                          model_slug: openai/gpt-4o-mini
                    output_text: Classified as {{ $.steps.classify.category }}.
                input_schema:
                  type: object
                  example:
                    type: object
                    properties:
                      text:
                        type: string
                    required:
                      - text
                output_schema:
                  type: object
                  example:
                    type: object
                    properties:
                      category:
                        type: string
      responses:
        '200':
          description: The saved draft
          content:
            application/json:
              schema:
                type: object
                properties:
                  draft:
                    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 whole draft after the merge, not just the fields you
                      sent. `rev` has been bumped by the DB. Saving does not
                      publish: the active version keeps running until POST
                      /v1/workflows/{id}/publish and /activate.
        '400':
          description: Invalid body / structural error
        '404':
          description: Not found
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: >-
        Organization API key, generated in studio.sidenet.ai. Backend only —
        never in a browser.

````