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

# Connect a sender to an agent

> Make the agent answer on this sender. An agent can serve several senders; a sender answers with at most one agent, so connecting one that is already in use returns `400` naming the agent that holds it.



## OpenAPI

````yaml /openapi.json post /v1/agents/{agentId}/senders
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,
    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, 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}/senders:
    post:
      tags:
        - Agents
      summary: Connect a sender to an agent
      description: >-
        Make the agent answer on this sender. An agent can serve several
        senders; a sender answers with at most one agent, so connecting one that
        is already in use returns `400` naming the agent that holds it.
      operationId: attachAgentSender
      parameters:
        - $ref: '#/components/parameters/AgentIdParam'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              required:
                - senderId
              properties:
                senderId:
                  type: string
                  description: Sender to connect.
      responses:
        '201':
          description: Sender connected.
          content:
            application/json:
              schema:
                type: object
                required:
                  - agent
                properties:
                  agent:
                    $ref: '#/components/schemas/Agent'
        '400':
          description: senderId missing, or the sender already answers with another agent.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '404':
          description: Agent or sender 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:
    Agent:
      type: object
      description: AI Agent configuration for a sender.
      required:
        - id
        - senderId
        - name
        - enabled
        - provider
        - model
        - systemPrompt
        - createdAt
        - updatedAt
      properties:
        id:
          type: string
          example: agent_abc123
        senderId:
          type: string
          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. Requires the Voice Agents feature to be
            enabled for your team.
        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). Requires the Voice Agents feature
        to be enabled for your team.
      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

````