# CLI

Source: https://docs.simail.ai/cli/

> The simail command-line client — installation, how it reads your key, output modes and exit codes for scripts and agents.

The `simail` CLI is a small client over the [REST API](/api/), built on the TypeScript SDK. It is
meant for scripts and for agents that work in a terminal.

```sh
npm install -g @simail/cli
simail beta
```

```text
signup=waitlist waitlist=open https://simail.ai/waitlist
```

## Configuration

| Setting | How |
|---|---|
| API key | **only** from the `SIMAIL_API_KEY` environment variable. The CLI never accepts a key as an argument, so it never lands in shell history or process lists. |
| API base URL | `--base-url <url>` or `SIMAIL_BASE_URL` (default `https://api.simail.ai`) |
| Output | human-readable by default; `--json` prints the raw JSON response |

```sh
export SIMAIL_API_KEY="sk_…"   # from your secret store
simail beta --json
```

## Commands

| Command | Does |
|---|---|
| `simail beta` | `GET /v0/beta`: whether sign-up and the waitlist are open, with the waitlist URL |

Run `simail` without arguments for usage.

## Exit codes

Scripts and agents should branch on the exit code, not on the text:

| Code | Meaning |
|---|---|
| `0` | success |
| `1` | usage error (unknown command or flag) |
| `2` | authentication failed (`401`): missing, invalid, expired or revoked key |
| `3` | refused (`403`): missing permission, `human_required`, `signup_closed`, `claim_required` … — tell your human, do not retry |
| `4` | not found (`404`), including objects outside your key's scope |
| `5` | rate limited (`429`): wait and retry |
| `6` | server or network error: retry later |

On an error the CLI prints the problem's `message` and exits with the code above. For the full
problem+json (`code`, `retryable`, `request_id`, `human_message`), make the same call with the
[SDK](/sdk/) or `curl`.
