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

# Publish an agent version

> Requires `agents:write`.



## OpenAPI

````yaml /api-reference/openapi.yaml post /versions/{version_id}/publish
openapi: 3.0.3
info:
  title: Guild Public API
  version: 1.0.0
  description: >-
    The Guild public API, served at https://api.guild.ai/v1 and authenticated
    with account API keys (HTTP Basic, key id as the username and the secret as
    the password). See https://docs.guild.ai/api-reference/introduction for
    scopes and behavior. A session-events websocket also exists at
    wss://api.guild.ai/v1/sessions/{session_id}/events/ws with the same Basic
    auth on the handshake; OpenAPI cannot describe websockets, so it is not
    listed in paths.
servers:
  - url: https://api.guild.ai/v1
    description: Production
security: []
tags:
  - name: accounts
  - name: agents
  - name: sessions
  - name: skills
  - name: workspaces
paths:
  /versions/{version_id}/publish:
    post:
      tags:
        - agents
      summary: Publish an agent version
      description: Requires `agents:write`.
      operationId: publish_agent_version
      parameters:
        - name: version_id
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        required: false
        content:
          application/json:
            schema:
              properties:
                force_publish:
                  default: false
                  title: Force Publish
                  type: boolean
              title: PublishAgentVersionInput
              type: object
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentVersion'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - apiKey: []
components:
  schemas:
    AgentVersion:
      oneOf:
        - $ref: '#/components/schemas/AgentVersionCommitted'
        - $ref: '#/components/schemas/AgentVersionEphemeral'
    ErrorResponse:
      type: object
      properties:
        error:
          type: string
        message:
          type: string
    AgentVersionCommitted:
      type: object
      properties:
        id:
          type: string
          format: uuid
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        agent_id:
          type: string
          format: uuid
        author_id:
          type: string
          format: uuid
        validation_status:
          type: string
          enum:
            - SKIPPED
            - PENDING
            - RUNNING
            - PASSED
            - FAILED
        dependencies:
          type: object
          nullable: true
          description: npm package.json dependencies
        description:
          type: string
          nullable: true
          description: Description for the agent extracted from the agent code.
        env_references:
          type: array
          items: {}
          nullable: true
          description: >-
            Workspace variable keys referenced as {{env.KEY}} in the version's
            prompt, extracted at build time
        input_schema:
          type: object
          nullable: true
          description: JSON Schema from Zod input
        output_schema:
          type: object
          nullable: true
          description: JSON Schema from Zod output
        published_at:
          type: string
          format: date-time
          nullable: true
        publishing_started_at:
          type: string
          format: date-time
          nullable: true
        raw_tools:
          type: array
          items: {}
          nullable: true
          description: >-
            Structured per-tool metadata. Each entry is a tool object
            discriminated by toolType (integration, legacy, agent, builtin).
        runtime_environment_id:
          type: string
          format: uuid
          nullable: true
        sha:
          type: string
          maxLength: 40
          nullable: true
          description: >-
            Git commit SHA (40-character hexadecimal). For agents: set on
            version creation. For integrations: set after code is stored in
            GitHub.
        summary:
          type: string
          maxLength: 500
          nullable: true
          description: >-
            Commit message summary. For agents: set on version creation. For
            integrations: set after code is stored in GitHub.
        tools:
          type: array
          items: {}
          nullable: true
        version_number:
          type: string
          maxLength: 100
          nullable: true
          description: >-
            The semantic version number (i.e., MAJOR.MINOR.PATCH) of this
            version
        agent: {}
        author: {}
        status: {}
        version_type: {}
    AgentVersionEphemeral:
      type: object
      properties:
        id:
          type: string
          format: uuid
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
        agent_id:
          type: string
          format: uuid
        author_id:
          type: string
          format: uuid
        files:
          type: object
          description: >-
            The files for this version and their content. Format: {[key:
            filename]: content}
        validation_status:
          type: string
          enum:
            - SKIPPED
            - PENDING
            - RUNNING
            - PASSED
            - FAILED
        dependencies:
          type: object
          nullable: true
          description: npm package.json dependencies
        description:
          type: string
          nullable: true
          description: Description for the agent extracted from the agent code.
        env_references:
          type: array
          items: {}
          nullable: true
          description: >-
            Workspace variable keys referenced as {{env.KEY}} in the version's
            prompt, extracted at build time
        input_schema:
          type: object
          nullable: true
          description: JSON Schema from Zod input
        output_schema:
          type: object
          nullable: true
          description: JSON Schema from Zod output
        raw_tools:
          type: array
          items: {}
          nullable: true
          description: >-
            Structured per-tool metadata. Each entry is a tool object
            discriminated by toolType (integration, legacy, agent, builtin).
        runtime_environment_id:
          type: string
          format: uuid
          nullable: true
        tools:
          type: array
          items: {}
          nullable: true
        version_number:
          type: string
          maxLength: 100
          nullable: true
          description: >-
            The semantic version number (i.e., MAJOR.MINOR.PATCH) of this
            version
        agent: {}
        author: {}
        published_at: {}
        publishing_started_at: {}
        sha: {}
        status: {}
        summary: {}
        version_type: {}
  securitySchemes:
    apiKey:
      type: http
      scheme: basic
      description: 'Account API key: key id as the username, secret as the password.'

````