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

# Create WhatsApp Alternative session

> Create a session and start the bridge. The QR is generated asynchronously: poll `GET /v1/whatsapp-alt/sessions/{sessionId}` until `status` is `qr_ready` and `qrCode` is present, then scan it from the phone (WhatsApp → Linked devices → Link a device).

The session routes through an egress from the first QR. It defaults to the managed Zavu proxy (`egress.kind = external`); pass `egress` to override. Direct (server IP) egress is not supported. Not available with test-mode API keys.



## OpenAPI

````yaml /openapi.json post /v1/whatsapp-alt/sessions
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/whatsapp-alt/sessions:
    post:
      tags:
        - WhatsApp Alternative
      summary: Create WhatsApp Alternative session
      description: >-
        Create a session and start the bridge. The QR is generated
        asynchronously: poll `GET /v1/whatsapp-alt/sessions/{sessionId}` until
        `status` is `qr_ready` and `qrCode` is present, then scan it from the
        phone (WhatsApp → Linked devices → Link a device).


        The session routes through an egress from the first QR. It defaults to
        the managed Zavu proxy (`egress.kind = external`); pass `egress` to
        override. Direct (server IP) egress is not supported. Not available with
        test-mode API keys.
      operationId: createWhatsAppAltSession
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/WhatsAppAltSessionCreateRequest'
            examples:
              default:
                summary: Default (managed Zavu proxy)
                value:
                  displayName: Support line
              android:
                summary: Route through a customer Android device
                value:
                  displayName: Support line
                  egress:
                    kind: android
                    nodeId: nd_abc123
                    country: cl
      responses:
        '201':
          description: Session created.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/WhatsAppAltSessionResponse'
        '400':
          description: Invalid request, or whatsapp_alt is not available in test mode.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - bearerAuth: []
components:
  schemas:
    WhatsAppAltSessionCreateRequest:
      type: object
      properties:
        displayName:
          type: string
          maxLength: 200
          description: Optional label for the session.
        egress:
          $ref: '#/components/schemas/WhatsAppAltEgressInput'
    WhatsAppAltSessionResponse:
      type: object
      required:
        - session
      properties:
        session:
          $ref: '#/components/schemas/WhatsAppAltSession'
    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
    WhatsAppAltEgressInput:
      type: object
      description: >-
        Egress to set on a session. Only `external` (managed Zavu proxy) and
        `android` (a customer device) are accepted — `direct` is a guaranteed
        ban and is rejected.
      required:
        - kind
      properties:
        kind:
          type: string
          enum:
            - external
            - android
        nodeId:
          type: string
          description: Egress node ID. Required when `kind` is `android`.
        country:
          type: string
          minLength: 2
          maxLength: 2
          description: >-
            ISO 3166-1 alpha-2 country code to geo-match the proxy exit.
            Optional; auto-derived from the number when omitted.
          example: cl
    WhatsAppAltSession:
      type: object
      required:
        - id
        - status
        - egress
        - createdAt
      properties:
        id:
          type: string
          example: jd7x2k3m4n5p6q7r8s9t0
        displayName:
          type: string
        status:
          $ref: '#/components/schemas/WhatsAppAltSessionStatus'
        qrCode:
          type: string
          description: >-
            QR payload to render as a QR code and scan from the phone's WhatsApp
            (Linked devices → Link a device). Present only while `status` is
            `qr_ready`. Poll `GET /v1/whatsapp-alt/sessions/{sessionId}` until
            it appears; it rotates until scanned.
        phoneNumber:
          type: string
          description: Linked WhatsApp number in E.164 format, once the session is ready.
          example: '+56912345678'
        pushName:
          type: string
          description: WhatsApp profile name of the linked account.
        egress:
          $ref: '#/components/schemas/WhatsAppAltEgressSpec'
        senderId:
          type: string
          description: ID of the sender this session is linked to, if any.
        lastError:
          type: string
          nullable: true
        lastConnectedAt:
          type: string
          format: date-time
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
    WhatsAppAltSessionStatus:
      type: string
      description: |-
        Connection state of the session, mirrored from the bridge.
        - `initializing`: session created, bridge starting.
        - `qr_ready`: `qrCode` is available; scan it from WhatsApp to link.
        - `authenticating`: QR scanned, handshaking.
        - `ready`: linked and connected.
        - `disconnected`: unlinked or dropped.
        - `failed`: could not connect (see `lastError`).
      enum:
        - disconnected
        - initializing
        - qr_ready
        - authenticating
        - ready
        - failed
    WhatsAppAltEgressSpec:
      type: object
      description: Egress routing for a WhatsApp Alternative session.
      required:
        - kind
      properties:
        kind:
          $ref: '#/components/schemas/WhatsAppAltEgressKind'
        nodeId:
          type: string
          description: Egress node ID. Required when `kind` is `android`.
        country:
          type: string
          minLength: 2
          maxLength: 2
          description: >-
            ISO 3166-1 alpha-2 country code (lowercased) used to geo-match the
            proxy exit to the number's country. Optional; auto-derived from the
            phone number when omitted.
          example: cl
    WhatsAppAltEgressKind:
      type: string
      description: >-
        How a WhatsApp Alternative session reaches WhatsApp.

        - `external`: managed Zavu proxy (an in-country mobile/residential IP).
        Default.

        - `android`: a customer-owned Android egress device that lends its IP
        (requires `nodeId`).


        `direct` (Zavu server IP) is a guaranteed ban and cannot be set through
        the API; it may only appear on legacy sessions.
      enum:
        - external
        - android
        - direct
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````