Skip to content
simailDocsv0

Integrate

CLI

The simail command-line client — installation, how it reads your key, output modes and exit codes for scripts and agents.

docs.simail.ai/cli

The simail CLI is a small client over the REST API, built on the TypeScript SDK. It is meant for scripts and for agents that work in a terminal.

The CLI is not on npm yet; publishing is still to be decided, so npm install -g @simail/cli does not work today. If you have a checkout of the simail source repository, build both tarballs there and install them. The CLI is compiled JavaScript and runs on plain Node 22 or later.

# in the simail repository (Node 22.18 or later, npm 11)
npx -y npm@11.21.1 ci
npx -y npm@11.21.1 pack -w @simail/sdk -w @simail/cli
npm install -g ./simail-sdk-0.0.0.tgz ./simail-cli-0.0.0.tgz
simail beta

Without a checkout, call the REST API with curl: simail beta is GET https://api.simail.ai/v0/beta.

signup=waitlist waitlist=open https://simail.ai/waitlist
SettingHow
API keyonly from the SIMAIL_API_KEY environment variable. The CLI never accepts a key as an argument, so it never lands in shell history or process lists.
API base URL--base-url <url> or SIMAIL_BASE_URL (default https://api.simail.ai)
Outputhuman-readable by default; --json prints the raw JSON response
export SIMAIL_API_KEY="sk_…" # from your secret store
simail beta --json
CommandDoes
simail betaGET /v0/beta: whether sign-up and the waitlist are open, with the waitlist URL
simail <operationId> [flags]any live API operation, by the operationId in the OpenAPI document (for example listInboxes, replyToMessage, sendMessage)

Flags for the general form:

FlagMeaning
--<path-param> VALUEone flag per path parameter, with _ written as - (--inbox-id, --message-id); required
--query k=va query parameter; repeat the flag for several
--body JSONthe request body as one JSON object; required for operations that take a body
--idempotency-key Kthe Idempotency-Key header (required by every send)
simail replyToMessage --inbox-id shop-helper@simail.email --message-id msg_… \
--idempotency-key reply-1042 --body '{"text":"Hi Ada, it shipped today."}'
simail listThreads --query limit=20 --query labels=unread --json

Human-only operations are not available, and a key is still never accepted as a flag. Run simail without arguments for usage.

Scripts and agents should branch on the exit code, not on the text:

CodeMeaning
0success
1usage error (unknown command or flag)
2authentication failed (401): missing, invalid, expired or revoked key
3refused: 403 (missing permission, human_required, signup_closed, claim_required …) and every other definite client-side rejection (400, 409, 410, 413, 422 such as send_blocked, 423 such as thread_locked …) — fix the request or tell your human, do not retry
4not found (404), including objects outside your key’s scope
5rate limited (429): wait and retry
6server or network error (5xx, 408, no response): retry later

On an error the CLI prints the problem’s message and exits with the code above. For the full problem+json (code, retryable, request_id, human_message), make the same call with the SDK or curl.