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

# Update an agent

> Partially updates an agent. Only the fields you include are modified.

Set `knowledge_base_id` to `null` to detach the current knowledge base.



## OpenAPI

````yaml patch /v2/agents/{uid}
openapi: 3.0.3
info:
  title: OpenMic External API v2
  version: '2.0'
  description: >-
    The OpenMic External API (v2) provides programmatic access to agents, calls,

    phone numbers, tools, contact lists, campaigns, and voices.


    ## Authentication

    All endpoints require an API key passed as a Bearer token in the

    `Authorization` header:

    ```

    Authorization: Bearer <your_api_key>

    ```


    ## Rate Limiting

    Most endpoints are limited to **100 requests per minute** per organization.

    The `POST /create-phone-call` endpoint has a stricter limit of **5 requests
    per minute**.
  contact:
    name: OpenMic Support
servers:
  - url: https://api.openmic.ai
    description: Production
security:
  - bearerAuth: []
tags:
  - name: Auth
    description: Verify API key identity.
  - name: Agents
    description: Create and manage voice AI agents.
  - name: Calls
    description: Initiate and track phone calls.
  - name: Phone Numbers
    description: Manage phone numbers and agent assignments.
  - name: Tools
    description: Manage agent tools (API requests, call transfers, etc.).
  - name: Contact Lists
    description: Manage contact lists and individual contacts.
  - name: Campaigns
    description: Create and manage outbound dialing campaigns.
  - name: Voices
    description: Browse available voices for agents.
  - name: SMS
    description: Send SMS messages.
paths:
  /v2/agents/{uid}:
    parameters:
      - name: uid
        in: path
        required: true
        schema:
          type: string
        description: The agent UID.
    patch:
      tags:
        - Agents
      summary: Update an agent
      description: |-
        Partially updates an agent. Only the fields you include are modified.

        Set `knowledge_base_id` to `null` to detach the current knowledge base.
      operationId: updateAgent
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateAgentRequest'
            example:
              name: Updated Support Agent
              call_settings:
                max_call_duration: 15
      responses:
        '200':
          description: Updated agent.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AgentResponse'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '404':
          $ref: '#/components/responses/NotFound'
        '429':
          $ref: '#/components/responses/TooManyRequests'
        '500':
          $ref: '#/components/responses/InternalServerError'
components:
  schemas:
    UpdateAgentRequest:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 255
        prompt:
          type: string
          minLength: 1
        first_message:
          type: string
          description: 'Cannot be combined with `auto_first_message: true`.'
        auto_first_message:
          type: boolean
        knowledge_base_id:
          type: integer
          nullable: true
          description: Set to `null` to detach the current knowledge base.
        voice_provider:
          type: string
          enum:
            - OpenAI
            - ElevenLabs
            - Deepgram
            - Cartesia
        voice:
          type: string
        voice_model:
          type: string
        voice_speed:
          type: number
        llm_model_name:
          type: string
        llm_model_temperature:
          type: number
          minimum: 0
          maximum: 2
        llm_max_tokens:
          type: integer
        stt_provider:
          type: string
          enum:
            - Deepgram
        stt_model:
          type: string
        auto_end_call:
          type: boolean
        call_settings:
          $ref: '#/components/schemas/CallSettings'
        advanced_settings:
          $ref: '#/components/schemas/AdvancedSettings'
        boosted_keywords:
          type: array
          items:
            type: string
          maxItems: 30
        selected_jargons:
          type: array
          items:
            type: string
        post_call_settings:
          $ref: '#/components/schemas/PostCallSettings'
    AgentResponse:
      type: object
      required:
        - uid
        - name
        - prompt
        - created_at
        - updated_at
      properties:
        uid:
          type: string
          description: Unique agent identifier (slug/UUID).
        name:
          type: string
        prompt:
          type: string
        first_message:
          type: string
        auto_first_message:
          type: boolean
        knowledge_base_id:
          type: integer
        voice_provider:
          type: string
          enum:
            - OpenAI
            - ElevenLabs
            - Deepgram
            - Cartesia
        voice:
          type: string
        voice_model:
          type: string
        voice_speed:
          type: number
        llm_model_name:
          type: string
        llm_model_temperature:
          type: number
          minimum: 0
          maximum: 2
        llm_max_tokens:
          type: integer
        stt_provider:
          type: string
          enum:
            - Deepgram
        stt_model:
          type: string
        auto_end_call:
          type: boolean
        call_settings:
          $ref: '#/components/schemas/CallSettings'
        advanced_settings:
          $ref: '#/components/schemas/AdvancedSettings'
        boosted_keywords:
          type: array
          items:
            type: string
          maxItems: 30
        selected_jargons:
          type: array
          items:
            type: string
        post_call_settings:
          $ref: '#/components/schemas/PostCallSettings'
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    CallSettings:
      type: object
      properties:
        max_call_duration:
          type: integer
          minimum: 2
          maximum: 30
          description: Maximum call duration in minutes.
        silence_timeout:
          type: integer
          minimum: 5
          maximum: 45
          description: Seconds of silence before timing out.
        silence_timeout_max_retries:
          type: integer
          minimum: 1
          maximum: 5
        silence_timeout_message:
          type: string
        call_recording_enabled:
          type: boolean
        voicemail_detection_enabled:
          type: boolean
        voicemail_action:
          type: string
          enum:
            - hangup
            - leave_message
        voicemail_message_type:
          type: string
          enum:
            - prompt
            - static
        voicemail_message:
          type: string
        voicemail_post_detection_delay:
          type: integer
          minimum: 0
          maximum: 30
        hipaa_compliance_enabled:
          type: boolean
        pci_compliance_enabled:
          type: boolean
    AdvancedSettings:
      type: object
      properties:
        agent_personality:
          type: string
          enum:
            - casual
            - humorous
            - direct
            - formal
            - persuasive
            - friendly
        humanize_conversation:
          type: boolean
        background_noise_reduction:
          type: boolean
        allow_interruptions:
          type: boolean
        min_interruption_duration:
          type: number
          minimum: 0.2
          maximum: 5
        background_sound:
          type: string
        agent_response_length:
          type: string
          enum:
            - normal
            - short
            - concise
            - long
        short_pause:
          type: number
          minimum: 0.2
          maximum: 2
        long_pause:
          type: number
          minimum: 0.5
          maximum: 6
        filter_phrases:
          type: string
    PostCallSettings:
      type: object
      properties:
        summary_prompt:
          type: string
        success_evaluation_prompt:
          type: string
        success_evaluation_rubric_type:
          type: string
          enum:
            - NUMERIC_SCALE
            - DESCRIPTIVE_SCALE
            - PERCENTAGE_SCALE
            - LIKERT_SCALE
            - PASS_FAIL
            - SENTIMENT
        structured_extraction_prompt:
          type: string
        structured_extraction_json_schema:
          type: object
          description: A valid JSON Schema object describing the fields to extract.
    Error:
      type: object
      required:
        - error
      properties:
        error:
          type: string
        details:
          type: string
  responses:
    BadRequest:
      description: Validation error or invalid request body.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    Unauthorized:
      description: Missing or invalid API key.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    NotFound:
      description: The requested resource does not exist.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
    TooManyRequests:
      description: Rate limit exceeded.
      content:
        application/json:
          schema:
            type: object
            properties:
              success:
                type: boolean
              message:
                type: string
              error:
                type: string
              retryAfter:
                type: integer
    InternalServerError:
      description: Unexpected server error.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/Error'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      description: API key obtained from the OpenMic dashboard.

````