# CLI Quickstart

> Send your first email from the terminal. MailBlastr has no dedicated CLI binary — curl plus jq covers the full API.

MailBlastr does not ship a dedicated command-line binary. Because the API is a plain JSON REST API, the terminal you already have — `curl` for requests and `jq` for slicing JSON — drives the entire surface, the same way in scripts, CI/CD, and one-off debugging.

This quickstart uses `curl` so it works on any machine with nothing to install.

## Prerequisites

Before you start, you need:

- A MailBlastr [API key](https://www.mailblastr.com/docs/api/api-keys-create) — a `mb_`-prefixed secret.
- A [verified domain](https://www.mailblastr.com/docs/domains/managing) to send from.

## 1. Authenticate

There is no `login` step. Export your key once so it never lands in your shell history, then reference it from every request via the `Authorization` header.

```bash
export MAILBLASTR_API_KEY=mb_xxxxxxxxx

# Verify the key works by listing your domains
curl 'https://api.mailblastr.com/domains' \
  -H "Authorization: Bearer $MAILBLASTR_API_KEY"
```

> **Warning:** Never paste a live key into a command you will commit or share. Use an environment variable or your CI secret store so the key stays out of shell history and version control.

## 2. Send email

The terminal equivalent of [POST /emails](https://www.mailblastr.com/docs/api/emails-send) — a single HTTP call to send a message.

```bash
curl -X POST 'https://api.mailblastr.com/emails' \
  -H "Authorization: Bearer $MAILBLASTR_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{
    "from": "Acme <onboarding@yourdomain.com>",
    "to": ["delivered@example.com"],
    "subject": "Hello World",
    "text": "Sent from my terminal."
  }'
```

Capture just the new email `id` by piping the response through `jq`:

```bash
curl -s -X POST 'https://api.mailblastr.com/emails' \
  -H "Authorization: Bearer $MAILBLASTR_API_KEY" \
  -H 'Content-Type: application/json' \
  -d '{ "from": "Acme <onboarding@yourdomain.com>", "to": ["delivered@example.com"], "subject": "Hello World", "text": "Sent from my terminal." }' \
  | jq -r '.id'
```

## Next steps

For agent and CI workflows — piping content from stdin, batch sends, idempotency keys, and scheduling — see the [CLI for AI agents](https://www.mailblastr.com/docs/resources/cli-agents) guide. For the full set of `curl` recipes (HTML from a file, error handling, GitHub Actions), see the [CLI](https://www.mailblastr.com/docs/resources/cli) reference. For every endpoint and field, see the [API reference](https://www.mailblastr.com/docs/api/emails-send).

> **Note:** Want a typed client instead of raw `curl`? Install the official `mailblastr` Node SDK — see [SDKs](https://www.mailblastr.com/docs/resources/sdks).
