daimon.email
Sdks

CLI

Command-line interface for testing and managing daimon.email

Installation

npm install -g daimon-email-cli

Info

The CLI is useful for testing, debugging, and quick management tasks. For production use, prefer the TypeScript or Python SDKs.

Authentication

Set your API key as an environment variable:

export DAIMON_API_KEY=dm_live_abc123...

Or pass it with every command:

daimon --api-key dm_live_abc123... inbox list

Note

For the first inbox creation (free tier), no API key is required. The CLI will display the generated API key for future use.

Quick Start

Create Your First Inbox

# No API key needed for first inbox
daimon inbox create my-agent

# Output:
# ✓ Inbox created successfully!
#
# Email address: my-agent@daimon.email
# Inbox ID: inbox_abc123
# API key: dm_free_xyz789...
#
# Save this API key:
# export DAIMON_API_KEY=dm_free_xyz789...

List Messages

daimon messages list inbox_abc123

# Output:
# ID            FROM                      SUBJECT                   RECEIVED
# msg_001       noreply@service.com       Verify your email         2 mins ago
# msg_002       support@example.com       Welcome!                  5 mins ago

Send an Email

daimon send inbox_abc123 \
  --to customer@example.com \
  --subject "Order Confirmation" \
  --body "Your order has been confirmed."

# Output:
# ✓ Message sent!
#
# Message ID: msg_xyz789
# Status: queued

Commands

Inbox Management

daimon inbox create <username> [options]

# Options:
#   --client-id <id>       Idempotency key
#   --metadata <json>      Metadata as JSON string

# Examples:
daimon inbox create support-bot
daimon inbox create agent-123 --client-id deploy-prod-1
daimon inbox create sales --metadata '{"team":"sales","region":"us"}'
daimon inbox list [options]

# Options:
#   --limit <n>            Max inboxes to return (default: 50)
#   --offset <n>           Skip n inboxes

# Examples:
daimon inbox list
daimon inbox list --limit 10
daimon inbox get <inbox_id>

# Example:
daimon inbox get inbox_abc123

# Output:
# ID:       inbox_abc123
# Address:  support-bot@daimon.email
# Created:  2026-03-16T14:30:00Z
# Status:   active
daimon inbox update <inbox_id> [options]

# Options:
#   --metadata <json>      Update metadata

# Example:
daimon inbox update inbox_abc123 --metadata '{"status":"active"}'
daimon inbox delete <inbox_id>

# Example:
daimon inbox delete inbox_abc123

# Confirmation prompt:
# Are you sure you want to delete inbox_abc123? (y/N)

Message Management

daimon messages list <inbox_id> [options]

# Options:
#   --limit <n>            Max messages to return (default: 20)
#   --unread-only          Only show unread messages
#   --format <fmt>         Output format: table, json (default: table)

# Examples:
daimon messages list inbox_abc123
daimon messages list inbox_abc123 --unread-only
daimon messages list inbox_abc123 --format json
daimon messages get <inbox_id> <message_id>

# Example:
daimon messages get inbox_abc123 msg_xyz789

# Output:
# Message ID:  msg_xyz789
# From:        noreply@service.com
# To:          my-agent@daimon.email
# Subject:     Verify your email
# Received:    2026-03-16T14:30:00Z
#
# Body:
# Please verify your email by clicking this link:
# https://service.com/verify/token123
#
# CTA Links:
# - Verify Email: https://service.com/verify/token123
daimon send <inbox_id> [options]

# Options:
#   --to <email>           Recipient email (required)
#   --subject <text>       Subject line (required)
#   --body <text>          Message body (required)
#   --html <html>          HTML body (optional)
#   --client-id <id>       Idempotency key

# Examples:
daimon send inbox_abc123 \
  --to user@example.com \
  --subject "Welcome" \
  --body "Thanks for signing up!"

daimon send inbox_abc123 \
  --to user@example.com \
  --subject "Welcome" \
  --body "Plain text version" \
  --html "<h1>Welcome!</h1>" \
  --client-id welcome-user-123
daimon messages reply <inbox_id> <message_id> [options]

# Options:
#   --body <text>          Reply body (required)
#   --client-id <id>       Idempotency key

# Example:
daimon messages reply inbox_abc123 msg_xyz789 \
  --body "Thanks for reaching out! We'll get back to you soon."
daimon messages forward <inbox_id> <message_id> [options]

# Options:
#   --to <email>           Forward to email (required)
#   --note <text>          Add a note before forwarded message

# Example:
daimon messages forward inbox_abc123 msg_xyz789 \
  --to team@example.com \
  --note "Please review this support request."
daimon messages delete <inbox_id> <message_id>

# Example:
daimon messages delete inbox_abc123 msg_xyz789

Thread Management

daimon threads list <inbox_id> [options]

# Options:
#   --limit <n>            Max threads to return (default: 20)

# Example:
daimon threads list inbox_abc123
daimon threads get <thread_id>

# Example:
daimon threads get thread_abc123

# Output:
# Thread ID:   thread_abc123
# Subject:     Order #1234
# Participants: support@example.com, customer@example.com
# Messages:    3
#
# Messages:
# 1. customer@example.com: Order #1234 (2026-03-16 14:30)
# 2. support@example.com: Re: Order #1234 (2026-03-16 14:45)
# 3. customer@example.com: Re: Order #1234 (2026-03-16 15:00)

Webhook Management

daimon webhook create [options]

