> ## 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 an existing agent on the v1 API.

Changes state - verify before retry
Update an existing agent. Send only the fields you want to change. The request is scoped to the authenticated organization automatically.

## Update Agent Auto Transcription

On a cascaded Single Prompt or Conversational Flow agent, set `transcriber_auto: true` to select the platform-managed primary and fallback pair. Accompanying transcriber-choice fields are ignored. Saving a voice or language change while Auto is on refreshes the pair for the chosen languages; platform default changes can also refresh Auto versions, including published ones.

Sending `transcriber_id`, `fallback_stt_enabled`, `stt_fallback_transcriber_id`, or `stt_fallback_wait_ms` without `transcriber_auto` turns Auto off. A request touching neither Auto nor those fields preserves the existing mode. Auto does not apply to Speech to Speech agents or IVR menus. Review the saved draft’s listening stack and test it before publishing.

## When to use this

* **Prompt iteration**: change `prompt_text` or `system_prompt_text` on a draft version while tuning agent behavior.
* **Rewiring**: point the agent at a different voice, LLM, transcriber, or knowledge base without recreating it.
* **Publishing**: set `is_published` to promote a draft version once it is ready for production traffic.
* **Fallback configuration**: enable LLM or STT fallbacks so calls survive a provider outage (see the sections below).

