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

# Update an agent



## OpenAPI

````yaml /openapi.json patch /v1/agents/{agentId}
openapi: 3.0.3
info:
  title: Zavu Unified Messaging Layer API
  version: 0.2.0
  description: >
    Unified multi-channel messaging API for Zavu.


    Supported channels:

    - **SMS**: Simple text messages

    - **WhatsApp**: Rich messaging with media, buttons, lists, CTA URL buttons,
    location requests, and templates

    - **Telegram**: Bot messaging with text, media, and interactive elements

    - **Email**: Transactional emails via Amazon SES


    Design goals:

    - Simple `send()` entrypoint for developers

    - Project-level authentication via Bearer token

    - Support for all WhatsApp message types (text, image, video, audio,
    document, sticker, location, contact, buttons, list, cta_url,
    location_request, reaction, template)

    - If a non-text message type is sent, WhatsApp channel is used automatically

    - 24-hour WhatsApp conversation window enforcement

    - Universal `to` field accepts phone numbers (E.164), email addresses, or
    numeric chat IDs (Telegram/Instagram/Messenger)
servers:
  - url: https://api.zavu.dev
security:
  - bearerAuth: []
paths:
  /v1/agents/{agentId}:
    patch:
      tags:
        - Agents
      summary: Update an agent
      operationId: updateAgentById
      parameters:
        - $ref: '#/components/parameters/AgentIdParam'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AgentUpdateRequest'
      responses:
        '200':
          description: Agent updated.
          content:
            application/json:
              schema:
                type: object
                required:
                  - agent
                properties:
                  agent:
                    $ref: '#/components/schemas/Agent'
        '400':
          description: Invalid request.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Agent not found.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  parameters:
    AgentIdParam:
      name: agentId
      in: path
      required: true
      description: Agent ID.
      schema:
        type: string
  schemas:
    AgentUpdateRequest:
      type: object
      properties:
        name:
          type: string
          maxLength: 100
        enabled:
          type: boolean
        provider:
          $ref: '#/components/schemas/AgentProvider'
        model:
          type: string
        systemPrompt:
          type: string
          maxLength: 10000
        apiKey:
          type: string
          description: >-
            API key for the LLM provider, stored and attached to the agent. Send
            it with `provider` when the agent does not already hold a key for
            that provider: an update that would leave the agent on a key for a
            different provider is refused with `400 invalid_request`, and one
            that leaves it with no key at all is refused too. Moving to `zavu`
            needs no key.
        contextWindowMessages:
          type: integer
          minimum: 1
          maximum: 50
        includeContactMetadata:
          type: boolean
        maxTokens:
          type: integer
          minimum: 1
          maximum: 4096
          nullable: true
        temperature:
          type: number
          minimum: 0
          maximum: 2
          nullable: true
        triggerOnChannels:
          type: array
          items:
            type: string
        triggerOnMessageTypes:
          type: array
          items:
            type: string
        voice:
          $ref: '#/components/schemas/AgentVoiceConfig'
          description: >-
            Voice Agent configuration. Patch this object to enable voice, change
            the greeting, or adjust call limits.
    Agent:
      type: object
      description: AI Agent configuration for a sender.
      required:
        - id
        - name
        - enabled
        - provider
        - model
        - systemPrompt
        - createdAt
        - updatedAt
      properties:
        id:
          type: string
          example: agent_abc123
        senderId:
          type: string
          description: >-
            The sender the agent was created on, its primary. Absent on an agent
            created with `POST /v1/agents`, which has no primary even after
            senders are connected to it. `senderIds` lists every sender the
            agent answers on.
          example: sender_12345
        name:
          type: string
          example: Customer Support Agent
        enabled:
          type: boolean
          description: Whether the agent is active.
        provider:
          $ref: '#/components/schemas/AgentProvider'
        model:
          type: string
          description: Model ID (e.g., gpt-4o-mini, claude-3-5-sonnet).
          example: gpt-4o-mini
        systemPrompt:
          type: string
          description: System prompt for the agent.
        contextWindowMessages:
          type: integer
          description: Number of previous messages to include as context.
          default: 10
        includeContactMetadata:
          type: boolean
          description: Whether to include contact metadata in context.
          default: true
        maxTokens:
          type: integer
          description: Maximum tokens for LLM response.
          nullable: true
        temperature:
          type: number
          description: LLM temperature (0-2).
          nullable: true
        triggerOnChannels:
          type: array
          items:
            type: string
          description: Channels that trigger the agent.
          example:
            - sms
            - whatsapp
        triggerOnMessageTypes:
          type: array
          items:
            type: string
          description: Message types that trigger the agent.
          example:
            - text
        stats:
          type: object
          properties:
            totalInvocations:
              type: integer
            totalTokensUsed:
              type: integer
            totalCost:
              type: number
              description: Total cost in USD.
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        voice:
          $ref: '#/components/schemas/AgentVoiceConfig'
          description: >-
            Voice Agent configuration. When present and enabled, the agent can
            answer inbound phone calls and place outbound calls with Zavu's
            managed voice pipeline.
        senderIds:
          type: array
          items:
            type: string
          description: >-
            Senders this agent answers on. An agent can serve several;
            `senderId` remains the primary one, for compatibility.
    Error:
      type: object
      required:
        - code
        - message
      properties:
        code:
          type: string
          example: invalid_request
        message:
          type: string
          example: Phone number is invalid
        details:
          type: object
          additionalProperties: true
    AgentProvider:
      type: string
      description: LLM provider for the AI agent.
      enum:
        - openai
        - anthropic
        - google
        - mistral
        - zavu
    AgentVoiceConfig:
      type: object
      description: >-
        Voice Agent configuration on a sender's AI agent. Controls how the agent
        behaves on inbound and outbound phone calls through Zavu's managed voice
        pipeline (speech recognition, the agent's LLM, and speech synthesis,
        with real-time interruption handling).
      required:
        - enabled
      properties:
        enabled:
          type: boolean
          description: >-
            Whether the agent handles voice calls. When false, the sender's
            number is not answered by the voice agent and outbound calls are
            rejected.
        greeting:
          type: string
          description: >-
            Opening line the agent speaks when the call connects. If omitted,
            the agent waits for the caller to speak first.
          maxLength: 1000
          example: Hi, thanks for calling Acme. How can I help you today?
        greetings:
          type: object
          additionalProperties:
            type: string
          description: >-
            Greeting per language, keyed by language code. Used when the
            caller's language differs from the one `greeting` is written in.
          example:
            es: Hola, soy Atlas. Preguntame lo que quieras.
        language:
          type: string
          description: >-
            BCP-47 language code used for both speech recognition and speech
            synthesis (e.g. `en`, `es`, `pt-BR`). Auto-detected from the
            recipient when omitted.
          example: en
        model:
          type: string
          description: >-
            Model that runs the conversation, co-located in the voice network
            for lowest latency. Independent of the model used for text
            messaging. Derived from the agent's text model when omitted.
          example: openai/gpt-4o
        sttProvider:
          type: string
          description: Speech-recognition provider. Uses the default when omitted.
        sttModel:
          type: string
          description: Speech-recognition model. Uses the default when omitted.
        ttsProvider:
          type: string
          description: Speech-synthesis provider. Uses the default when omitted.
        ttsVoiceId:
          type: string
          description: >-
            Identifier of the synthesized voice that speaks. Choose from the
            voices available in the dashboard. Uses a neutral default when
            omitted.
          example: aria
        voiceSpeed:
          type: number
          description: >-
            Speech rate. 1.0 is natural. Only honoured by voices that support
            rate control; ignored by the others.
          minimum: 0.5
          maximum: 1.5
          default: 1
        interruptible:
          type: boolean
          description: >-
            Whether the caller can interrupt the agent while it is speaking
            (barge-in). When true, the agent stops talking as soon as the caller
            starts.
          default: true
        maxCallDurationMinutes:
          type: integer
          description: >-
            Hard limit on call length in minutes. The call ends automatically
            when reached.
          minimum: 1
          maximum: 120
          default: 15
        maxIdleSeconds:
          type: integer
          description: How long the agent waits during silence before ending the call.
          minimum: 5
          maximum: 300
          default: 30
        recordCalls:
          type: boolean
          description: Whether the call audio is recorded.
        voicemailAction:
          type: string
          description: >-
            What the agent does when an answering machine or voicemail is
            detected on an outbound call.
          enum:
            - hangup
            - leave_message
          default: hangup
        voicemailMessage:
          type: string
          description: >-
            Message spoken when `voicemailAction` is `leave_message`. Falls back
            to `greeting` when omitted.
          maxLength: 1000
        transferPhoneNumber:
          type: string
          description: >-
            E.164 phone number the agent can transfer the call to. When set, the
            agent is given a transfer tool it can use to hand the call to a
            human.
          example: '+14155551234'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````

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