# Options:
#   --url <url>            Webhook URL (required)
#   --events <list>        Comma-separated event types (required)
#   --inbox-id <id>        Filter to specific inbox (optional)
#   --client-id <id>       Idempotency key

# Examples:
daimon webhook create \
  --url https://your-server.com/webhooks/daimon \
  --events message.received,message.sent

daimon webhook create \
  --url https://your-server.com/webhooks/inbox \
  --events message.received \
  --inbox-id inbox_abc123
daimon webhook list

# Output:
# ID               URL                                     EVENTS
# webhook_001      https://server.com/webhooks/daimon     message.received, message.sent
# webhook_002      https://server.com/webhooks/urgent     message.received
daimon webhook test <webhook_id>

# Example:
daimon webhook test webhook_abc123

# Output:
# ✓ Test event sent successfully!
# Check your webhook endpoint for the test payload.
daimon webhook delete <webhook_id>

# Example:
daimon webhook delete webhook_abc123

Account Management

daimon account

# Output:
# Account ID:  acct_abc123
# Tier:        free
# Created:     2026-03-16T14:00:00Z
# Inboxes:     1
# Webhooks:    2
daimon account capabilities

# Output:
# Capabilities:
# ✓ create_inboxes
# ✓ receive_messages
# ✗ send_messages (requires paid tier)
# ✗ custom_domains (requires paid tier)
#
# Limits:
# Send quota:  0 / 0 (free tier)
# Inboxes:     1 / 10
# Webhooks:    2 / 5
daimon account upgrade [options]

# Options:
#   --tier <tier>          Desired tier: developer, growth, enterprise
#   --return-url <url>     Return URL after upgrade

# Example:
daimon account upgrade --tier developer

# Output:
# Upgrade URL:
# https://daimon.email/upgrade?token=jwt_abc123...
#
# Send this link to your operator to upgrade.

Output Formats

Most commands support multiple output formats:

Table (Default)

daimon inbox list

# Output:
# ID            ADDRESS                        CREATED
# inbox_001     support@daimon.email          2 hours ago
# inbox_002     agent-123@daimon.email        1 day ago

JSON

daimon inbox list --format json

# Output:
# [
#   {
#     "id": "inbox_001",
#     "address": "support@daimon.email",
#     "created_at": "2026-03-16T12:30:00Z"
#   },
#   {
#     "id": "inbox_002",
#     "address": "agent-123@daimon.email",
#     "created_at": "2026-03-15T14:00:00Z"
#   }
# ]

Compact (ID only)

daimon inbox list --format id

# Output:
# inbox_001
# inbox_002

Useful for piping to other commands:

# Delete all inboxes
daimon inbox list --format id | xargs -I {} daimon inbox delete {}

Scripting Examples

Automated Testing

#!/bin/bash

# Create test inbox
INBOX=$(daimon inbox create test-agent-$RANDOM --format json | jq -r '.result.id')
echo "Created inbox: $INBOX"

# Trigger external service signup
curl -X POST https://service.com/signup -d "email=test-agent@daimon.email"

# Poll for verification email
for i in {1..30}; do
  MESSAGES=$(daimon messages list $INBOX --unread-only --format json)
  COUNT=$(echo $MESSAGES | jq -r '.result | length')

  if [ "$COUNT" -gt 0 ]; then
    # Extract verification link
    LINK=$(echo $MESSAGES | jq -r '.result[0].cta_links[0].url')
    echo "Verification link: $LINK"

    # Click the link
    curl -s "$LINK"

    echo "Verification complete!"
    break
  fi

  sleep 2
done

# Cleanup
daimon inbox delete $INBOX --yes

Batch Send

#!/bin/bash

INBOX_ID="inbox_abc123"

# Read recipients from CSV
while IFS=, read -r email name; do
  daimon send $INBOX_ID \
    --to "$email" \
    --subject "Welcome, $name!" \
    --body "Hi $name, thanks for joining!" \
    --client-id "welcome-$email"

  echo "Sent to $email"
  sleep 1  # Rate limiting
done < recipients.csv

Monitor Inbox

#!/bin/bash

INBOX_ID="inbox_abc123"

# Poll for new messages every 10 seconds
while true; do
  MESSAGES=$(daimon messages list $INBOX_ID --unread-only --format json)
  COUNT=$(echo $MESSAGES | jq -r '.result | length')

  if [ "$COUNT" -gt 0 ]; then
    echo "New messages: $COUNT"

    # Process each message
    echo $MESSAGES | jq -r '.result[] | "\(.id) - \(.subject)"'
  fi

  sleep 10
done

Configuration File

Store default settings in ~/.daimon/config.json:

{
  "api_key": "dm_live_abc123...",
  "default_inbox": "inbox_abc123",
  "output_format": "table"
}

The CLI will read this file automatically. Command-line options override config file settings.

Environment Variables

VariableDescription
DAIMON_API_KEYAPI key for authentication
DAIMON_API_URLAPI base URL (default: https://api.daimon.email)
DAIMON_DEBUGEnable debug output (set to 1)

Debugging

Enable debug output:

export DAIMON_DEBUG=1
daimon inbox list

# Output includes HTTP request/response details:
# [DEBUG] GET https://api.daimon.email/v1/inboxes
# [DEBUG] Authorization: Bearer dm_live_...
# [DEBUG] Response: 200 OK
# [DEBUG] Body: {"result": [...]}

Shell Completion

Enable tab completion for bash/zsh:

# Bash
daimon completion bash >> ~/.bashrc

# Zsh
daimon completion zsh >> ~/.zshrc

Resources

Next Steps