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

> Blocks if the draft config is pristine (== latest published, 422), then creates a new numbered version copying the draft config. Returns the new version.



## OpenAPI

````yaml /api-reference/openapi.json post /v1/agents/{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/agents/{id}/publish:
    post:
      tags:
        - Agents
      summary: Publish agent
      description: >-
        Blocks if the draft config is pristine (== latest published, 422), then
        creates a new numbered version copying the draft config. Returns the new
        version.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: string
            example: 6f1c0f4e-2b7a-4a51-9a2f-0c9d1b3e5a10
      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
                      agent_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.
                      instructions:
                        type: array
                        description: >-
                          The system prompt, as ordered blocks. Entries are
                          `{type:"text"}`, `{type:"prompt_block"}` or
                          `{type:"prompt_block_ref"}`. On a published version
                          each ref also carries the `versionId` it was frozen to
                          at publish time; on the draft that pin is absent.
                        items:
                          type: object
                      model_slug:
                        type: string
                        nullable: true
                        description: >-
                          The concrete model this version runs. Ignored when
                          `policy_slug` is set.
                      policy_slug:
                        type: string
                        nullable: true
                        description: >-
                          Routing policy to run instead of a fixed model.
                          Overrides `model_slug`.
                      model_options:
                        type: object
                        nullable: true
                        description: >-
                          Model-level options passed to the router (reasoning
                          effort, native options).
                      model_settings:
                        type: object
                        nullable: true
                        description: 'Generation settings: temperature, maxTokens, etc.'
                      max_steps:
                        type: integer
                        nullable: true
                      agentTools:
                        type: array
                        description: Tool references this version can call.
                        items:
                          type: object
                      workflows:
                        type: array
                        description: Attached workflows.
                        items:
                          type: object
                      agents:
                        type: array
                        description: >-
                          Subagents this version can delegate to, as `[{ agentId
                          }]`.
                        items:
                          type: object
                      scorers:
                        type: array
                        items:
                          type: object
                      memory:
                        type: object
                        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, and prompt-block references are now
                      pinned to the block versions live at this moment.
                      Publishing does NOT activate it — POST
                      /v1/agents/{id}/activate does.
        '404':
          description: Not found
        '422':
          description: Nothing to publish
        '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.

````