MOLTED EMAIL
CLI Reference

molted auth

Authentication commands

CommandDescription
molted auth signupCreate a new account and store credentials
molted auth loginLog in with email and password
molted auth initInitialize credentials from an existing API key
molted auth logoutClear stored credentials for the active profile
molted auth login-linkHand this workspace to your human: emails them a take-over link, or gives you a claim link or the portal URL (requires an admin, all-mailbox key)
molted auth keys listList API keys
molted auth keys createCreate a new (optionally scoped) API key
molted auth keys updateRe-scope an existing API key
molted auth keys revokeRevoke an API key
molted auth profiles listList all profiles
molted auth profiles switchSwitch the active profile
molted auth profiles currentShow the active profile
molted auth profiles deleteDelete a profile

Agent context

Authentication manages how your agent connects to the Molted Email platform. There are four ways to authenticate, choose based on your situation:

  • New agent, new account:
molted auth signup --name "My Agent" --email <your human's email> --password s3cret
# → use your human's own email, so for Free they get a take-over email.
#   Don't have it? Use an address on example.com (it reaches no one) and
#   login-link gives you a claim link for them. Never invent an inbox on
#   a real domain. Someone else may read it.
# → creates account, provisions tenant, generates API key, stores everything
# → output: { "tenant_id": "tenant-...", "key_prefix": "mm_live_..." }
  • Existing account (you have email + password):
molted auth login --email <account email> --password s3cret
# → logs in, creates a fresh API key, stores credentials
# → each login revokes your earlier active keys labeled "cli" (listed in
#   revoked_previous_cli_keys) and mints a new one; other keys stay valid
  • Existing API key (from dashboard or another agent):
molted auth init --key mm_live_abc123...
# → validates the key against the API and stores it
# → key format must be mm_live_..., other formats are rejected
  • Joining an existing tenant (agent adoption):
molted adopt claim <token>     # if the owner gave you an invite token
molted adopt request           # device flow, the owner approves in the portal
# → see `molted adopt --help` for the full adoption flow

Credential storage

  • File: ~/.molted/profiles/<name>.json (mode 0600, auto-created)
  • Contains: raw_key, tenant_id, base_url, mailbox_url (optional), session_cookie (if logged in)
  • Override with MOLTED_API_KEY env var (takes priority over stored key)
  • Override config dir with MOLTED_CONFIG_DIR env var
  • Override mailbox URL with MOLTED_MAILBOX_URL env var or --mailbox-url flag

Named profiles

  • Save to a specific profile: molted auth login --profile staging --email ...
  • Switch active profile: molted auth profiles switch staging
  • One-off override: molted --profile staging send --to ...
  • Env var override: MOLTED_PROFILE=staging molted send --to ...

Session cookie vs API key:

  • All post-auth commands use the API key (Bearer token)
  • Session cookies are only needed during signup/login bootstrapping
  • signup and login store the API key; init validates an existing key
  • No session cookie needed for day-to-day operations

After authenticating, activate billing before sending

molted billing status           # → check if sendBlocked is true
molted billing setup --plan solo  # → returns Stripe checkout URL

The Free plan needs a person as the owner. An account you signed up is agent-owned, so for Free run:

molted auth login-link --next /app/settings#plan
# and follow what it returns (below); afterwards activate-free works with
# your existing key

API key management

molted auth keys list           # list all keys (needs an all-mailbox key)
molted auth keys create --label "worker-2"  # create additional keys
molted auth keys revoke <id>    # revoke a compromised key

To hand off to a human (e.g. for billing setup)

molted auth login-link          # → { kind, url, expiresAt, note }: follow the note
# kind "takeover": no person owns this workspace and your account's email is
#   an outside inbox (your human's own address, say). Molted emailed that
#   address a link to set a password and take the account over. url is
#   null on purpose and sentTo is masked: tell your human to check their
#   inbox. Your password stops working afterwards; your keys keep working.
# kind "claim": no person owns this workspace and your account's email is
#   one of your Molted mailboxes, or on a reserved domain with no inbox
#   (example.com, .test, .invalid). The url is a claim link (7 days): your
#   human signs in or creates an account and claims the workspace. It
#   never signs anyone in by itself.
# kind "portal": a person owns it. The url is the portal; they sign in with
#   their own login.
# --next /app/settings#plan       # where your human lands afterwards
# requires an admin, all-mailbox key -- a key scoped to one or more
# specific mailboxes gets a 403 (mailbox_scope_denied / insufficient_scope)

