Official CLI for the Commune email API — agent-native, pipe-friendly, covers every API surface.
Project description
commune-cli
Official command-line interface for the Commune email API.
Covers every API surface: domains, inboxes, messages, threads, attachments, search, delivery analytics, webhooks, DMARC, and data deletion.
Install
pip install commune-cli
Requires Python ≥ 3.9.
Quick Start
# Set your API key
export COMMUNE_API_KEY=comm_...
# Send an email
commune messages send \
--to recipient@example.com \
--subject "Hello from CLI" \
--text "Sent from the terminal."
# List inboxes
commune inboxes list
# JSON output (automatic when stdout is piped)
commune inboxes list --json | jq '.data[].email'
Authentication
Set your API key in one of these ways (highest priority wins):
| Priority | Source |
|---|---|
| 1 | --api-key flag |
| 2 | COMMUNE_API_KEY env var |
| 3 | ~/.commune/config.toml → api_key |
Store permanently:
commune config set api_key comm_...
commune config show
Output
- TTY: rich tables and panels with color
- Piped /
--json: clean JSON to stdout; status messages to stderr
# JSON list format (always consistent)
commune threads list --json
# {"data": [...], "has_more": false, "next_cursor": null}
Exit Codes
| Code | Meaning |
|---|---|
| 0 | Success |
| 1 | API / validation error |
| 2 | Auth error (401/403) |
| 3 | Not found (404) |
| 4 | Rate limit or plan gate (429/403) |
| 5 | Network / connection error |
Error Format (stderr)
{"error": {"code": "not_found", "message": "Inbox not found.", "status_code": 404}}
Commands
commune
├── config
│ ├── set <key> <value>
│ ├── get <key>
│ ├── show [--reveal]
│ ├── unset <key>
│ └── path
│
├── domains
│ ├── list [--limit] [--cursor]
│ ├── get <domain-id>
│ ├── create <name>
│ ├── verify <domain-id>
│ └── records <domain-id>
│
├── inboxes
│ ├── list [--domain-id] [--limit] [--cursor]
│ ├── get <inbox-id>
│ ├── create [--local-part] [--domain-id] [--name] [--webhook-url]
│ ├── update <inbox-id> [--name] [--webhook-url]
│ ├── delete <inbox-id> --domain-id [--yes]
│ ├── set-webhook <inbox-id> --domain-id --url
│ └── extraction-schema
│ ├── set <inbox-id> --domain-id --schema <json>
│ └── remove <inbox-id> --domain-id
│
├── messages
│ ├── send --to --subject [--text] [--html] [--from] [--inbox-id] [--domain-id]
│ │ [--cc] [--bcc] [--reply-to] [--thread-id]
│ └── list [--inbox-id] [--domain-id] [--sender] [--limit] [--order] [--before] [--after]
│
├── threads
│ ├── list [--inbox-id] [--domain-id] [--limit] [--cursor] [--order]
│ ├── messages <thread-id> [--limit] [--order] [--cursor]
│ ├── metadata <thread-id>
│ ├── set-status <thread-id> <open|needs_reply|waiting|closed>
│ ├── assign <thread-id> [--to <user>]
│ └── tags
│ ├── add <thread-id> <tag...>
│ └── remove <thread-id> <tag...>
│
├── attachments
│ ├── upload <file>
│ ├── get <attachment-id>
│ └── url <attachment-id> [--expires-in]
│
├── search
│ └── threads <query> [--inbox-id] [--domain-id] [--limit]
│
├── delivery
│ ├── metrics [--domain-id] [--inbox-id] [--period]
│ ├── events [--domain-id] [--inbox-id] [--limit]
│ └── suppressions [--domain-id] [--inbox-id] [--limit]
│
├── webhooks
│ ├── list [--inbox-id] [--status] [--endpoint] [--limit]
│ ├── get <delivery-id>
│ ├── retry <delivery-id>
│ └── health
│
├── dmarc
│ ├── reports <domain> [--limit]
│ └── summary <domain> [--days]
│
└── data
├── delete-request [--email] [--inbox-id] [--domain-id]
├── delete-confirm <id> [--yes]
└── delete-status <id>
Global Flags
--api-key TEXT API key (overrides env/config)
--base-url TEXT API base URL (default: https://api.commune.email)
--json Output raw JSON
--quiet / -q Suppress status messages
--no-color Disable color output
--version / -V Show version and exit
Config File
Stored at ~/.commune/config.toml (or $COMMUNE_CONFIG_DIR/config.toml).
Created with chmod 600 to protect your API key.
api_key = "comm_..."
base_url = "https://api.commune.email"
Scripting
# Non-TTY → auto JSON
inboxes=$(commune inboxes list)
echo "$inboxes" | jq '.data[0].email'
# Pipe body from stdin
echo "Email body" | commune messages send \
--to user@example.com \
--subject "Automated" \
--text -
# Exit code handling
if commune messages send --to user@example.com --subject Test --text "Hi" --json; then
echo "Sent"
else
echo "Failed: $?"
fi
Full API reference: https://docs.commune.email
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
Built Distribution
Filter files by name, interpreter, ABI, and platform.
If you're not sure about the file name format, learn more about wheel file names.
Copy a direct link to the current filters
File details
Details for the file commune_cli-0.1.1.tar.gz.
File metadata
- Download URL: commune_cli-0.1.1.tar.gz
- Upload date:
- Size: 41.6 kB
- Tags: Source
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
a989696e9325f69af7449c65ed8f764135174853359a2a8a1c6c04b20ed22b73
|
|
| MD5 |
ba9e3f141de228c8fa28ff902aad9188
|
|
| BLAKE2b-256 |
75d314e4b2f391a433dbed88cfee56eb58821a27247b4002609789b4dfbccc81
|
File details
Details for the file commune_cli-0.1.1-py3-none-any.whl.
File metadata
- Download URL: commune_cli-0.1.1-py3-none-any.whl
- Upload date:
- Size: 27.5 kB
- Tags: Python 3
- Uploaded using Trusted Publishing? No
- Uploaded via: uv/0.9.26 {"installer":{"name":"uv","version":"0.9.26","subcommand":["publish"]},"python":null,"implementation":{"name":null,"version":null},"distro":{"name":"macOS","version":null,"id":null,"libc":null},"system":{"name":null,"release":null},"cpu":null,"openssl_version":null,"setuptools_version":null,"rustc_version":null,"ci":null}
File hashes
| Algorithm | Hash digest | |
|---|---|---|
| SHA256 |
4c7e798978b2a0e1ab90ed9fa50359204b6d71a0bb52a3b1fa2470cf8eaa7a73
|
|
| MD5 |
09adcdc231fe4c8af378c5de5798dd85
|
|
| BLAKE2b-256 |
d7ff17e00358da2a2c3bd8820a271e5c65fa97d728243b3ae4cad9206c8f8ae7
|