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

# Update Agent

> Update one or more fields on an existing agent. Only fields you include are changed.

<Warning>
  **Legacy endpoint - deprecated.** Unversioned endpoints are scheduled for removal on **July 31, 2026**. Use the [`/v1` version](/docs/api-reference/v1/agents/update) for new integrations. This endpoint remains available for existing integrations until then.
</Warning>

Update an existing agent; provide version\_number when updating a specific version.

## Endpoint

`PATCH /agents2/{id}`

This page uses Mintlify OpenAPI rendering, including the API tester/runner, request schema, and response schema from the spec.

## Updating Pipeline And Speech Settings

Single prompt agents can use either the standard `Cascaded` pipeline or the `Speech_To_Speech` pipeline. Changing `pipeline_type` changes which controls apply to the agent version:

| Field                         | Applies to           | Behavior                                                                                                         |
| ----------------------------- | -------------------- | ---------------------------------------------------------------------------------------------------------------- |
| `pipeline_type`               | Single prompt agents | `Cascaded` keeps separate transcriber, LLM, and voice controls. `Speech_To_Speech` uses a realtime speech model. |
| `speech.transcriber_id`       | Cascaded agents      | Selects the primary STT provider.                                                                                |
| `speech.fallback_stt_enabled` | Cascaded agents      | Enables backup STT. Set `speech.stt_fallback_transcriber_id` when this is true.                                  |
| `speech.audio_cache_enabled`  | Cascaded agents      | Enables cached TTS for repeated phrases. Speech to Speech agents ignore this setting.                            |


## OpenAPI

````yaml PATCH /agents2/{id}
openapi: 3.0.0
info:
  title: DialNexa API
  description: >-
    Public REST API for the DialNexa voice AI platform. Versioned endpoints are
    under /v1; unversioned endpoints are legacy and deprecated.
  version: 1.0.0
servers:
  - url: https://api.dialnexa.com
    description: DialNexa production API
security:
  - bearer: []
tags:
  - name: API Keys
  - name: Agent Functions
  - name: Agents V1
  - name: Agents2
  - name: Batch Calls
  - name: Batch Calls V1
  - name: Call Logs
  - name: Calls
  - name: Calls V1
  - name: Campaign Leads
  - name: Campaigns
  - name: External Webhooks
  - name: Knowledge Base
  - name: Knowledge Base V1
  - name: LLMs
  - name: LLMs V1
  - name: Languages
  - name: Languages V1
  - name: Organization Phone Numbers
  - name: Organization Phone Numbers V1
  - name: Phone Number Pricing
  - name: Phone Number Pricing V1
  - name: Transcribers
  - name: Transcribers V1
  - name: User Webhooks
  - name: User Webhooks V1
  - name: V1
  - name: Voices
  - name: Voices V1
  - name: Webcall
  - name: Workflow Leads
  - name: Workflow Leads V1
  - name: Workflows
  - name: Workflows V1
paths:
  /agents2/{id}:
    patch:
      tags:
        - Agents2
      summary: Update an agent (structured response)
      description: >-
        **Legacy endpoint - deprecated, scheduled for removal on July 31,
        2026.** Use the `/v1` version for new integrations. 


        Deprecated - use /v1/agents/:id instead. This parallel resource will be
        removed in a future version.
      operationId: Agents2Controller_update
      parameters:
        - name: id
          required: true
          in: path
          description: ID of the agent
          schema:
            type: string
        - name: x-organization-id
          in: header
          description: RSA encrypted organization ID (base64 format)
          required: true
          schema:
            type: string
            example: BASE64_ENCRYPTED_ORG_ID_HERE
      requestBody:
        required: true
        description: >-
          Grouped request body. Provide version_number or
          current_version.number. Fallback LLM:
          llm.fallback.fallback_llm_enabled + llm.fallback.llm_fallback_model.
          PCA: analysis.postcall_analysis.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateAgents2BodyDto'
      responses:
        '200':
          description: >-
            Agent updated; current_version includes llm.fallback and flat
            fallback fields
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Agents2VersionResponseDto'
      deprecated: true
