A tiny Go CLI to create SimpleLogin email aliases using the API described in api.md.
Features:
- Store and use your API key securely
- Create random aliases (uuid or word mode)
- Create custom aliases (prefix + signed suffix), with interactive suffix picker
- Inspect available suffix options
- Show account info (
whoami)
- Go 1.22+ (to build from source)
- A SimpleLogin API key
Project structure was refactored to use packages and a proper entrypoint under cmd/simplelogin.
cd simplelogincli
# build the CLI binary from the new entrypoint
go build -o simplelogin ./cmd/simpleloginThe CLI looks for configuration in this order:
- Environment variables (highest precedence)
- Config file at
$XDG_CONFIG_HOME/simplelogincli/config.jsonor~/.config/simplelogincli/config.json
Environment variables:
SIMPLELOGIN_API_KEY— API keySIMPLELOGIN_BASE_URL— Base URL (default:https://app.simplelogin.io)
You can also save the API key into the config file using the CLI:
./simplelogin set-key --api-key "<your_api_key>" [--base-url https://app.simplelogin.io]./simplelogin help./simplelogin whoami
# or override saved key
SIMPLELOGIN_API_KEY=... ./simplelogin whoami./simplelogin options --hostname example.com# Use your default settings on the server
./simplelogin random
# Force mode (uuid or word) and attach a note
./simplelogin random --mode word --note "For example.com"
# Include a hostname to help suggestions/history
./simplelogin random --hostname example.comThe command prints the newly created alias email to stdout on success.
./simplelogin --delete --email "<email_to_delete>"You can either provide the signed suffix directly (from options) or pick it by the plain suffix value.
- Non-interactive, by plain suffix:
./simplelogin custom \
--prefix "myshop" \
--suffix ".yeah@sl.lan" \
--note "Shop account"The CLI fetches options, matches --suffix, and uses the associated signed_suffix.
- Non-interactive, by signed suffix:
./simplelogin custom \
--prefix "myshop" \
--signed-suffix ".yeah@sl.lan.X6_7OQ.i8XL4xsMsn7dxDEWU8eF-Zap0qo"- Interactive suffix selection:
./simplelogin custom --prefix "myshop"
# The CLI will list suffixes and ask you to choose.- Specify mailbox owners for the alias (defaults to your default mailbox if omitted):
./simplelogin custom --prefix "work" --suffix ".yeah@sl.lan" --mailbox-ids "1,2"The command prints the newly created alias email to stdout on success.
Unit tests cover the configuration layer and API client behavior using httptest.
# from project root
go test ./...There are integration tests (behind the integration build tag) that hit the real API. They will:
- Validate your API key with
/api/user_info - Create a random alias and delete it
- Create a custom alias and delete it (if suffixes are available)
Run them only when you set a valid API key (and optional base URL):
# Be careful: this will create and then delete aliases in your account
SIMPLELOGIN_API_KEY=your_key \
SIMPLELOGIN_BASE_URL=https://app.simplelogin.io \
go test -tags=integration ./pkg/api -vIf env vars are not set, integration tests are skipped.
- 401 Unauthorized: check your API key with
./simplelogin whoamior re-runset-key. can_createfalse or quota exceeded: the API returns an error message; the CLI prints it to stderr.- Premium-only suffixes: trying to create an alias with a premium-only suffix will return a 4xx with an explanatory error.
- Base URL: override with
--base-urlorSIMPLELOGIN_BASE_URLto target self-hosted instances.
Quick smoke test after changes:
# build
go build -o simplelogin ./cmd/simplelogin
# help output
./simplelogin helpMIT (or the same license as your project).