TypeScript CLI to manage Listmonk campaigns, lists, subscribers, templates, and transactional emails.
- Node.js 18.17 or newer
npmorpnpm- Listmonk API credentials (username + API key) with campaign and list permissions
npm installThis installs dependencies, including typescript. Then build:
npm run buildThe compiled binary lives at dist/index.js and can be run as node dist/index.js ….
To add it to your PATH, use npm link or run it via npx.
The CLI reads configuration from environment variables or CLI flags:
LISTMONK_BASE_URL– Base URL (https://your-server).LISTMONK_USERNAME– API username (default:api).LISTMONK_API_KEY– API key or password.LISTMONK_TIMEOUT– Timeout in ms (optional, default 30000).LISTMONK_RETRY_COUNT– Retry count for transient errors (optional, default 3).
You can override these per command:
listmonk --base-url https://your-server --api-key xxx campaigns listGeneral help:
node dist/index.js --helpnode dist/index.js lists --page 1 --per-page 20
node dist/index.js lists --query "AI Expert" --jsonnode dist/index.js templates listFilter by type or name:
node dist/index.js templates list --type tx --query welcome
node dist/index.js templates list --type tx --jsonnode dist/index.js subscribers create \\
--email "user@example.com" \\
--name "User Name" \\
--lists 1 2 \\
--preconfirm-subscriptionsList subscribers:
node dist/index.js subscribers list --list-id 19 --per-page 100
node dist/index.js subscribers list --email "user@example.com" --jsonFetch one subscriber:
node dist/index.js subscribers get 7449
node dist/index.js subscribers get 7449 --jsonUpdate one subscriber:
node dist/index.js subscribers update 7449 \
--name "Juan Pablo Vivas Reinoso" \
--lists 19 \
--attribs '{"cohort":"may-2026"}'Move a subscriber between lists:
node dist/index.js subscribers add-to-list 7449 --list 19
node dist/index.js subscribers remove-from-list 7449 --list 16node dist/index.js campaigns list --page 1 --per-page 20 --status scheduled
node dist/index.js campaigns list --query "AI Expert" --jsonnode dist/index.js campaigns get 42Body only (useful for piping):
node dist/index.js campaigns get 42 --body-onlyRaw JSON:
node dist/index.js campaigns get 42 --jsonnode dist/index.js campaigns create \
--name "April newsletter" \
--subject "April updates" \
--lists 1 2 \
--body-file content.html \
--from-email "team@example.com" \
--content-type html \
--tags monthly highlightsnode dist/index.js campaigns update 42 \
--subject "Updated subject" \
--send-at "2024-04-20T20:00:00Z"
Note: if Listmonk requires `lists` when updating `send_at`, the CLI auto-fills
them from the existing campaign unless you pass `--lists`.node dist/index.js campaigns schedule 42 --status scheduled --send-at "2024-04-20T20:00:00Z"node dist/index.js campaigns delete 42node dist/index.js tx send \
--subscriber-email "user@example.com" \
--template-id 12 \
--data '{"name":"Antonio","topic":"Arquitectura"}'You can also use --subscriber-id, --template-name, --data-file, and
optionally set --headers (JSON array), --headers-file, --messenger, or
--content-type.
Set DEBUG=1 to show full API payloads on errors:
DEBUG=1 node dist/index.js campaigns create …- The executable name is
listmonk. lists,campaigns list,templates list,subscribers list, andsubscribers getsupport JSON output for automation.- Subscriber management now includes
list,get,update,add-to-list, andremove-from-list.