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

# Publish agent

> Locks the config and makes the agent bindable by campaigns. One-way. Scope `sessions:write`.



## OpenAPI

````yaml /api-reference/openapi.json post /agent/{agent_id}/publish
openapi: 3.1.0
info:
  title: Lehar API
  version: v0
  description: >-
    Customer-facing REST API for the Lehar voice-AI platform. Platform-admin
    endpoints are intentionally excluded from this reference. Regenerate with
    `npm run sync:openapi`.
servers:
  - url: https://api.lehar.ai/ca/api/v0
security:
  - ApiKeyAuth: []
  - BearerAuth: []
paths:
  /agent/{agent_id}/publish:
    post:
      tags:
        - Agents
      summary: Publish agent
      description: >-
        Locks the config and makes the agent bindable by campaigns. One-way.
        Scope `sessions:write`.
      operationId: publish_agent_ca_api_v0_agent__agent_id__publish_post
      parameters:
        - name: agent_id
          in: path
          required: true
          schema:
            type: string
            title: Agent Id
      responses:
        '200':
          description: Published agent
          content:
            application/json:
              example:
                id: agent_sales_hi
                name: Sales Agent
                channel: voice
                status: published
                published_at: '2026-05-22T11:00:00Z'
                created_at: '2026-05-22T10:00:00Z'
                updated_at: '2026-05-22T11:00:00Z'
        '409':
          description: Agent is not a draft (already published)
          content:
            application/json:
              example:
                error:
                  code: conflict
                  message: Only draft agents can be published
        '422':
          description: Agent is missing a required field (e.g. `name`)
          content:
            application/json:
              example:
                error:
                  code: unprocessable
                  message: Agent must have a name before it can be published
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
    BearerAuth:
      type: http
      scheme: bearer

````