# Quickstart with a key

Post a test letter in four calls. Test keys render a real proof, run every rule, and post nothing.

You need a test key (`as_test_…`). A person makes one in the console at https://app.atomside.com, under Agents. If your agent has no person yet, start with [`start_account`](start-account.md) instead.

```sh
export ATOMSIDE_API_KEY=as_test_…
```

## 1. Read the account

```sh
curl https://api.atomside.com/v1/account -H "Authorization: Bearer $ATOMSIDE_API_KEY"
```

`summary` says, in one paragraph, whether this is test or live mode, who letters are sent as, what is left to spend and whether the next letter goes ahead or waits for a person. Call it first, every time.

## 2. Quote the letter

```sh
curl -X POST https://api.atomside.com/v1/quotes \
  -H "Authorization: Bearer $ATOMSIDE_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "to": { "name": "Ms A. Sample", "line1": "12 Specimen Road", "town": "Exampleton", "postcode": "XX1 1XX" },
    "pages": [{ "text": "# Rent review\n\nDear Ms Sample,\n\nYour rent stays the same.", "format": "markdown" }]
  }'
```

The quote checks the address, renders the pages, fixes the print file by its SHA-256, and gives the price in credits and pounds. It is free and lasts 24 hours. `on_send` says what `send_letter` would do now: `goes_ahead`, `waits_for_approval` (and why) or `refused` (and why). Open `proof` to see exactly what will print.

Pages can be text, Markdown or HTML written in the call, a file from [`upload_file`](reference/upload_file.md), or an https link we fetch once.

## 3. Send it

```sh
curl -X POST https://api.atomside.com/v1/letters \
  -H "Authorization: Bearer $ATOMSIDE_API_KEY" \
  -H "Idempotency-Key: rent-review-2026-ms-sample" \
  -H "Content-Type: application/json" \
  -d '{ "quote": "qt_…" }'
```

Every send needs an idempotency key. A retry with the same key returns the same letter and sends nothing new. See [Idempotency](idempotency.md).

The answer is `"answer": "yes"` with the letter id, or a "not yet" in the [refusal shape](refusals.md): for example `needs_approval`, with a link for your person. See [Approvals](approvals.md).

## 4. Follow it

```sh
curl https://api.atomside.com/v1/letters/ltr_… -H "Authorization: Bearer $ATOMSIDE_API_KEY"
```

In test mode, move it along yourself with [`advance_test_letter`](reference/advance_test_letter.md): printing, printed, posted, on record. Each step sends the same webhook events a live letter would. Rehearse what goes wrong with the [test postcodes](test-mode.md).

## The same with the CLI

```sh
atomside get-account
atomside quote-letter --to '{"name":"Mr B. Specimen","line1":"14 Specimen Road","town":"Exampleton","postcode":"XX1 1XX"}' \
  --pages '[{"text":"Dear Mr Specimen,\n\nYour rent stays the same."}]'
atomside send-letter --quote qt_… --idempotency-key rent-review-2026-mr-specimen
atomside get-letter --letter ltr_…
```

See [The CLI](cli.md).
