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

# The wat CLI

> Book WAT rooms from the terminal. Install, log in, and the full command reference.

`wat` is a small command-line tool that books WAT rooms by driving the same public API the web app uses. The command is `wat`; the package is `@wat-toolbox/wat`.

## Install (or don't)

Zero-install: every command runs on demand through `npx`, which is what agents should default to:

```bash theme={null}
npx -y @wat-toolbox/wat rooms list
```

For regular use, install globally so the `wat` command is on your PATH:

```bash theme={null}
npm install -g @wat-toolbox/wat
wat --version
```

<Note>
  The [skills plugin](/plugin) shells out to `wat`, so the skills require the global install. Login state is shared either way — both forms read the same `~/.config/wat/config.json`, so you can log in via `npx` today and install globally later.
</Note>

## Log in

```bash theme={null}
wat login
```

This runs an email one-time-password flow: it sends a 6-digit code to your email and prompts for it. On your **first** login your account is created automatically if your email is on WAT's resident list (your company's domain, or your address added by a WAT admin) — otherwise login fails with `NOT_AUTHORIZED` and an **access request** is automatically filed with the WAT admins: you'll receive an email if it's approved, then log in again. It then mints an API key and stores it as your active profile in `~/.config/wat/config.json` (mode 0600). Every later command reuses this key.

```bash theme={null}
wat whoami    # confirm who you're logged in as, and your role
wat logout    # remove the local key (add --all to clear every profile)
```

To revoke a key everywhere (not just locally), run `wat keys revoke <id>` or use the **API keys** tab on the **Account** page in the [web app](/account).

### Non-interactive login (two-step)

Scripts and agents log in without a TTY in two calls. First send the code, then complete with the code your human reads from their inbox:

```bash theme={null}
# Step 1 — sends the 6-digit code to the inbox, then exits
wat login --email you@example.com --request-code --json

# Step 2 — completes WITHOUT re-sending (passing --code skips the send)
wat login --email you@example.com --code 123456 --key-name "my-agent" --json
```

Do not skip step 1: each send invalidates earlier codes, so completing must not trigger a fresh send — and with `--code` present, it doesn't.

| Flag                    | What it does                                                    |
| ----------------------- | --------------------------------------------------------------- |
| `--email <email>`       | The account email (otherwise prompted).                         |
| `--request-code`        | Send the login code and exit; complete later with `--code`.     |
| `--code <code>`         | The 6-digit code from the login email; skips the send + prompt. |
| `--profile-name <name>` | Name for the local profile (auto-derived if omitted).           |
| `--key-name <name>`     | Human-readable name for the minted API key.                     |

With `--json`, `wat login` never prompts: a missing required flag fails fast with a structured `MISSING_FLAG` error instead of hanging on input. See [Error codes](/errors), and the [Agent playbook](/agents) for the full conversational handoff.

## Command reference

<CodeGroup>
  ```bash Rooms theme={null}
  # List the active meeting rooms with capacity + description + photo URL + id
  wat rooms list

  # Admins: include archived rooms too
  wat rooms list --all
  ```

  ```bash Availability theme={null}
  # Free time ranges for a room over a window
  wat availability --room "Room A" --from 2026-06-10 --to 2026-06-11

  # Read bare times in another zone
  wat availability --room "Room A" --from "2026-06-10T09:00" --to "2026-06-10T18:00" --tz America/New_York
  ```

  ```bash Bookings theme={null}
  # List bookings (newest first, 50 by default), or just your own
  wat bookings list
  wat bookings list --limit 100
  wat bookings list --mine
  wat bookings list --room "Room A" --from 2026-06-10 --to 2026-06-11

  # Create a booking (title is optional; only you + admins see it)
  wat bookings create --room "Room A" --start "2026-06-10T10:00" --end "2026-06-10T11:00" --title "Sync"

  # Invite guests (comma-separated emails, max 10, any address) — they get the
  # invitation + reminder emails
  wat bookings create --room "Room A" --start "2026-06-10T10:00" --end "2026-06-10T11:00" \
    --guests "guest@client.com,partner@firm.be"

  # Edit your own booking before it starts (pass any subset of flags)
  wat bookings edit <id> --start "2026-06-10T11:00" --end "2026-06-10T12:00"
  wat bookings edit <id> --room "Room B" --title "Moved sync"

  # Replace the guest list (full replacement; --guests "" removes everyone)
  wat bookings edit <id> --guests "guest@client.com,newcomer@startup.io"

  # Cancel a booking by id
  wat bookings cancel <id>
  ```

  ```bash API keys theme={null}
  # List your API keys (name, prefix, created, last used)
  wat keys list

  # Revoke a key everywhere, not just locally
  wat keys revoke <id>
  ```

  ```bash Config theme={null}
  # Show profiles plus the resolved base URL and API-key source
  wat config show

  # Remove the entire local config file (all profiles)
  wat config clear
  ```
</CodeGroup>

You can pass `--room` either a room name (case-insensitive) or a room id. Run `wat rooms list` to see both.

Availability is clipped to the [opening hours](/booking-rules) (06:00 to 22:00 Europe/Brussels): time outside them never shows as free, and creating or editing a booking outside them is rejected with `outside_hours`.

Every command accepts `--json` for machine-readable output. The skills plugin relies on this; the envelope is `{ "success": true, "data": { ... } }` or `{ "success": false, "error": { ... } }`. The codes you can get back are listed on the [Error codes](/errors) page.

## Choosing the environment

The CLI defaults to **production** (`https://app.wat.com`). Pass `--env dev` to target the staging deployment, which reads development data. Use it only when you mean to.

```bash theme={null}
wat --env dev rooms list     # staging / development data
wat --env prod rooms list    # production (the default)
```

### Overrides and precedence

Any command also takes a per-call `--api-key <key>` and `--api-url <url>`, and three environment variables cover scripted use: `WAT_CLI_ENV` (`dev` or `prod`), `WAT_CLI_API_KEY`, and `WAT_CLI_API_BASE_URL`.

The base URL resolves in this order (highest wins):

1. The `--api-url` flag
2. `WAT_CLI_API_BASE_URL`
3. The active profile's stored base URL
4. `--env dev|prod`, or `WAT_CLI_ENV`
5. The production default

The API key resolves as `--api-key`, then `WAT_CLI_API_KEY`, then the active profile. Run `wat config show` to see exactly which source each one resolved from.

## Time and time zones

Bare datetimes such as `2026-06-10T10:00` are read as **Europe/Brussels** wall-clock, matching the web app, then converted to UTC for the API. Pass `--tz <IANA>` to read bare times in another zone, or include an explicit offset (`2026-06-10T10:00+02:00`) to pin the exact instant. Times are printed back in the same zone you gave, so what you type and what you see always agree.

<Note>
  Need to book conversationally instead of by hand? Install the [skills plugin](/plugin) and ask your agent. The skills wrap these same commands.
</Note>
