CLI

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:

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.

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"
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 — a single HTTP call to send a message.

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:

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 guide. For the full set of curl recipes (HTML from a file, error handling, GitHub Actions), see the CLI reference. For every endpoint and field, see the API reference.

Want a typed client instead of raw curl? Install the official mailblastr Node SDK — see SDKs.