# The CLI

`atomside` has one command per operation, made from the same definitions as the REST API and the MCP tools, so its commands and flags are always the API's. It runs on Node 24.

**It is not published yet.** There is no `atomside` package on npm and nothing to install with a package manager today, and our repository is private, so until the CLI is published you can use it only from a copy of the repository that we have given you (ask at hello@atomside.com). Everything the CLI does, REST and MCP do too, with the same names: see [Operations](reference/README.md). This page will say so when it is published, with the install line.

From a copy of the repository, with Node 24 and pnpm 11:

```sh
cd app
pnpm install
node packages/cli/src/main.ts help
```

Wherever this page writes `atomside`, type `node packages/cli/src/main.ts` instead (or make it a shell alias).

```sh
export ATOMSIDE_API_KEY=as_test_…
atomside get-account
```

## Commands and flags

The command is the operation's name with dashes: `quote_letter` is `atomside quote-letter`. Each input field is a flag, with dashes: `timeout_seconds` is `--timeout-seconds`. `atomside <command> --help` lists them.

- Text and numbers are plain: `--letter ltr_…`, `--timeout-seconds 50`.
- True or false: `--colour` or `--colour false`.
- Objects and lists are JSON, or `@file.json` to read the JSON from a file: `--to '{"name":"Ms A. Sample","line1":"12 Specimen Road","postcode":"XX1 1XX"}'`.
- `@path` reads any text value from a file. For a file's bytes (`upload-file --content-base64 @letter.pdf`) it sends the file as base64.
- A field that takes one or more values can be repeated: `--status queued --status printing`.
- Every send needs `--idempotency-key`. A retry with the same key never sends twice.

```sh
atomside quote-letter \
  --to @recipient.json \
  --pages '[{"text":"Dear Ms Sample,\n\nYour rent stays the same.","format":"markdown"}]'
atomside send-letter --quote qt_… --idempotency-key rent-review-2026-ms-sample
atomside wait-for-approval --letter ltr_…
```

## Settings

| Setting                                    |                                                                                 |
| ------------------------------------------ | ------------------------------------------------------------------------------- |
| `ATOMSIDE_API_KEY`                         | Your key. Read from the environment only; never printed, never taken as a flag. |
| `ATOMSIDE_API_URL` or `--api-url`          | Default `https://api.atomside.com`.                                             |
| `ATOMSIDE_VERSION` or `--atomside-version` | A dated API version. See [Versioning](versioning.md).                           |
| `--json`                                   | Print the answer as JSON, exactly as the API gave it, with any key masked.      |

## Answers and refusals

An answer prints as `name: value` lines, with money in credits and pounds, and every id in it, so a script can read `letter: ltr_…` and follow with `get-letter`. A refusal prints what happened, the quote and letter it is about, whether money moved, when to retry, what to do next, and its details:

```text
Not yet (needs_approval): A person approves every letter from lettings-helper. It is waiting for approval.
quote: qt_…
letter: ltr_…
Money: 15 credits (£1.50) are held.
Retry: not_needed
Next: Do not resend. Show details.show_to_person, then call wait_for_approval.
Ask a person who can approve: Approve or decline this letter at https://app.atomside.com/a/…
Show your person: Letter to Ms A. Sample, 1 page, £1.50. It needs approval before it is posted. …
details:
  reason: asks_every_time
  status: waiting_for_approval
  …
```

The `Next:` line is the CLI's own: it is the code's "What to do next" from [Refusals](refusals.md), printed for you. The refusal itself has no such field; with `--json` you get the body exactly as REST and MCP give it.

Exit codes: 0 done, 1 refused, 2 the command line is wrong, 3 accepted but waiting (a letter exists, so do not send it again), 4 the API could not be reached.

## start-account

`atomside start-account --agent-name lettings-helper --idempotency-key first-run --key-file ./atomside-key` saves the new test key to the file (readable by you only) and prints the rest, with the key masked.

## Shell completion

```sh
eval "$(atomside completion bash)"
```
