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

# CLI

> Call the tenant API from the Watahub command-line tool.

The CLI uses the same tenant API key as `/v1`. There is no separate console credential. Run it from a checkout of the Watahub Enterprise Edition repository after `pnpm install --frozen-lockfile`.

```bash theme={null}
pnpm exec watahub login --api-key YOUR_API_KEY
# or: export WATAHUB_API_KEY=YOUR_API_KEY
```

`login` writes the key to `~/.watahub/config.json`. The default base URL is `https://cloud.watahub.dev`. Override it with `WATAHUB_BASE_URL` or `--base-url`.

## Commands

```bash theme={null}
pnpm exec watahub setup --origin https://app.example.com
pnpm exec watahub numbers list
pnpm exec watahub messages list
pnpm exec watahub messages send --phone-number-id <id> --to <wa_id> --text 'hola'
pnpm exec watahub webhooks new --url https://hooks.example/wa --secret <32+ chars> \
  --event whatsapp.message.received --phone-number-id <id>
pnpm exec watahub logs search --origin api --errors
pnpm exec watahub templates list [--waba-id <id>]
pnpm exec watahub broadcasts send --phone-number-id <id> --template <name> --language <code> \
  --to <wa_id> [--to ...]
```

`setup` only prints a hosted [connect](https://docs.watahub.dev/en/connect.md) URL. It never opens Facebook.

`setup` accepts optional `--customer`, `--success-redirect`, `--failure-redirect` and `--connection-type`. Without `--phone-number-id`, `webhooks new` creates a [project webhook](https://docs.watahub.dev/en/webhooks.md). Pass `--inactive` to create it disabled. `logs search` accepts `--origin` and `--errors`.

`broadcasts send` creates a draft and immediately queues it. The template must already be cached and `APPROVED`; [sync templates](https://docs.watahub.dev/en/templates.md) first. You can repeat `--to` for additional recipients.

See [authentication](https://docs.watahub.dev/en/authentication.md) for how the key is sent, and [errors](https://docs.watahub.dev/en/errors.md) for failed calls.


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