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

# Egress & Fallback

> How a WhatsApp Alternative number reaches WhatsApp: the managed Zavu residential proxy, your own Android device, and automatic fallback between them.

WhatsApp watches the network path a linked number connects from. To keep a number healthy, every WhatsApp Alternative session egresses through an **in-country residential IP** and always appears from the **same exit** — never a datacenter or server IP, which is a fast route to a block.

You choose how the number reaches WhatsApp with the session's `egress`.

<Warning>
  Direct egress (connecting from a server / datacenter IP) is not supported and can never be set — it is a guaranteed block. Every session must use either the Zavu residential proxy or an Android egress device.
</Warning>

## Egress options

<CardGroup cols={2}>
  <Card title="Zavu Residential Proxy" icon="cloud">
    **`external` — default.** Zavu routes the number through a managed in-country residential IP, geo-matched to the number's country and pinned stable per session. Metered and billed per GB.
  </Card>

  <Card title="Android Egress Device" icon="mobile">
    **`android`.** The number egresses through a phone you control, running the Zavu Egress Node app. Uses the device's own connection — no per-GB charge.
  </Card>
</CardGroup>

### Set the egress on a session

Pass `egress` when creating a session, or change it later with `POST /v1/whatsapp-alt/sessions/{sessionId}/egress`. It takes effect on the next connect.

<CodeGroup>
  ```bash Zavu proxy (default) theme={null}
  curl -X POST https://api.zavu.dev/v1/whatsapp-alt/sessions \
    -H "Authorization: Bearer $ZAVU_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "displayName": "Support line",
      "egress": { "kind": "external", "country": "cl" }
    }'
  ```

  ```bash Android device theme={null}
  curl -X POST https://api.zavu.dev/v1/whatsapp-alt/sessions \
    -H "Authorization: Bearer $ZAVU_API_KEY" \
    -H "Content-Type: application/json" \
    -d '{
      "displayName": "Support line",
      "egress": { "kind": "android", "nodeId": "nd_abc123" }
    }'
  ```
</CodeGroup>

`country` is optional — when omitted, Zavu derives it from the number so the exit matches the number's own country.

## Is the managed proxy available?

Check whether the managed Zavu proxy is currently offered for your team before defaulting to it:

<CodeGroup>
  ```bash cURL theme={null}
  curl https://api.zavu.dev/v1/whatsapp-alt/proxy-status \
    -H "Authorization: Bearer $ZAVU_API_KEY"
  ```

  ```typescript TypeScript theme={null}
  const { zavuProxyAvailable } = await zavu.whatsappAlt.proxyStatus();
  ```
</CodeGroup>

When `zavuProxyAvailable` is `false`, pair an Android egress node instead.

## Pairing an Android egress node

An egress node is a phone running the Zavu Egress Node app that lends its connection to a sender's sessions.

<Steps>
  <Step title="Create the node">
    Register a node for a sender. The response includes a short-lived pairing payload (`token`, `gatewayUrl`, `wsPath`).

    ```bash theme={null}
    curl -X POST https://api.zavu.dev/v1/whatsapp-alt/egress-nodes \
      -H "Authorization: Bearer $ZAVU_API_KEY" \
      -H "Content-Type: application/json" \
      -d '{ "senderId": "sender_12345", "label": "Store phone" }'
    ```
  </Step>

  <Step title="Pair the device">
    Encode `token`, `gatewayUrl`, and `wsPath` into a QR and scan it from the Zavu Egress Node Android app. The token isn't stored — re-issue it with `POST /v1/whatsapp-alt/egress-nodes/{nodeId}/pairing-token` to show the QR again.
  </Step>

  <Step title="Use the node">
    Once the node is `online`, set a session's egress to `{ "kind": "android", "nodeId": "<nodeId>" }`.
  </Step>
</Steps>

Node status is `pending` (paired but never connected), `online` (tunnel live), or `offline` (last tunnel dropped). List a sender's nodes with `GET /v1/whatsapp-alt/egress-nodes?senderId=...`, and revoke one with `DELETE /v1/whatsapp-alt/egress-nodes/{nodeId}` (this also kills its live tunnel).

## Automatic fallback (stay 100% active)

An Android device can go offline — the phone loses signal, is powered off overnight, or changes networks. When you run a session on an Android node, Zavu can **automatically fall back to the managed Zavu proxy** so the number stays connected, then **switch back to the device** when it comes online again.

* While the fallback is active, traffic runs through the Zavu residential proxy and is billed per GB (see below).
* While on the Android device, there is no per-GB charge — it uses the device's own bandwidth.
* If the device is offline and fallback is not enabled, the session waits for the device to return without dropping the link (no re-scan needed).

This keeps a device-backed number available even while the device is unreachable, and you only pay for proxy GB during the fallback window.

## Per-GB billing

Traffic through the **Zavu residential proxy** (`external`, including active fallback) is metered and charged to your team balance per GB. Traffic through an **Android egress device** is not charged — it uses the device's own connection.

* The **per-GB rate depends on your plan**: it starts at **$2.99/GB** and decreases on higher plans (down to **$0.99/GB**). Your current rate and usage are shown in the dashboard.
* Only `external` proxy traffic is metered; `android` egress reports no billable bytes.
* Usage is measured in decimal GB and swept to your balance.

<Tip>
  Use an Android egress device for cost-sensitive, steady numbers (no per-GB charge), and rely on the Zavu proxy — or fallback — when you need a managed exit or maximum uptime.
</Tip>

## Next steps

<CardGroup cols={2}>
  <Card title="Sessions" icon="qrcode" href="/guides/whatsapp-alt/sessions">
    Create a session and link it to a sender.
  </Card>

  <Card title="Sending & Receiving" icon="messages" href="/guides/whatsapp-alt/sending-receiving">
    Send on the `whatsapp_alt` channel and handle inbound webhooks.
  </Card>
</CardGroup>