A `400 Bad Request` means a field failed validation; `404 Not Found` means the agent or the version does not exist in this workspace. `403 Forbidden` means the version is already published (see below) or the request tried to turn off a setting only DialNexa can disable, such as audio caching or predictive preprocessing. See [API errors](https://dialnexa.com/docs/api-reference/api-fundamentals.md#handle-dialnexa-api-errors) for the standard error format.

## Minimal publish request

```json theme={null}
{
  "version_number": 0,
  "is_published": true
}
```

A new agent's first draft is version `0`. Read `current_version_number` from [Get Agent Details](https://dialnexa.com/docs/api-reference/v1/agents/get.md) when publishing a later draft. It is returned as a string, and `version_number` must be sent as a JSON number, so convert it first: `"2"` returns `400`.

Send only the fields you intend to change. The remaining schema groups cover advanced prompt, speech, fallback, analysis, function, and routing settings.

## Post-Call Analysis LLM

Use `post_call_analysis_llm_id` on this endpoint to set or clear the LLM used for post-call field extraction on a draft version.

| Request field | Result |
| - | - |
| `post_call_analysis_llm_id: "llm_A1B2C3D4E5F6G7"` | Uses that LLM for post-call extraction. |
| `post_call_analysis_llm_id: null` | Clears the override and falls back to the workspace default. |
| Omit `post_call_analysis_llm_id` | Leaves the existing fields' LLM unchanged. |

The LLM is stored on the version's existing post-call fields. It has no effect when the version has none, and a `post_call_analysis` list in the same or a later request creates new fields without it, so they use the workspace default: send the list first, then set the LLM. It is also saved before the rest of the request is validated, so a request that is then rejected with `400`, `403`, or `409` can still have changed it.

Send `version_number` with the request. A version that is already published returns `403 Forbidden` on any further update; edit the agent's current draft and publish it instead. A request with `post_call_analysis_llm_id` for a published version that is no longer the current one returns `400` instead (`Cannot update post-call analysis for a historical published version. Only the current version can be updated.`). Publishing a draft with `is_published: true` is not affected, because the draft is not yet published.

## Publishing And Phone Number Assignment

Phone numbers are not part of an agent version, and this endpoint does not accept phone number fields. Numbers are linked to the agent with [Attach Agent Phone Number](https://dialnexa.com/docs/api-reference/v1/agents/attach-phone-number.md), and every version uses them. After you publish a draft with `is_published: true`, inbound calls and workflow calls on the agent's numbers run on the new version without any reassignment. A batch keeps the version it was created with.

While a batch is running on this agent, the request returns `409 Conflict` with code `AGENT_HAS_RUNNING_BATCH` and the running batches in `data.batches` when it would change a published version in place (runtime fields; `version_title` and `folder_id` can still change) or change `timezone` or `pipeline_type`. Drafts stay editable and can still be published. Pause the batch or wait for it to finish, or publish a new version instead.

## Fallback STT

Use `fallback_stt_enabled`, `stt_fallback_transcriber_id`, and `stt_fallback_wait_ms` to configure fallback transcription. Pick the fallback transcriber ID from [List Fallback Transcribers](https://dialnexa.com/docs/api-reference/v1/transcribers/fallback.md), then pass the selected ID here. The fallback transcriber ID must differ from the effective primary `transcriber_id`. When the fallback or the languages change, a fallback that cannot serve the agent's languages is replaced with a compatible one, or fallback is turned off when none fits, so a language-only update can change these fields.

## Speech And Model Settings

Use `boosted_keywords` when a cascaded Deepgram, Soniox or Sarvam agent (for Sarvam a best-effort hint) needs recognition hints for names, products, localities, or other uncommon terms. Send a comma-separated string. Terms can contain letters, numbers, and spaces only, with up to `100` normalized terms, `50` characters per term, and `2,000` total characters.

Set `boost_dynamic_variables` to `true` to append sanitized test-call or batch-recipient values to those recognition hints at call time. The configured terms keep priority, and existing agents remain opted out until this field is enabled.

Predictive preprocessing and audio caching are on by default and only DialNexa can turn them off: sending `false` for `predictive_preprocessing_enabled` or `audio_cache_enabled` returns `403 Forbidden`, except when DialNexa has already switched predictive preprocessing off itself because functions are configured or the agent is a Conversational Flow agent.

When functions are configured, the primary and fallback LLM must support tool calling; a model that does not returns `400`. DialNexa forces predictive preprocessing off for that effective configuration.

For an IVR Agent, send `ivr_menu` only to a draft. Publish the IVR draft through this agent update operation. Do not use a direct version-publish route. Publishing validates the graph and renders every static prompt to cached audio before the version becomes available.

## Publish Checks And Voice Tuning

Publishing requires a non-empty universal prompt for Single Prompt agents, a custom welcome message when the agent is set in the dashboard to open with a fixed welcome, valid content in Conversational Flow nodes, and a transcriber compatible with the selected language. A version whose LLM, or enabled fallback LLM, has been retired cannot be published: the request returns `400` with `data.code` `LLM_RETIRED`; pick a model from [List LLMs](https://dialnexa.com/docs/api-reference/v1/llms/list.md) and publish again. Drafts can remain incomplete while you edit.

Before publishing an IVR, [read the target variables](https://dialnexa.com/docs/api-reference/v1/agents/transfer-variables.md) and set non-empty `fallback_dynamic_variables` on each Connect To Agent node. [Check IVR references](https://dialnexa.com/docs/api-reference/v1/agents/ivr-transfer-references.md) before publishing a target agent, and [check changed targets](https://dialnexa.com/docs/api-reference/v1/agents/stale-transfer-targets.md) before republishing an IVR.

PATCH accepts `voice_speed` from 0.25 to 4, `voice_temperature` from 0 to 2, `voice_volume` from -10 to 10, `voice_pitch` from -20 to 20, and `llm_temperature` from 0 to 2. For a recognized cascaded voice provider, saving a changed voice or speed clamps the saved speed: Sarvam 0.3 to 3, Soniox 0.7 to 1.3, and ElevenLabs, Cartesia, or Smallest AI 0.7 to 1.2. Read the saved value after updating. Values outside the API bounds return `400`. Not every provider uses every setting: `voice_volume` is applied by Cartesia and Sarvam voices and by Speech-to-Speech agents, `voice_pitch` by Sarvam voices, and `voice_temperature` by ElevenLabs and Smallest AI voices; other providers ignore them. Speech-to-Speech agents apply volume, apply speed on OpenAI Realtime models only, and do not use `llm_temperature`.

## Null Values On Update

The update writes only fields that are present and not null or empty. Sending `null` for `end_call_on_hold_sec`, `language_default_message`, `version_title`, `reminder_message_content`, `llm_fallback_model`, or `llm_fallback_delay_ms` is ignored: the stored value is kept. An empty string `""` is also ignored for `language_default_message`, `reminder_message_content`, and `llm_fallback_model`; for `end_call_on_hold_sec`, `llm_fallback_delay_ms`, and `version_title` it fails validation and returns `400`. Fields with explicit clearing behaviour are `transcriber_id`, `knowledge_base_ids`, `stt_fallback_transcriber_id`, `stt_fallback_wait_ms`, `denoising_mode`, `denoise_strength`, and `post_call_analysis_llm_id`, which accept `null`.

## Call Settings

These call settings are accepted on update as well as on create. Send only the fields you want to change; every other setting on the version keeps its current value.

| Field | Description |
| - | - |
| `max_call_duration_sec` | Maximum call duration in seconds before the call is forcibly ended. Maximum accepted: 3600 seconds for speech-to-speech agents, 5400 seconds for cascaded agents. |
| `end_call_on_silence_sec` | Seconds of silence after which the call is automatically ended. Accepted range: 15 to 30 seconds. Must be at least 5 seconds above reminder\_message\_interval when reminders are configured. |
| `end_call_on_hold_sec` | Seconds to wait in a confirmed hold (hold detection) before hanging up, counted from hold confirmation. Accepted range: 10 to 60 seconds. Null is ignored on update. |
| `ring_duration_sec` | Ring timeout for outbound Plivo and Vobiz calls in seconds. Numeric input is rounded and clamped to 10 through 30. |
| `voicemail_detection` | Whether voicemail detection is enabled for calls this version handles. |
| `hangup_on_voicemail` | Hang up immediately when voicemail is detected instead of leaving a message |
| `voicemail_message` | Message spoken when voicemail is detected (only used when hangup\_on\_voicemail is false). Supports Handlebars template syntax (`{{variable}}`). Must be valid Handlebars. |
| `pronunciations` | Optional list of pronunciation overrides. Each item has `original_word` (the word as written), `pronunciation_format` (how the voice should say it) and an optional `phonetic_pronunciation`. Each value is a string of up to 128 characters. Applied by ElevenLabs and Cartesia voices only, and only for items with `phonetic_pronunciation`. |

## Validation Rules

The update request validates the effective draft configuration before saving.

| Field | Rule |
| - | - |
| `prompt_text`, `welcome_message`, and `voicemail_message` | Must be valid Handlebars template text when they use `{{variable}}` syntax. |
| `system_prompt_text` | Static instructions only. Template variables return `400`; use `prompt_text` for dynamic values. |
| `voice_model_id` | Must belong to the same provider as the effective `voice_id`. Omit it when changing voices so DialNexa can apply the recommended model. |
| `stt_fallback_transcriber_id` | Required when fallback STT is enabled and must differ from the effective primary `transcriber_id`. Sending the same ID for both returns `400 Bad Request`. |
| `default_dynamic_variables.agent_transfer_destinations` | Conversational Flow Agents only. Supports up to `7` pipe-separated transfer numbers. Each must be US `+1` or India `+91` with exactly `10` digits after the country code. Single Prompt Agent updates that include this key return `400 Bad Request`. |
| `end_call_on_silence_sec` | Must be `15` to `30` seconds and at least `5` seconds above `reminder_message_interval` when reminders are configured. |
| `max_call_duration_sec` | Must be `60` to `5,400` seconds for cascaded agents. Speech to Speech agents are capped at `3,600` seconds. |
| `knowledge_base_ids` | Not accepted for Speech to Speech agents: sending any returns `400` (`Knowledge bases cannot be attached to speech-to-speech agents`). |
| `version_title` | Maximum 150 characters. |
| `ivr_menu` | IVR Agents only. Checked when the agent is published: a valid entry node, valid edges, static prompt text, and a published non-IVR target for each agent handoff. A draft accepts any object. |
| LLM IDs when functions are configured | The primary and enabled fallback models must support tool calling. Check compatibility in the dashboard or MCP catalog; API-key model responses contain only `id`, `name`, and `provider`. |
| Running batch | Changing a published version in place, `timezone`, or `pipeline_type` returns `409 Conflict` with code `AGENT_HAS_RUNNING_BATCH` while a batch is running on the agent. Publishing a draft is not blocked. |

## Workspace Model Availability

Choose the primary model from [List LLMs](https://dialnexa.com/docs/api-reference/v1/llms/list.md) and an enabled fallback from [List Fallback LLMs](https://dialnexa.com/docs/api-reference/v1/llms/fallback.md) using the same workspace key.

## Check Prompt Health

Create and update responses include `prompt_health` for Single Prompt and Speech to Speech agents: `status`, `prompt_tokens`, `limit_tokens`, `system_prompt_reserved_tokens`, `limited_by`, and `comment`. Other types report `not_applicable`. Counts are estimates, with known dynamic defaults expanded and system instructions reserved. Read [prompt size limits](https://dialnexa.com/docs/agents/prompts-and-welcome-messages.md#prompt-size-limits) before changing models or adding large defaults.

The size limit is enforced only when publishing: an update to a draft with an oversized prompt succeeds and reports `over_ceiling`, and publishing that version returns `400`. Reduce the prompt or select a suitable model before publishing.

Enabled fallback LLM and STT choices must differ from their primary model or transcriber. An invalid pair returns `400`. The automatically provided End Call behavior does not count as a callable tool for predictive preprocessing or model tool-compatibility checks.

## Create And Update Agent Field Validation

Both operations validate each item in `agent_functions` and `post_call_analysis` before saving. Invalid items return `400 Bad Request`.

* `agent_functions` must be an array. Each item requires a supported `type`. Optional `displayName` (or `display_name`) and `description` must be strings; `config` must be an object.
* Post-call fields require a non-blank, unique `field_name` and one of `TEXT`, `SELECTOR`, `BOOLEAN`, `NUMBER`, or `DATETIME`. Use `TEXT` instead of `STRING` and `SELECTOR` instead of `ENUM`.
* A `SELECTOR` requires at least one non-blank string choice in `additional_fields`, normally an array such as `["Resolved", "Escalated"]`. `display_order`, when supplied, must be a non-negative integer.
* `llm_fallback_delay_ms` and `reminder_message_interval` cannot be negative. A reminder interval of `0` disables reminders.
* `ring_duration_sec` defaults to `30` seconds and applies to outbound Plivo and Vobiz calls in every workspace. Numeric input is rounded and clamped to `10` through `30`: `5` saves as `10`, `90` as `30`, and `22.6` as `23`. Non-numeric input returns `400`. Read the saved value to verify it.
* `end_call_on_hold_sec` accepts `10` to `60` seconds. New agents use `20` when omitted or null. On update, null is ignored and the stored value is kept. Read [End Call on Hold](https://dialnexa.com/docs/agent-settings/call-settings.md#end-call-on-hold) for behavior and testing.

On update, send the complete intended function or post-call list because each supplied list replaces its previous contents. Read the draft back with [Get Agent](https://dialnexa.com/docs/api-reference/v1/agents/get.md) and verify the saved fields before publishing.

## Update Primary And Secondary Languages

Agent updates accept `secondary_language_ids` (up to three IDs) and `language_default_message` (up to 500 characters). Send `[]` to clear the secondary languages. `null` and `""` are ignored for the message, so the stored message is kept. Review the saved voice and transcriber compatibility before publishing. On a Speech-to-Speech agent, a request that changes `llm_id` or `secondary_language_ids` returns `400` when the version would have secondary languages on a model whose `provider` is not `gemini`. See [multilingual agent configuration](https://dialnexa.com/docs/api-reference/v1/agents/create.md#configure-primary-and-secondary-languages).

## Update Agent while batches run

Publishing a draft returns `data.running_batches` with the ID, title, and pinned version of batches currently running on the agent. Those batches keep their existing version. Check the batch in the dashboard before assuming newly published changes apply to it.

## Retired Language Models

GPT-4.1 Nano is retired. Choose current primary, fallback, and post-call extraction models when creating an agent or changing its model selection. A new retired-model selection returns `400` with code `LLM_RETIRED`; publishing and dialing with a retired primary or enabled fallback are also refused. Read the saved model choices before testing.

## Configure Emotion Tags

Set `emotion_tags_enabled` to `true` for emotional delivery on Cartesia Sonic 3/3.5 or Soniox TTS v2 voices. It defaults to `false` on create. Explicitly enabling it for an unsupported voice model returns `400`; changing to an unsupported voice turns it off. On update, omission leaves the value unchanged unless that voice change disables it. See [Emotion tags](https://dialnexa.com/docs/agent-settings/speech-settings.md#emotion-tags) for testing guidance.

## Language And Post-Call Field Validation

Speech to Speech agents must use explicit language choices; selecting Multilingual returns `400`. For cascaded agents, Multilingual must be the only language and cannot be combined with secondary languages. Post-call analysis field names starting with `_nexa_` are reserved and rejected.

## Configure Contact Memory

Contact memory lets your agents remember earlier calls with the same phone number. Each workspace keeps one memory per contact phone number, and every agent in the workspace shares it. Two fields control it, and both default to `false`:

| Field | What it does |
| - | - |
| `lead_memory_save_enabled` | After each successful phone call this agent makes or answers, the contact's memory is updated with what was said, such as decisions, dates, offers and open follow-ups. |
| `lead_memory_enabled` | When a phone call starts, this agent receives the contact's memory, so it does not ask for details the contact already gave on an earlier call. |

A call is saved when it completes normally and the contact speaks. Voicemail, calls where the contact never speaks, and web calls are not saved, and web calls never use memory. Memory builds from the first call saved after you turn saving on; earlier calls are not added. In the dashboard, both settings are in the agent's **Knowledge Base & Memory** section.

On update, send either field to change it. An omitted field keeps its current value.

Contact memory is unavailable on IVR agents themselves. Configure the memory switches on the agents the IVR menu connects to; those settings apply after handoff. See [Contact Memory](https://dialnexa.com/docs/knowledge-base/contact-memory.md#configure-contact-memory) for setup, call eligibility and billing.

## Verify the result

Fetch the agent and confirm the intended version is published. Responses can include additional fields not listed here; you can ignore them. If the update timed out, read the agent before repeating the request, especially when publishing.


## OpenAPI

````yaml PATCH /v1/agents/{id}
openapi: 3.0.0
info:
  title: DialNexa API
  description: Public `/v1` REST API for the DialNexa voice AI platform.
  version: 1.0.0
servers:
  - url: https://api.dialnexa.com
    description: DialNexa production API
security:
  - bearer: []
tags:
  - name: Agents
  - name: Batch Calls
  - name: Calls
  - name: Knowledge Base
  - name: Languages
  - name: LLMs
  - name: Phone Numbers
  - name: Organization Folders
  - name: Transcribers
  - name: Webhooks
  - name: Voices
  - name: Workflows
  - name: Workflow Leads
  - name: Authentication
  - name: Agent Builder
  - name: Agent Evaluations
paths:
  /v1/agents/{id}:
    patch:
      tags:
        - Agents
      summary: Update Agent
      description: >-
        Updates the specified draft version of an agent. `version_number` is
        required.


        **Managing functions via this endpoint:**

        - Pass `agent_functions: [...]` to replace the version's functions. The
        platform `end_call` function is always kept.

        - Pass `agent_functions: []` to remove every function except `end_call`.

        - Omit `agent_functions` entirely to leave existing functions untouched.


        **Post-call analysis LLM:**

        - Pass `post_call_analysis_llm_id`, for example `llm_A1B2C3D4E5F6G7`, to
        set the LLM used for post-call field extraction.

        - Pass `null` to clear it so the workspace default is used.

        - Omit the field to leave it unchanged.

        - It is stored on the version's existing post-call fields: it has no
        effect when there are none, a replaced `post_call_analysis` list gets
        new fields without it, and it is saved before the rest of the request is
        validated, so a rejected request can still have changed it.


        **Phone numbers** are linked to the agent, not to a version. Manage them
        with `/v1/agents/{agentId}/phone-numbers`. Every version uses the
        agent's numbers, and inbound calls run on the latest published version.


        **While a batch is running on this agent**, the request returns `409
        Conflict` with code `AGENT_HAS_RUNNING_BATCH` when it would change a
        published version in place (runtime fields; `version_title` and
        `folder_id` can still change) or change `timezone` or `pipeline_type`.
        Drafts stay editable and can be published. The running batch keeps
        dialing the version it was created with.


        A published version cannot be edited. Runtime changes are blocked while
        a batch runs on the agent; edit and publish a new draft instead.


        Null is ignored for `end_call_on_hold_sec`, `language_default_message`,
        `version_title`, `reminder_message_content`, `llm_fallback_model` and
        `llm_fallback_delay_ms`: the stored value is kept.
      operationId: updateAgent
      parameters:
        - name: id
          required: true
          in: path
          description: Agent ID
          schema:
            example: agent_2g7Xy3tY53gRlp
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateAgentRequest'
            examples:
              request:
                summary: Update a draft agent version
                value:
                  version_number: 0
                  title: Customer Support Agent
                  llm_id: llm_A1B2C3D4E5F6G7
                  fallback_stt_enabled: true
                  stt_fallback_transcriber_id: trs_soniox
                  post_call_analysis_llm_id: llm_A1B2C3D4E5F6G7
              clearPostCallAnalysisLlm:
                summary: Clear post-call analysis LLM override
                value:
                  version_number: 0
                  post_call_analysis_llm_id: null
              publishDraft:
                summary: Publish a draft version
                value:
                  version_number: 2
                  is_published: true
      responses:
        '200':
          description: Agent updated successfully.
          content:
            application/json:
              schema:
                type: object
                required:
                  - success
                  - error
                  - statusCode
                  - message
                  - data
                  - timestamp
                properties:
                  success:
                    type: boolean
                    enum:
                      - true
                  error:
                    type: boolean
                    enum:
                      - false
                  statusCode:
                    type: integer
                    example: 200
                  message:
                    type: string
                    example: Success
                  data:
                    $ref: '#/components/schemas/Agents'
                  timestamp:
                    type: string
                    format: date-time
              examples:
                success:
                  summary: Successful response
                  value:
                    success: true
                    error: false
                    statusCode: 200
                    message: Success
                    data:
                      id: agent_2g7Xy3tY53gRlp
                      folder_id: null
                      current_version_number: '0'
                      timezone: Asia/Kolkata
                      agent_type: Single_Prompt_Agent
                      pipeline_type: Cascaded
                      webhook_id: null
                      current_version:
                        agent_id: agent_2g7Xy3tY53gRlp
                        version_number: '0'
                        version_title: Version 0
                        title: Customer Support Agent
                        is_published: false
                        language_id: lang_en_in
                        voice_id: voice_abc123
                        llm_id: llm_A1B2C3D4E5F6G7
                        transcriber_id: trs_deepgram_nova_2
                        fallback_stt_enabled: true
                        stt_fallback_transcriber_id: trs_soniox
                      versions:
                        - agent_id: agent_2g7Xy3tY53gRlp
                          version_number: '0'
                          version_title: Version 0
                          title: Customer Support Agent
                          is_published: false
                          language_id: lang_en_in
                          voice_id: voice_abc123
                          llm_id: llm_A1B2C3D4E5F6G7
                          transcriber_id: trs_deepgram_nova_2
                          fallback_stt_enabled: true
                          stt_fallback_transcriber_id: trs_soniox
                      inbound_phone_numbers: []
                      outbound_phone_numbers:
                        - id: phn_abc123
                          phone_number: '9876543210'
                          country_iso: '91'
                          nickname: Support line
                          sip_trunk_enabled: false
                          linked_at: '2026-09-30T06:00:00.000Z'
                    timestamp: '2026-09-07T06:00:00.000Z'
        '400':
          description: >-
            Invalid body, incompatible configuration, or, when publishing, a
            prompt over the size limit for the selected model.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: 400 Bad Request
                  value:
                    statusCode: 400
                    error: true
                    success: false
                    data: []
                    message: >-
                      version_number must be a number conforming to the
                      specified constraints
                    errors:
                      - >-
                        version_number must be a number conforming to the
                        specified constraints
                s2sLanguages:
                  summary: >-
                    Speech-to-Speech agent with secondary languages on a
                    non-Gemini model
                  value:
                    statusCode: 400
                    error: true
                    success: false
                    data: []
                    message: >-
                      Speech-to-Speech agents that speak more than one language
                      run on Gemini Live. Pick a Gemini model or remove the
                      secondary languages.
                    errors:
                      - >-
                        Speech-to-Speech agents that speak more than one
                        language run on Gemini Live. Pick a Gemini model or
                        remove the secondary languages.
                llmRetired:
                  summary: Publishing a version that uses a retired LLM
                  value:
                    statusCode: 400
                    error: true
                    success: false
                    data:
                      code: LLM_RETIRED
                      llm_ids:
                        - meqtu4wiqv5haq
                    message: >-
                      This agent version uses GPT-4.1 Nano, which has been
                      retired. Switch to a supported model and publish a new
                      version.
                    errors:
                      - >-
                        This agent version uses GPT-4.1 Nano, which has been
                        retired. Switch to a supported model and publish a new
                        version.
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: 401 Unauthorized
                  value:
                    statusCode: 401
                    error: true
                    success: false
                    data: []
                    message: Invalid API key
                    errors: []
        '403':
          description: >-
            The version is already published, or the request turns off a setting
            only DialNexa can disable (audio_cache_enabled or
            predictive_preprocessing_enabled set to false).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: 403 Forbidden
                  value:
                    statusCode: 403
                    error: true
                    success: false
                    data: []
                    message: You cannot patch an already published agent version.
                    errors: []
        '404':
          description: Agent or version not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: 404 Not Found
                  value:
                    statusCode: 404
                    error: true
                    success: false
                    data: []
                    message: Agent with ID 2g7Xy3tY53gRlp not found
                    errors: []
        '409':
          description: >-
            A batch is running on this agent and the request would change what
            it dials with.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CodedErrorResponse'
              examples:
                agentHasRunningBatch:
                  summary: 409 Conflict
                  value:
                    statusCode: 409
                    error: true
                    success: false
                    data:
                      code: AGENT_HAS_RUNNING_BATCH
                      batches:
                        - id: batch_abc123
                          title: September renewals
                          status: running
                    message: >-
                      Batch "September renewals" is running on this agent. Pause
                      it or wait for it to finish, or publish a new version
                      instead.
                    errors: []
        '500':
          description: Internal server error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              examples:
                error:
                  summary: 500 Internal Server Error
                  value:
                    statusCode: 500
                    error: true
                    success: false
                    data: []
                    message: 'Failed to update agent: Internal server error'
                    errors: []
      security:
        - bearer: []
components:
  schemas:
    UpdateAgentRequest:
      type: object
      properties:
        background_sound:
          type: string
          description: >-
            Background sound identifier. When ambient_noise is on, calls play
            the built-in background track whatever value is set; set it to a
            value other than none for background_sound_volume to apply.
        background_sound_volume:
          type: number
          minimum: 0
          maximum: 2
          description: >-
            Volume of the background sound (0 to 2). Applied only when
            ambient_noise is true and background_sound is set to a value other
            than none.
        ambient_noise:
          type: boolean
          description: Enable or disable ambient noise playback on the call
        responsiveness:
          type: number
          minimum: 0
          maximum: 1
          description: >-
            Seconds to wait after the caller stops speaking, 0 to 1. Stored on
            the agent version; not applied to calls.
        interruption_sensitivity:
          type: number
          minimum: 0
          maximum: 1
          description: >-
            Interruption sensitivity level (0 to 1). Stored on the agent
            version; not applied to calls.
        response_eagerness:
          type: number
          minimum: 0
          maximum: 1
          description: >-
            How eagerly the agent responds (0 to 1). Applied when the
            transcriber is Sarvam or Deepgram (Nova-2, Nova-3, Flux); Soniox
            agents ignore it.
        listening_backchannel:
          type: boolean
          description: Play listening sounds (uh-huh, right) while the caller is talking
          example: false
        listening_backchannel_frequency:
          type: number
          minimum: 0
          maximum: 1
          description: How often a listening sound plays when possible (0-1)
          example: 0.8
        denoising_mode:
          nullable: true
          type: string
          enum:
            - remove_noise
            - remove_noise_and_speech
          description: >-
            Denoising mode. Only remove_noise turns denoising on;
            remove_noise_and_speech leaves it off. Web calls run without
            denoising.
        denoise_strength:
          type: number
          minimum: 0
          maximum: 4
          nullable: true
          description: Noise suppression strength 0-4 (higher = stronger)
        boosted_keywords:
          type: string
          maxLength: 2000
          description: >-
            Comma-separated list of words or phrases (e.g. "DialNexa, NexaFlow,
            customer success") used to bias the speech-to-text provider toward
            recognizing them correctly. This is a recognition bias, not a
            guarantee: it increases the likelihood of correctly transcribing
            uncommon names, brands, products, and domain vocabulary. Supported
            for Deepgram and Soniox transcribers (primary or fallback).
            Normalized to at most 100 unique terms (case-insensitive, duplicates
            removed, empty entries dropped) at the configuration boundary;
            empty/null means no boosted keywords.
        boost_dynamic_variables:
          type: boolean
          description: >-
            When true, each call's dynamic-variable VALUES (from the test-call
            form or a batch-call CSV lead: names, cities, order IDs) are
            appended to boosted_keywords for that call, so per-call uncommon
            words get the same recognition bias. Values are sanitized first
            (punctuation stripped, over-long entries dropped) and never evict
            the agent's own configured terms, which always come first. Applies
            to Deepgram and Soniox only; defaults to false.
        reminder_message_interval:
          type: number
          minimum: 0
          example: 10
          description: >-
            Seconds of silence before a reminder. Zero disables reminders. Keep
            at least five seconds below end_call_on_silence_sec when enabled.
        reminder_message_content:
          type: string
          nullable: true
          maxLength: 150
          description: >-
            Reminder text spoken after reminder_message_interval seconds of
            silence, up to 150 characters. When unset, a language-appropriate
            default is spoken. On update, null (and an empty string) is ignored
            and the stored value is kept: the update only writes fields that are
            not null or empty.
        transcriber_auto:
          type: boolean
          description: >-
            Auto transcriber: use the platform default STT pair for the agent
            languages, kept current as the defaults change. Setting any
            transcriber field without this turns Auto off; true ignores any
            transcriber fields sent with it.
        transcriber_id:
          type: string
          nullable: true
          description: ID of the transcriber catalog entry
        fallback_stt_enabled:
          type: boolean
          description: Enable parallel fallback STT for this agent
        stt_fallback_transcriber_id:
          type: string
          nullable: true
          description: Fallback STT transcriber catalog entry
        stt_fallback_wait_ms:
          type: number
          nullable: true
          minimum: 0
          description: Milliseconds to wait for primary STT after fallback finalizes first
        audio_cache_enabled:
          type: boolean
          description: >-
            TTS audio caching for this agent. Only DialNexa can disable it, so
            sending false returns 403. Omitting this field leaves the current
            value unchanged.
        emotion_tags_enabled:
          type: boolean
          description: >-
            When true, the agent may write inline emotion tags (e.g. [sad],
            [excited]) that the voice performs. Supported only on Cartesia Sonic
            3 and Soniox TTS v2 voices: turning it on for any other voice
            returns 400, and switching the voice to an unsupported one turns it
            off. Defaults to false.
        voicemail_detection:
          type: boolean
          description: Indicates whether voicemail detection is enabled
          example: true
        hangup_on_voicemail:
          type: boolean
          description: >-
            Hang up immediately when voicemail is detected instead of leaving a
            message
          example: false
        lead_memory_enabled:
          type: boolean
          description: >-
            Show the lead's earlier successful calls in this workspace to the
            agent at the start of its next call with them. Not available on IVR
            agents: set it on the agents the menu connects to, which use it
            after the handoff
          example: false
        lead_memory_save_enabled:
          type: boolean
          description: >-
            Save what was said on this agent's successful calls to lead memory,
            so agents in this workspace can use it on later calls with the same
            lead. Not available on IVR agents: set it on the agents the menu
            connects to, which save the call when the caller reaches them
          example: false
        voicemail_message:
          type: string
          description: >-
            Message spoken when voicemail is detected (only used when
            hangup_on_voicemail is false). Supports Handlebars template syntax
            ({{variable}}). Must be valid Handlebars.
          example: Hi, please call us back at your convenience.
        end_call_on_silence_sec:
          type: number
          minimum: 15
          maximum: 30
          description: >-
            Seconds of silence after which the call is automatically ended.
            Accepted range: 15 to 30 seconds. Must be at least 5 seconds above
            reminder_message_interval when reminders are configured.
          example: 20
        end_call_on_hold_sec:
          type: number
          minimum: 10
          maximum: 60
          nullable: true
          example: 20
          description: >-
            Seconds to wait during a sustained detected hold before ending a
            non-IVR call, 10 to 60. On update, null is ignored and the stored
            value is kept; an empty string fails validation and returns 400.
        max_call_duration_sec:
          type: number
          minimum: 60
          maximum: 5400
          description: >-
            Maximum call duration in seconds before the call is forcibly ended.
            Maximum accepted: 3600 seconds for speech-to-speech agents, 5400
            seconds for cascaded agents.
          example: 600
        ring_duration_sec:
          type: number
          description: >-
            Ring timeout for outbound Plivo and Vobiz calls in every workspace,
            default 30 seconds. Numeric input is rounded to a whole second and
            clamped to 10 through 30: 5 saves as 10, 90 as 30, and 22.6 as 23.
            Non-numeric input is rejected. Read the saved value after updating.
            Has no effect on inbound or web calls.
          example: 30
        version_number:
          type: integer
          description: >-
            Version number to update, as a whole JSON number.
            current_version_number and version_number are returned as strings,
            so convert them before sending. A fractional value matches no
            version and returns 404.
          example: 1
        folder_id:
          type: string
          description: ID of the folder this agent belongs to
          example: f5k2m8x1q9w3zp
        pipeline_type:
          enum:
            - Cascaded
            - Speech_To_Speech
          type: string
          description: >-
            Pipeline subtype for Single_Prompt_Agent. Cascaded = ASR→LLM→TTS
            pipeline. Speech_To_Speech = direct speech model.
          example: Cascaded
        title:
          type: string
          minLength: 1
          maxLength: 70
          description: Title of the agent (max 70 characters)
          example: Customer Support Agent
        version_title:
          type: string
          nullable: true
          minLength: 1
          maxLength: 150
          description: >-
            Version title, 1 to 150 characters. If omitted on create, the first
            version is titled "Version 0". On update, null is ignored and the
            stored value is kept; an empty string fails validation and returns
            400.
          example: Version 1.1
        description:
          type: string
          description: Description of the agent
          example: This agent handles customer support inquiries
        timezone:
          type: string
          description: Timezone for the agent
          example: Asia/Kolkata
        system_prompt_text:
          type: string
          description: >-
            Static system instructions. Template variables such as
            {{customer_name}} are rejected with 400; use prompt_text for dynamic
            content.
          example: You are a helpful customer support agent named Sarah.
        language_id:
          type: string
          description: ID of the language the agent speaks
          example: lang_en_in
        secondary_language_ids:
          type: array
          items:
            type: string
          maxItems: 3
          description: >-
            Up to three additional language IDs in priority order. The chosen
            voice must support them. Send an empty array on update to clear.
        language_default_message:
          type: string
          nullable: true
          maxLength: 500
          description: >-
            Optional message for an unsupported caller language, up to 500
            characters, spoken in the primary language voice. On update, null
            (and an empty string) is ignored and the stored value is kept: the
            update only writes fields that are not null or empty.
        llm_id:
          type: string
          description: ID of the LLM associated with the agent
          example: llm_A1B2C3D4E5F6G7
        llm_temperature:
          type: number
          minimum: 0
          maximum: 2
          description: >-
            LLM temperature from 0 to 2. Values outside this range return 400.
            Not applied to Speech-to-Speech agents.
          example: 1
        voice_id:
          type: string
          description: >-
            ID of the voice the agent speaks with. Use GET /v1/voices to browse
            available voices.
          example: voice_abc123
        prompt_text:
          type: string
          description: >-
            Main instructions for the agent. Supports Handlebars template syntax
            ({{variable}}) for dynamic content. Must be valid Handlebars:
            malformed syntax causes errors at call time.
          example: Hello, how can I assist you today?
        ivr_menu:
          type: object
          description: >-
            IVR menu tree for IVR_Agent type: {entry_node, nodes{...}} with
            per-node prompt text + digit->node edges. Prompt audio is rendered +
            cached at publish.
        welcome_message:
          type: string
          description: >-
            Opening message spoken by the agent at the start of the call.
            Supports Handlebars template syntax ({{variable}}). Must be valid
            Handlebars: malformed syntax causes errors at call time.
          example: Welcome to our service!
        knowledge_base_ids:
          description: IDs of the knowledge bases attached to this agent version
          example:
            - kb_abc123
            - kb_def456
          type: array
          items:
            type: string
        kb_max_chunks:
          type: integer
          minimum: 1
          maximum: 10
          description: Maximum number of RAG chunks to fetch (1 to 10)
          example: 5
        kb_min_score:
          type: number
          minimum: 0
          maximum: 1
          description: Minimum similarity score threshold for RAG results (0 to 1)
          example: 0.5
        is_published:
          type: boolean
          description: Whether this version is published
          example: false
        default_dynamic_variables:
          type: object
          description: >-
            Default values for dynamic variables used in Handlebars templates.
            For call-transfer flows, the reserved key
            agent_transfer_destinations accepts a pipe-separated list of phone
            numbers (maximum 7). Each number must use a supported country code:
            US (+1) or India (+91), followed by exactly 10 digits (e.g.
            +11234567890|+919876543210).
          example:
            firstName: John
            lastName: Doe
            courseType: Math
        fallback_llm_enabled:
          type: boolean
          description: Enable fallback LLM for this agent
          example: false
        llm_fallback_delay_ms:
          type: integer
          nullable: true
          minimum: 0
          description: >-
            Milliseconds to wait before triggering the fallback LLM, a whole
            number of 0 or more. On update, null is ignored and the stored value
            is kept; an empty string fails validation and returns 400.
          example: 200
        llm_fallback_model:
          type: string
          nullable: true
          description: >-
            ID of the LLM to use as fallback. On update, null (and an empty
            string) is ignored and the stored value is kept: the update only
            writes fields that are not null or empty.
          example: llm_A1B2C3D4E5F6G7
        predictive_preprocessing_enabled:
          type: boolean
          description: >-
            Enable predictive preprocessing for this agent version. Not applied
            to Conversational Flow or Speech-to-Speech agents, or to web calls.
          example: false
        voice_model_id:
          type: string
          description: >-
            Speech synthesis model for the selected voice. Each voice is tied to
            a specific provider, and only that provider's models are valid:
            submitting a model from a different provider will return 400. In
            most cases this field can be omitted; the recommended model for the
            chosen voice is applied automatically. For ElevenLabs voices, the
            supported model is eleven_flash_v2_5. To find supported models for a
            specific voice, call GET /v1/voices/{voice_id}/voice-models.
          example: vm4k2p9x7q1z3r
        voice_speed:
          type: number
          minimum: 0.25
          maximum: 4
          description: >-
            Voice speed from 0.25 to 4. Values outside this range return 400.
            Soniox voices clamp it to 0.7 to 1.3. Speech-to-Speech agents apply
            it on OpenAI Realtime models only; Gemini Live ignores it.
          example: 1
        speech_to_speech_english_accent:
          type: string
          enum:
            - indian
            - british
            - american
          description: >-
            Accent of the agent's English on Speech-to-Speech calls, for the
            whole call: indian (default), british or american.
        voice_temperature:
          type: number
          minimum: 0
          maximum: 2
          description: >-
            Voice temperature from 0 to 2. Values outside this range return 400.
            Applied by ElevenLabs and Smallest voices only.
          example: 1
        voice_volume:
          type: number
          minimum: -10
          maximum: 10
          description: >-
            Voice volume from -10 to 10. Values outside this range return 400.
            Applied by Cartesia voices (a negative value plays as 1, maximum 2),
            Sarvam voices (below 0.1 plays as 1, maximum 3) and Speech-to-Speech
            agents; other providers ignore it. New agents default to -0.363.
          example: 0
        voice_pitch:
          type: number
          minimum: -20
          maximum: 20
          description: >-
            Voice pitch from -20 to 20. Values outside this range return 400.
            Applied by Sarvam voices only.
          example: 0
        agent_identity:
          type: string
          description: >-
            Agent identity (required for Conversational_Flow_Agent type on
            update)
          example: You are a helpful customer support agent named Sarah.
        agent_background:
          type: string
          description: >-
            Agent background (required for Conversational_Flow_Agent type on
            update)
          example: >-
            You have 5 years of experience in customer support and specialize in
            helping customers with technical issues.
        post_call_analysis:
          description: >-
            Fields to extract after a call. Names must be unique and SELECTOR
            fields need choices. On update, replaces the full list for the draft
            version.
          type: array
          items:
            type: object
            properties:
              field_name:
                type: string
                minLength: 1
                pattern: \S
                description: Non-blank name, unique within this version.
              field_type:
                type: string
                enum:
                  - TEXT
                  - SELECTOR
                  - BOOLEAN
                  - NUMBER
                  - DATETIME
              field_description:
                type: string
              additional_fields:
                oneOf:
                  - type: array
                    items:
                      type: string
                  - type: object
                    additionalProperties: true
                nullable: true
                description: >-
                  For SELECTOR, supply at least one non-blank string, normally
                  as an array. An object with an options array is also accepted.
              display_order:
                type: integer
                minimum: 0
                description: Defaults to the array index.
            required:
              - field_name
              - field_type
        agent_functions:
          description: >-
            Agent functions for this version. The list replaces the existing
            functions, except the platform end_call function, which is always
            kept. Pass an empty array to remove the others.
          type: array
          items:
            type: object
            properties:
              type:
                type: string
                enum:
                  - end_call
                  - call_transfer
                  - custom
                  - check_calendar_availability
                  - book_calendar
                  - integration
              displayName:
                type: string
              display_name:
                type: string
                description: Alias for displayName.
              description:
                type: string
              config:
                type: object
                additionalProperties: true
            required:
              - type
        post_call_analysis_llm_id:
          type: string
          nullable: true
          description: >-
            LLM used for post-call field extraction. Accepts a prefixed ID (for
            example `llm_A1B2C3D4E5F6G7`) or a raw ID; null clears it so the
            default extraction model (gpt-4o-mini) is used. It is stored on the
            version's existing post-call fields, so it has no effect when the
            version has none, and a replaced post_call_analysis list creates new
            fields without it, so they use the default extraction model. It is
            saved before the rest of the update is validated, so a request that
            is then rejected (400, 403 or 409) can still have changed it.
          example: llm_A1B2C3D4E5F6G7
        pronunciations:
          type: array
          items:
            $ref: '#/components/schemas/PronunciationItem'
          description: >-
            Pronunciation overrides. Applied by ElevenLabs and Cartesia voices;
            other providers ignore them. Only items with phonetic_pronunciation
            are applied.
      required:
        - version_number
    Agents:
      type: object
      properties:
        id:
          type: string
          example: agent_2g7Xy3tY53gRlp
          description: Signed agent ID
        folder_id:
          type: string
          nullable: true
        current_version_number:
          type: string
          example: '3'
          description: >-
            Number of the current version. Serialized as a string (the column is
            a 64-bit integer).
        timezone:
          type: string
          nullable: true
        agent_type:
          type: string
          enum:
            - Single_Prompt_Agent
            - Conversational_Flow_Agent
            - IVR_Agent
        pipeline_type:
          type: string
          enum:
            - Cascaded
            - Speech_To_Speech
          nullable: true
        webhook_id:
          type: string
          nullable: true
        current_version:
          type: object
          nullable: true
          description: The version current_version_number points to.
          properties:
            agent_id:
              type: string
            version_number:
              type: string
              example: '1'
              description: >-
                Version number. Serialized as a string (the column is a 64-bit
                integer).
            version_title:
              type: string
              nullable: true
            title:
              type: string
              nullable: true
            description:
              type: string
              nullable: true
            llm_id:
              type: string
              nullable: true
            language_id:
              type: string
            voice_id:
              type: string
            voice_model_id:
              type: string
              nullable: true
            voice_speed:
              type: number
              nullable: true
            voice_temperature:
              type: number
              nullable: true
            voice_volume:
              type: number
              nullable: true
            voice_pitch:
              type: number
              nullable: true
            prompt_text:
              type: string
            system_prompt_text:
              type: string
              nullable: true
            conversation_start_type:
              type: string
            welcome_message:
              type: string
              nullable: true
            knowledge_base_ids:
              type: array
              items:
                type: string
              nullable: true
            kb_max_chunks:
              type: number
              nullable: true
            kb_min_score:
              type: number
              nullable: true
            is_published:
              type: boolean
            voicemail_detection:
              type: boolean
              nullable: true
            hangup_on_voicemail:
              type: boolean
              nullable: true
            voicemail_message:
              type: string
              nullable: true
            end_call_on_silence_sec:
              type: number
            max_call_duration_sec:
              type: number
            ring_duration_sec:
              type: number
            background_sound:
              type: string
              nullable: true
            ambient_noise:
              type: boolean
            background_sound_volume:
              type: number
            llm_temperature:
              type: number
            fallback_llm_enabled:
              type: boolean
              nullable: true
            llm_fallback_delay_ms:
              type: number
              nullable: true
            llm_fallback_model:
              type: string
              nullable: true
            fallback_stt_enabled:
              type: boolean
              nullable: true
            stt_fallback_wait_ms:
              type: number
              nullable: true
            stt_fallback_transcriber_id:
              type: string
              nullable: true
            predictive_preprocessing_enabled:
              type: boolean
              nullable: true
            prompt_caching_enabled:
              type: boolean
              nullable: true
            responsiveness:
              type: number
            interruption_sensitivity:
              type: number
            response_eagerness:
              type: number
            transcriber_id:
              type: string
              nullable: true
            denoising_mode:
              type: string
              nullable: true
            denoise_strength:
              type: number
              nullable: true
            boosted_keywords:
              type: string
              nullable: true
            boost_dynamic_variables:
              type: boolean
              nullable: true
            reminder_message_interval:
              type: number
              nullable: true
            reminder_message_content:
              type: string
              nullable: true
            default_dynamic_variables:
              nullable: true
            call_transfer_settings:
              nullable: true
            agent_identity:
              type: string
              nullable: true
            agent_background:
              type: string
              nullable: true
            node_positions:
              type: string
              nullable: true
            ivr_menu:
              type: object
              additionalProperties: true
              nullable: true
            audio_cache_enabled:
              type: boolean
              nullable: true
            language:
              type: object
              nullable: true
              additionalProperties: true
              description: >-
                Associated resource when configured. Included record; its own
                IDs are unprefixed.
            voice:
              type: object
              nullable: true
              additionalProperties: true
              description: >-
                Associated resource when configured. Included record; its own
                IDs are unprefixed.
            llm:
              type: object
              nullable: true
              additionalProperties: true
              description: >-
                Associated resource when configured. Included record; its own
                IDs are unprefixed.
            createdAt:
              type: string
              format: date-time
            updatedAt:
              type: string
              format: date-time
            end_call_on_hold_sec:
              type: integer
              nullable: true
              description: >-
                Seconds to wait in a confirmed hold before hanging up; null when
                disabled.
            language_default_message:
              type: string
              nullable: true
              description: Message spoken when the caller language is not supported.
            prompt_tokens:
              type: integer
              nullable: true
              description: Token count of the stored prompt, when computed.
            secondary_language_ids:
              type: array
              items:
                type: string
              description: Additional language IDs the version can switch to.
            speech_to_speech_english_accent:
              type: string
              enum:
                - indian
                - british
                - american
              description: >-
                Accent of the agent's English on Speech-to-Speech calls: indian
                (default), british or american.
            pronunciations:
              type: array
              description: Pronunciation overrides for this version.
              items:
                type: object
                properties:
                  id:
                    type: string
                  agent_id:
                    type: string
                    description: Unprefixed agent ID.
                  version_number:
                    type: string
                  original_word:
                    type: string
                  pronunciation_format:
                    type: string
                  phonetic_pronunciation:
                    type: string
                    nullable: true
                  is_deleted:
                    type: boolean
                  createdAt:
                    type: string
                    format: date-time
                  updatedAt:
                    type: string
                    format: date-time
            postcall_analysis:
              type: array
              description: >-
                Post-call fields of this version. llm_id is the extraction LLM
                (null for the workspace default).
              items:
                type: object
                properties:
                  id:
                    type: string
                  field_name:
                    type: string
                  field_description:
                    type: string
                    nullable: true
                  field_type:
                    type: string
                    enum:
                      - TEXT
                      - SELECTOR
                      - BOOLEAN
                      - NUMBER
                      - DATETIME
                  agent_version_number:
                    type: string
                  additional_fields:
                    nullable: true
                  display_order:
                    type: integer
                    nullable: true
                  llm_id:
                    type: string
                    nullable: true
                    example: llm_A1B2C3D4E5F6G7
            agent_functions:
              type: array
              description: >-
                Functions of this version. Returned by Get Agent, create and
                update; not by List Agents. agent_id is unprefixed.
              items:
                type: object
                properties:
                  id:
                    type: string
                  agent_id:
                    type: string
                  version_number:
                    type: string
                  display_name:
                    type: string
                    nullable: true
                  type:
                    type: string
                  description:
                    type: string
                    nullable: true
                  config:
                    type: object
                    additionalProperties: true
                    nullable: true
        versions:
          type: array
          description: Every version, newest first.
          items:
            type: object
            properties:
              agent_id:
                type: string
              version_number:
                type: string
                example: '1'
                description: >-
                  Version number. Serialized as a string (the column is a 64-bit
                  integer).
              version_title:
                type: string
                nullable: true
              title:
                type: string
                nullable: true
              description:
                type: string
                nullable: true
              llm_id:
                type: string
                nullable: true
              language_id:
                type: string
              voice_id:
                type: string
              voice_model_id:
                type: string
                nullable: true
              voice_speed:
                type: number
                nullable: true
              voice_temperature:
                type: number
                nullable: true
              voice_volume:
                type: number
                nullable: true
              voice_pitch:
                type: number
                nullable: true
              prompt_text:
                type: string
              system_prompt_text:
                type: string
                nullable: true
              conversation_start_type:
                type: string
              welcome_message:
                type: string
                nullable: true
              knowledge_base_ids:
                type: array
                items:
                  type: string
                nullable: true
              kb_max_chunks:
                type: number
                nullable: true
              kb_min_score:
                type: number
                nullable: true
              is_published:
                type: boolean
              voicemail_detection:
                type: boolean
                nullable: true
              hangup_on_voicemail:
                type: boolean
                nullable: true
              voicemail_message:
                type: string
                nullable: true
              end_call_on_silence_sec:
                type: number
              max_call_duration_sec:
                type: number
              ring_duration_sec:
                type: number
              background_sound:
                type: string
                nullable: true
              ambient_noise:
                type: boolean
              background_sound_volume:
                type: number
              llm_temperature:
                type: number
              fallback_llm_enabled:
                type: boolean
                nullable: true
              llm_fallback_delay_ms:
                type: number
                nullable: true
              llm_fallback_model:
                type: string
                nullable: true
              fallback_stt_enabled:
                type: boolean
                nullable: true
              stt_fallback_wait_ms:
                type: number
                nullable: true
              stt_fallback_transcriber_id:
                type: string
                nullable: true
              predictive_preprocessing_enabled:
                type: boolean
                nullable: true
              prompt_caching_enabled:
                type: boolean
                nullable: true
              responsiveness:
                type: number
              interruption_sensitivity:
                type: number
              response_eagerness:
                type: number
              transcriber_id:
                type: string
                nullable: true
              denoising_mode:
                type: string
                nullable: true
              denoise_strength:
                type: number
                nullable: true
              boosted_keywords:
                type: string
                nullable: true
              boost_dynamic_variables:
                type: boolean
                nullable: true
              reminder_message_interval:
                type: number
                nullable: true
              reminder_message_content:
                type: string
                nullable: true
              default_dynamic_variables:
                nullable: true
              call_transfer_settings:
                nullable: true
              agent_identity:
                type: string
                nullable: true
              agent_background:
                type: string
                nullable: true
              node_positions:
                type: string
                nullable: true
              ivr_menu:
                type: object
                additionalProperties: true
                nullable: true
              audio_cache_enabled:
                type: boolean
                nullable: true
              language:
                type: object
                nullable: true
                additionalProperties: true
                description: >-
                  Associated resource when configured. Included record; its own
                  IDs are unprefixed.
              voice:
                type: object
                nullable: true
                additionalProperties: true
                description: >-
                  Associated resource when configured. Included record; its own
                  IDs are unprefixed.
              llm:
                type: object
                nullable: true
                additionalProperties: true
                description: >-
                  Associated resource when configured. Included record; its own
                  IDs are unprefixed.
              createdAt:
                type: string
                format: date-time
              updatedAt:
                type: string
                format: date-time
              end_call_on_hold_sec:
                type: integer
                nullable: true
                description: >-
                  Seconds to wait in a confirmed hold before hanging up; null
                  when disabled.
              language_default_message:
                type: string
                nullable: true
                description: Message spoken when the caller language is not supported.
              prompt_tokens:
                type: integer
                nullable: true
                description: Token count of the stored prompt, when computed.
              secondary_language_ids:
                type: array
                items:
                  type: string
                description: Additional language IDs the version can switch to.
              speech_to_speech_english_accent:
                type: string
                enum:
                  - indian
                  - british
                  - american
                description: >-
                  Accent of the agent's English on Speech-to-Speech calls:
                  indian (default), british or american.
              pronunciations:
                type: array
                description: Pronunciation overrides for this version.
                items:
                  type: object
                  properties:
                    id:
                      type: string
                    agent_id:
                      type: string
                      description: Unprefixed agent ID.
                    version_number:
                      type: string
                    original_word:
                      type: string
                    pronunciation_format:
                      type: string
                    phonetic_pronunciation:
                      type: string
                      nullable: true
                    is_deleted:
                      type: boolean
                    createdAt:
                      type: string
                      format: date-time
                    updatedAt:
                      type: string
                      format: date-time
              postcall_analysis:
                type: array
                description: >-
                  Post-call fields of this version. llm_id is the extraction LLM
                  (null for the workspace default).
                items:
                  type: object
                  properties:
                    id:
                      type: string
                    field_name:
                      type: string
                    field_description:
                      type: string
                      nullable: true
                    field_type:
                      type: string
                      enum:
                        - TEXT
                        - SELECTOR
                        - BOOLEAN
                        - NUMBER
                        - DATETIME
                    agent_version_number:
                      type: string
                    additional_fields:
                      nullable: true
                    display_order:
                      type: integer
                      nullable: true
                    llm_id:
                      type: string
                      nullable: true
                      example: llm_A1B2C3D4E5F6G7
              agent_functions:
                type: array
                description: >-
                  Functions of this version. Returned by Get Agent, create and
                  update; not by List Agents. agent_id is unprefixed.
                items:
                  type: object
                  properties:
                    id:
                      type: string
                    agent_id:
                      type: string
                    version_number:
                      type: string
                    display_name:
                      type: string
                      nullable: true
                    type:
                      type: string
                    description:
                      type: string
                      nullable: true
                    config:
                      type: object
                      additionalProperties: true
                      nullable: true
        prompt_health:
          type: object
          properties:
            status:
              type: string
              enum:
                - green
                - yellow
                - red
                - over_ceiling
                - not_applicable
            prompt_tokens:
              type: integer
              description: Estimated editable prompt tokens after expanding known defaults.
            limit_tokens:
              type: integer
            system_prompt_reserved_tokens:
              type: integer
            limited_by:
              type: string
              nullable: true
            comment:
              type: string
          description: >-
            Reported by create and update. Single Prompt and Speech to Speech
            prompts receive model-dependent size guidance; other agent types
            report not_applicable.
        createdAt:
          type: string
          format: date-time
          description: When the agent was created.
        updatedAt:
          type: string
          format: date-time
          description: When the agent record was last changed.
        organization_id:
          type: string
          example: o14XKPP84rt22g
          description: Owning organization.
        is_deleted:
          type: boolean
          description: >-
            Whether the agent has been deleted. The list endpoint returns only
            agents where this is false.
        organization:
          type: object
          description: The owning organization record.
          properties:
            id:
              type: string
            title:
              type: string
            description:
              type: string
              nullable: true
            status:
              type: string
            org_code:
              type: string
            createdAt:
              type: string
              format: date-time
            updatedAt:
              type: string
              format: date-time
        inbound_phone_numbers:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                example: phn_abc123
              phone_number:
                type: string
                example: '9876543210'
                description: The number without its country calling code.
              country_iso:
                type: string
                example: '91'
                description: Country calling code.
              nickname:
                type: string
                nullable: true
                description: Label set in the dashboard.
              sip_trunk_enabled:
                type: boolean
              linked_at:
                type: string
                format: date-time
                nullable: true
                description: When the number was linked to the agent, when known.
            required:
              - id
              - phone_number
              - country_iso
              - nickname
              - sip_trunk_enabled
              - linked_at
          description: Numbers that ring this agent. Up to 3.
        outbound_phone_numbers:
          type: array
          items:
            type: object
            properties:
              id:
                type: string
                example: phn_abc123
              phone_number:
                type: string
                example: '9876543210'
                description: The number without its country calling code.
              country_iso:
                type: string
                example: '91'
                description: Country calling code.
              nickname:
                type: string
                nullable: true
                description: Label set in the dashboard.
              sip_trunk_enabled:
                type: boolean
              linked_at:
                type: string
                format: date-time
                nullable: true
                description: When the number was linked to the agent, when known.
            required:
              - id
              - phone_number
              - country_iso
              - nickname
              - sip_trunk_enabled
              - linked_at
          description: Numbers the agent can call from. Up to 3.
        running_batches:
          type: array
          description: >-
            Returned only when the request publishes a draft (without
            update_deployment), and absent from the response otherwise: batches
            already running on this agent. They keep the version they were
            created with.
          items:
            type: object
            properties:
              id:
                type: string
                example: batch_2g7Xy3tY53gRlp
              title:
                type: string
              agent_version_number:
                type: integer
      required:
        - id
        - agent_type
    ErrorResponse:
      type: object
      description: Error body on endpoints without response filtering.
      properties:
        statusCode:
          type: integer
          example: 404
        error:
          type: boolean
          enum:
            - true
        success:
          type: boolean
          enum:
            - false
        data:
          oneOf:
            - type: object
              properties:
                code:
                  type: string
                  description: Machine-readable refusal code.
            - type: array
              items: {}
          description: >-
            For a coded refusal, an object with code and the details listed for
            that code. Otherwise an empty array.
        message:
          type: string
        errors:
          type: array
          items:
            type: string
          description: Validation messages for a 400. Empty for other errors.
        validation_errors:
          type: array
          description: >-
            Present when uploaded rows fail number validation (batch and
            workflow lead uploads): one group per distinct error.
          items:
            type: object
            properties:
              error:
                type: string
              rows:
                type: array
                items:
                  type: integer
                description: Row numbers with this error.
              phone_numbers:
                type: array
                items:
                  type: string
        invalid_row_count:
          type: integer
          description: 'Present with validation_errors: how many rows failed.'
      required:
        - statusCode
        - error
        - success
        - data
        - message
        - errors
    CodedErrorResponse:
      type: object
      description: Error body for a coded refusal; data carries code and its details.
      properties:
        statusCode:
          type: integer
          example: 404
        error:
          type: boolean
          enum:
            - true
        success:
          type: boolean
          enum:
            - false
        data:
          oneOf:
            - type: object
              properties:
                code:
                  type: string
                  description: Machine-readable refusal code.
            - type: array
              items: {}
          description: >-
            For a coded refusal, an object with code and the details listed for
            that code. Otherwise an empty array.
        message:
          type: string
        errors:
          type: array
          items:
            type: string
          description: Validation messages for a 400. Empty for other errors.
        validation_errors:
          type: array
          description: >-
            Present when uploaded rows fail number validation (batch and
            workflow lead uploads): one group per distinct error.
          items:
            type: object
            properties:
              error:
                type: string
              rows:
                type: array
                items:
                  type: integer
                description: Row numbers with this error.
              phone_numbers:
                type: array
                items:
                  type: string
        invalid_row_count:
          type: integer
          description: 'Present with validation_errors: how many rows failed.'
      required:
        - statusCode
        - error
        - success
        - data
        - message
        - errors
    PronunciationItem:
      type: object
      properties:
        original_word:
          type: string
          maxLength: 128
          description: Word
          example: Nexa
        pronunciation_format:
          type: string
          maxLength: 128
          description: Pronunciation
          example: Nek-sa
        phonetic_pronunciation:
          type: string
          maxLength: 128
          description: Approx pronunciation
          example: Nek-sa
      required:
        - original_word
        - pronunciation_format
  securitySchemes:
    bearer:
      scheme: bearer
      type: http

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.