sendforai
v0.1.2
Published
Command line for SendForAI, the email API for AI agents. Every command prints JSON. Run it with npx sendforai.
Downloads
776
Maintainers
Readme
sendforai
Command line for SendForAI, the email API for AI agents. Built to be driven from a shell by an agent:
- Every command prints JSON to stdout and nothing else.
- Errors print
{"error":{"code","message","fix","details"}}to stderr and exit 1.fixsays what to do next. - Nothing ever prompts. No API keys: your identity is a key file on disk.
npx sendforai --help # or: npm i -g sendforaiNeeds Node 18.3 or newer.
60 seconds, no domain
npx sendforai sandbox
# { "domain": "k3f9...sandbox.sendforai.com", "key_file": "~/.sendforai/k3f9...key", "next": "..." }
npx sendforai send --from agent@<that domain> \
--to [email protected] --subject "Hi" --text "Hello"sandbox generates a key, saves it, and creates an account. A sandbox can use the whole API, but mail only reaches @simulator.sendforai.com (free, never delivered). When you have a domain, add it to the same account:
VERCEL_TOKEN=... npx sendforai dns setup --domain example.com --wait # or CLOUDFLARE_API_TOKENWith a domain
npx sendforai init example.com # prints the TXT record to publish
npx sendforai domains verify # prints the DKIM and MAIL FROM records
npx sendforai domains status # check progress, read "next"Or let the CLI publish every record with your DNS token (used locally, never sent to SendForAI):
VERCEL_TOKEN=... npx sendforai init example.com --dns --wait
npx sendforai send --from [email protected] --to [email protected] --subject "Hi" --markdown "**It works.**"init never overwrites a key: if ~/.sendforai/<domain>.key exists it is reused.
Commands
| Command | What it does |
| --- | --- |
| sandbox | Create a no-DNS identity for the simulator |
| init <domain> [--dns] [--wait] | Create or reuse a key for your domain, print the DNS record |
| dns setup [--domain d] [--wait] | Publish all DNS records via Vercel or Cloudflare |
| whoami | Domain, public key, key file, sandbox, auth mode (no network) |
| send --from --to --subject (--markdown\|--text\|--html\|--markdown-file\|--html-file) | Send. Also --reply-to, --stream, --max-cost, --idempotency-key, --dry-run |
| account / capacity / usage / pricing | Balance and domains, caps, this period's cost, published prices |
| topup [--amount 10] [--auto-topup] | Checkout link for a human to add credit |
| budget <usd> | Set the monthly budget (raising returns an approval link) |
| billing | Billing portal link for a human |
| operator | Operator page link for a human: see the account, add credit, budget, auto top-up, card, notice email |
| domains list\|add <name>\|status [name]\|verify [name] | Manage sending domains |
| contacts add <email> [--data json]\|list\|unsubscribe <email>\|import <file.json\|file.csv> | Manage contacts. CSV needs an email column; other columns go into data |
| broadcasts create --from --subject (--markdown\|--markdown-file\|--html-file)\|get <id>\|send <id>\|cancel <id> | Broadcasts. create also takes --filter json, --max-cost, --no-approval, --dry-run |
| events [--cursor c] [--type t] [--limit n] | Pull delivery events |
| token [--days 30] | Mint a bearer token for curl or hosted MCP (needs the key) |
| mcp | Print ready-to-paste MCP client config, local and hosted |
sendforai <command> --help shows options and examples.
Identity and environment
Resolved in this order: flags, environment, then ~/.sendforai/config.json (written by init and sandbox).
| Flag | Environment | Meaning |
| --- | --- | --- |
| --domain | SENDFORAI_DOMAIN | Identity domain |
| --key-file | SENDFORAI_PRIVATE_KEY_FILE | Path to the PKCS#8 PEM private key |
| | SENDFORAI_PRIVATE_KEY | The PEM itself; newlines may be literal \n |
| | SENDFORAI_TOKEN | Connection token, used when there is no key |
| --base-url | SENDFORAI_BASE_URL | API URL (default https://api.sendforai.com) |
| | VERCEL_TOKEN, VERCEL_TEAM_ID, CLOUDFLARE_API_TOKEN, SENDFORAI_DNS_PROVIDER | DNS provider for dns setup and init --dns |
Keys live at ~/.sendforai/<domain>.key (mode 0600, directory 0700). A private key is never printed unless you pass --print-key.
MIT
