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

# Update agent

> Updates a **draft** agent (partial). A published agent returns `409` — clone it to change it. Scope `sessions:write`.



## OpenAPI

````yaml /api-reference/openapi.json put /agent/{agent_id}
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}:
    put:
      tags:
        - Agents
      summary: Update agent
      description: >-
        Updates a **draft** agent (partial). A published agent returns `409` —
        clone it to change it. Scope `sessions:write`.
      operationId: update_agent_ca_api_v0_agent__agent_id__put
      parameters:
        - name: agent_id
          in: path
          required: true
          schema:
            type: string
            title: Agent Id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                objective:
                  type: string
                instruction:
                  type: string
                task:
                  type: string
                faqs:
                  type: string
                sample_conversations:
                  type: string
                custom_variables:
                  type: array
                  items:
                    type: string
                config:
                  type: object
                tools:
                  type: array
                  items:
                    type: string
                questionnaire:
                  type: object
            example:
              instruction: Be warm and concise. Confirm the callback time.
      responses:
        '200':
          description: Updated agent
        '409':
          description: Agent is published and cannot be edited
          content:
            application/json:
              example:
                error:
                  code: conflict
                  message: >-
                    Published agents cannot be edited. Clone the agent to make
                    changes.
components:
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-KEY
    BearerAuth:
      type: http
      scheme: bearer

````