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

# Publish an agent

> Make the draft the published version of the agent. Copies the draft settings (including actions and skills) over the published version, so the Completion API uses them by default. If the draft has `embedEnabled: true`, publishing also makes the external embed widget live; this requires a non-empty `embedOptions.domainWhitelist`. Who can see and use the agent in-app is controlled separately via sharing in the nuwacom app. Idempotent: publishing an already published agent without draft changes is a no-op.



## OpenAPI

````yaml /openapi.yaml post /api/v1/spaces/{spaceId}/agents/{agentId}/publish
openapi: 3.1.0
info:
  title: Nuwacom API
  description: API for Nuwacom application
  version: 1.0.0
servers:
  - url: https://{customer-tenant}.nuwacom.ai
    description: Nuwacom API
security:
  - bearerAuth: []
paths:
  /api/v1/spaces/{spaceId}/agents/{agentId}/publish:
    post:
      tags:
        - Agents
      summary: Publish an agent
      description: >-
        Make the draft the published version of the agent. Copies the draft
        settings (including actions and skills) over the published version, so
        the Completion API uses them by default. If the draft has `embedEnabled:
        true`, publishing also makes the external embed widget live; this
        requires a non-empty `embedOptions.domainWhitelist`. Who can see and use
        the agent in-app is controlled separately via sharing in the nuwacom
        app. Idempotent: publishing an already published agent without draft
        changes is a no-op.
      operationId: postApiV1SpacesBySpaceIdAgentsByAgentIdPublish
      parameters:
        - in: path
          name: spaceId
          schema:
            anyOf:
              - type: string
                minLength: 2
                maxLength: 6
              - type: string
                minLength: 21
                maxLength: 21
            description: ID of the space the agent belongs to.
          required: true
        - in: path
          name: agentId
          schema:
            type: string
            format: uuid
            description: Unique ID of the agent.
          required: true
      responses:
        '200':
          description: Agent published successfully.
          content:
            application/json:
              schema:
                type: object
                properties:
                  id:
                    type: string
                    format: uuid
                    description: >-
                      Unique ID of the agent. Use it with the Completion API
                      (`agentId` option) to chat with the agent.
                  spaceId:
                    anyOf:
                      - type: string
                        minLength: 2
                        maxLength: 6
                      - type: string
                        minLength: 21
                        maxLength: 21
                    description: ID of the space the agent belongs to.
                  name:
                    type: string
                  description:
                    type: string
                  systemInstruction:
                    anyOf:
                      - type: string
                        nullable: true
                  conversationStarters:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          format: uuid
                          description: >-
                            Unique ID of the conversation starter. Generated
                            server-side when omitted.
                        text:
                          type: string
                          description: >-
                            The prompt text sent to the agent when the starter
                            is clicked.
                        label:
                          type: string
                          description: >-
                            Short display label. Falls back to the text when
                            omitted.
                        type:
                          enum:
                            - prompt
                            - text
                          description: Kind of starter. Defaults to "text".
                          default: text
                      required:
                        - text
                  welcomeMessage:
                    anyOf:
                      - type: object
                        additionalProperties: {}
                        nullable: true
                  model:
                    anyOf:
                      - type: string
                        nullable: true
                  temperature:
                    anyOf:
                      - type: number
                        nullable: true
                  attachmentIds:
                    type: array
                    items:
                      type: string
                      format: uuid
                  folderIds:
                    type: array
                    items:
                      type: string
                      format: uuid
                  contentIds:
                    type: array
                    items:
                      type: string
                      format: uuid
                  allowUploads:
                    type: boolean
                  allowUrls:
                    type: boolean
                  enableFollowUpMessages:
                    type: boolean
                  categoryId:
                    anyOf:
                      - type: number
                        nullable: true
                  voiceId:
                    anyOf:
                      - type: string
                        nullable: true
                  appEnabled:
                    type: boolean
                  embedEnabled:
                    type: boolean
                    description: >-
                      Whether the agent is published as an external, embeddable
                      chat widget.
                  embedId:
                    anyOf:
                      - type: string
                        nullable: true
                    description: Identifier used to embed the agent as an external widget.
                  embedOptions:
                    type: object
                    properties:
                      domainWhitelist:
                        type: array
                        items:
                          type: string
                      showSources:
                        type: boolean
                      allowVoiceInput:
                        type: boolean
                      allowFileUpload:
                        type: boolean
                      themeMode:
                        enum:
                          - dark
                          - light
                      lightTheme:
                        type: object
                        properties:
                          backgroundColor:
                            anyOf:
                              - type: object
                                properties:
                                  h:
                                    type: number
                                  s:
                                    type: number
                                  v:
                                    type: number
                                  a:
                                    type: number
                                required:
                                  - h
                                  - s
                                  - v
                                  - a
                                nullable: true
                          primaryColor:
                            anyOf:
                              - type: object
                                properties:
                                  h:
                                    type: number
                                  s:
                                    type: number
                                  v:
                                    type: number
                                  a:
                                    type: number
                                required:
                                  - h
                                  - s
                                  - v
                                  - a
                                nullable: true
                        required: []
                      darkTheme:
                        type: object
                        properties:
                          backgroundColor:
                            anyOf:
                              - type: object
                                properties:
                                  h:
                                    type: number
                                  s:
                                    type: number
                                  v:
                                    type: number
                                  a:
                                    type: number
                                required:
                                  - h
                                  - s
                                  - v
                                  - a
                                nullable: true
                          primaryColor:
                            anyOf:
                              - type: object
                                properties:
                                  h:
                                    type: number
                                  s:
                                    type: number
                                  v:
                                    type: number
                                  a:
                                    type: number
                                required:
                                  - h
                                  - s
                                  - v
                                  - a
                                nullable: true
                        required: []
                    required: []
                    description: External embed widget options (draft state).
                  actions:
                    type: array
                    items:
                      type: object
                      properties:
                        id:
                          type: string
                          format: uuid
                          description: Unique ID of the action.
                        integration:
                          type: string
                        key:
                          type: string
                        requiresConfirmation:
                          type: boolean
                        defaultValues:
                          type: object
                          additionalProperties: {}
                        integrationId:
                          anyOf:
                            - type: string
                              nullable: true
                        mcpClientId:
                          anyOf:
                            - type: string
                              nullable: true
                      required:
                        - id
                        - integration
                        - key
                        - requiresConfirmation
                        - defaultValues
                        - integrationId
                        - mcpClientId
                    description: Actions/tools configured on the agent (draft state).
                  isSystemAgent:
                    type: boolean
                    description: >-
                      true for built-in nuwacom system agents (cannot be updated
                      or deleted).
                  published:
                    type: boolean
                    description: >-
                      Whether a published version of the agent exists.
                      Publishing happens in the nuwacom app.
                  hasUnpublishedChanges:
                    type: boolean
                    description: >-
                      true when the draft differs from the published version (or
                      nothing has been published yet).
                  createdAt:
                    type: string
                  updatedAt:
                    type: string
                required:
                  - id
                  - spaceId
                  - name
                  - description
                  - systemInstruction
                  - conversationStarters
                  - welcomeMessage
                  - model
                  - temperature
                  - attachmentIds
                  - folderIds
                  - contentIds
                  - allowUploads
                  - allowUrls
                  - enableFollowUpMessages
                  - categoryId
                  - voiceId
                  - appEnabled
                  - embedEnabled
                  - embedId
                  - embedOptions
                  - actions
                  - isSystemAgent
                  - published
                  - hasUnpublishedChanges
                  - createdAt
                  - updatedAt
        '400':
          description: The agent is embed-enabled but has no embedOptions.domainWhitelist.
        '403':
          description: >-
            The caller lacks permission to publish agents in this space, or the
            agent is a system agent.
        '404':
          description: Agent not found in the provided space.
        '409':
          description: The agent has no draft to publish.
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````