Commands

molted auth signup

Create a new account and store credentials

molted auth signup [options]
OptionDescriptionDefault
--name <name>Your name (required) (required)
--email <email>The account email, your human's own if you have it (required) (required)
--password <password>Password (required) (required)
--profile <name>Save credentials to a named profile
--autonomy-level <level>Set autonomy level for default mailbox (1 = full approval, 2 = first-contact, 3 = full auto) (one of: 1, 2, 3)
--skip-onboardingSkip the post-signup onboarding sequence

Which email to sign up with. It decides how your human gets Free later.

  • Your human's own email, if you have it. They get a take-over email to set their own password and the account becomes theirs.
  • No address for them? Use one on example.com, say my-agent-<random>@example.com. It is reserved and reaches no one, so login-link gives you a claim link to hand them instead.
  • Never invent an inbox on a real domain. The take-over email would go to whoever reads it, or to no one.

The account you create here is agent-owned. Paid plans work right away (molted billing setup --plan solo). The Free plan needs a person as the owner. When you want Free, run

molted auth login-link --next /app/settings#plan

and follow what it returns. With your human's own email they get an email to set their password and take the account over. With an address on a reserved domain (example.com, .test, .invalid) or one of your Molted mailbox addresses you get a claim link to give them.

molted auth login

Log in with email and password

molted auth login [options]
OptionDescriptionDefault
--email <email>Email address (required) (required)
--password <password>Password (required) (required)
--profile <name>Save credentials to a named profile
--autonomy-level <level>Set autonomy level for default mailbox (1 = full approval, 2 = first-contact, 3 = full auto) (one of: 1, 2, 3)
--skip-onboardingSkip the post-login onboarding sequence

molted auth init

Initialize credentials from an existing API key

molted auth init [options]
OptionDescriptionDefault
--key <key>API key (mm_live_...) (required) (required)
--profile <name>Save credentials to a named profile

molted auth logout

Clear stored credentials for the active profile

molted auth logout

Hand this workspace to your human: emails them a take-over link, or gives you a claim link or the portal URL (requires an admin, all-mailbox key)

molted auth login-link [options]
OptionDescriptionDefault
--next <path>Where your human lands afterwards, a path in the app (e.g. /app/settings#plan)

molted auth keys list

List API keys

molted auth keys list

molted auth keys create

Create a new (optionally scoped) API key

molted auth keys create [options]
OptionDescriptionDefault
--label <label>Key label
--scope-allScope the key to ALL mailboxes (admin access, also the default with no scope flags)
--mailbox <id>Scope the key to a single mailbox
--permissions <perms>Comma-separated permissions for --mailbox (read,send,manage)
--scope <id:perms>Per-mailbox scope <mailboxId>[:<perms>] (repeatable)

molted auth keys update

Re-scope an existing API key

molted auth keys update [options] <id>
ArgumentDescriptionRequired
<id>yes
OptionDescriptionDefault
--scope-allScope the key to ALL mailboxes (admin access)
--mailbox <id>Scope the key to a single mailbox
--permissions <perms>Comma-separated permissions for --mailbox (read,send,manage)
--scope <id:perms>Per-mailbox scope <mailboxId>[:<perms>] (repeatable)

molted auth keys revoke

Revoke an API key

molted auth keys revoke <id>
ArgumentDescriptionRequired
<id>yes

molted auth profiles list

List all profiles

molted auth profiles list

molted auth profiles switch

Switch the active profile

molted auth profiles switch <name>
ArgumentDescriptionRequired
<name>yes

molted auth profiles current

Show the active profile

molted auth profiles current

molted auth profiles delete

Delete a profile

molted auth profiles delete <name>
ArgumentDescriptionRequired
<name>yes

See CLI overview for global options, credentials and output format.