components:
  schemas:
    UpdateAgents2BodyDto:
      type: object
      properties:
        title:
          type: string
          example: Customer Support Agent
        llm:
          $ref: '#/components/schemas/Agents2LlmDto'
        fallback_llm_enabled:
          type: boolean
          description: >-
            Enable fallback LLM (flat alias; prefer
            llm.fallback.fallback_llm_enabled)
          example: false
        llm_fallback_model:
          type: string
          description: Fallback LLM id (flat alias; prefer llm.fallback.llm_fallback_model)
          example: abc123xyz789ab
          nullable: true
        llm_fallback_delay_ms:
          type: number
          description: >-
            Fallback delay ms (flat alias; prefer
            llm.fallback.llm_fallback_delay_ms)
          example: 500
          nullable: true
        analysis:
          description: Post-call analysis (PCA) fields for the agent version
          allOf:
            - $ref: '#/components/schemas/Agents2AnalysisDto'
        version_number:
          type: number
          description: Agent version number to update
          example: 1
        is_published:
          type: boolean
          description: Publish this agent version
          example: false
        update_deployment:
          type: boolean
          description: Allow updating an already-published version
          example: false
    Agents2VersionResponseDto:
      type: object
      properties:
        number:
          type: number
          example: 0
        is_published:
          type: boolean
          example: false
        llm:
          $ref: '#/components/schemas/Agents2LlmDto'
        fallback_llm_enabled:
          type: boolean
          example: false
        llm_fallback_model:
          type: string
          example: llm_abc123xyz789ab
          nullable: true
        fall_back_llm_id:
          type: string
          example: llm_abc123xyz789ab
          nullable: true
        llm_fallback_delay_ms:
          type: number
          example: 500
          nullable: true
        transcriber_id:
          type: string
          example: tr0deepnova3xx
          nullable: true
        analysis:
          $ref: '#/components/schemas/Agents2AnalysisDto'
      required:
        - number
        - is_published
    Agents2LlmDto:
      type: object
      properties:
        id:
          type: string
          description: Primary LLM id (llms.id)
          example: llm_xxxxx
        settings:
          $ref: '#/components/schemas/Agents2LlmSettingsDto'
        fallback:
          $ref: '#/components/schemas/Agents2LlmFallbackDto'
    Agents2AnalysisDto:
      type: object
      properties:
        postcall_analysis:
          description: Post-call analysis fields to create on the agent version
          example:
            - field_name: customer_satisfaction
              field_type: NUMBER
              field_description: Customer satisfaction rating
          type: array
          items:
            $ref: '#/components/schemas/Agents2PostCallAnalysisItemDto'
    Agents2LlmSettingsDto:
      type: object
      properties:
        temperature:
          type: number
          description: LLM temperature (0.0 to 2.0)
          example: 0.1
        structured_output:
          type: boolean
          description: Enable structured JSON output
          example: true
    Agents2LlmFallbackDto:
      type: object
      properties:
        fallback_llm_enabled:
          type: boolean
          description: Enable fallback LLM for this agent version
          example: false
        llm_fallback_model:
          type: string
          description: ID (llms.id) of the LLM to use as fallback
          example: abc123xyz789ab
          nullable: true
        fall_back_llm_id:
          type: string
          description: Alias for llm_fallback_model (llms.id); llm_ prefix is stripped
          example: llm_abc123xyz789ab
          nullable: true
        llm_fallback_delay_ms:
          type: number
          description: Milliseconds to wait before triggering the fallback LLM
          example: 500
          nullable: true
    Agents2PostCallAnalysisItemDto:
      type: object
      properties:
        field_name:
          type: string
          example: customer_satisfaction
          description: Name of the PCA field
        field_description:
          type: string
          example: Customer satisfaction rating from 1 to 5
          description: Description of the PCA field
        field_type:
          type: string
          example: NUMBER
          description: Type of the PCA field
          enum:
            - TEXT
            - SELECTOR
            - BOOLEAN
            - NUMBER
        additional_fields:
          example:
            - positive
            - neutral
            - negative
          description: Selector choices (required for SELECTOR type)
          type: array
          items:
            type: string
      required:
        - field_name
        - field_type
  securitySchemes:
    bearer:
      scheme: bearer
      bearerFormat: JWT
      type: http

````