inbox-api-cli 0.1.2

There is a newer version of this package available.
See the version list below for details.
dotnet tool install --global inbox-api-cli --version 0.1.2
                    
This package contains a .NET tool you can call from the shell/command line.
dotnet new tool-manifest
                    
if you are setting up this repo
dotnet tool install --local inbox-api-cli --version 0.1.2
                    
This package contains a .NET tool you can call from the shell/command line.
#tool dotnet:?package=inbox-api-cli&version=0.1.2
                    
nuke :add-package inbox-api-cli --version 0.1.2
                    

mail-cli — .NET CLI Tool

Command-line tool for interacting with the Inbox API. Provides email account management, message operations, sending, search, and draft management. Authenticates via API tokens (cw_ prefix).

Prerequisites

  • .NET 9 SDK
  • A running Inbox API instance
  • An API token (generated from the web UI or API)

Install / Run

# Run directly (from backend/ directory)
dotnet run --project mail-cli -- [command] [options]

# Build a self-contained single-file executable
dotnet publish mail-cli -c Release

# The published binary is at mail-cli/bin/Release/net9.0/{runtime}/publish/mail-cli

Configuration

Configure the CLI with the configure command:

# Interactive configuration
dotnet run --project mail-cli -- configure

# Or use environment variables
export INBOX_API_URL=http://localhost:5015
export INBOX_API_TOKEN=cw_your_api_token_here

Configuration is stored in a local config file managed by ConfigService.

Commands

Command Description
configure Set API URL and token
accounts List and manage email accounts
messages List, read, flag, move, archive, and delete messages
send Send an email
reply Reply to a message
forward Forward a message to new recipients
search Search emails across accounts
drafts Create, list, update, send, and delete drafts
threads List and view email threads
folders List folders for an account
attachments List and download message attachments
batch Bulk operations (mark-read, archive, move)
contacts List frequency-ranked contacts
digest Email digest summary across accounts
health Check account IMAP health
test-connection Test email server connectivity
tokens Manage API tokens (requires JWT auth)
token-usage View API token usage statistics
webhooks Manage webhooks, deliveries, and templates

configure

Set up API connection. Supports interactive prompts or direct flags.

configure [--api-url <url>] [--api-token <token>]

accounts

accounts list [--provider <name>] [--status <status>] [--sort <field>]
accounts add --email <email> --imap-host <host> --smtp-host <host> [--display-name <name>] [--imap-port <port>] [--smtp-port <port>] [--no-ssl] [--password <pw>]
accounts remove <account-id> [--force]
Subcommand Description
list List connected email accounts
add Connect a new email account (prompts for password if not provided)
remove Disconnect an email account

messages

messages list [--account <id>] [--folder <id>] [--unread] [--starred] [--has-attachments] [--start-date <date>] [--end-date <date>] [--sort <order>] [--query <text>] [--page <n>] [--page-size <n>]
messages get <message-id> [--body] [--html]
messages flag <message-id> [--read <bool>] [--starred <bool>]
messages move <message-id> --folder <folder-id>
messages archive <message-id>
messages delete <message-id>
Subcommand Description
list List messages with filtering, sorting, and pagination
get Get message details (optionally include body)
flag Update message flags (read/starred)
move Move a message to a folder
archive Archive a message
delete Delete a message

send

send --to <emails> --subject <text> --account <id> [--body <text>] [--html-body <html>] [--cc <emails>] [--bcc <emails>]

reply

reply <message-id> --body <text> [--html-body <html>] [--reply-all]

forward

forward <message-id> --to <emails> [--cc <emails>] [--bcc <emails>] [--text <additional-text>]
search <query> [--account <id>] [--sort <order>] [--page <n>] [--page-size <n>]

Sort options: relevance, date, date_asc, subject, from.

drafts

drafts list [--account <id>] [--start-date <date>] [--end-date <date>] [--sort <order>] [--page <n>] [--page-size <n>]
drafts create --account <id> [--to <emails>] [--subject <text>] [--body <text>] [--html-body <html>]
drafts update <draft-id> [--to <emails>] [--subject <text>] [--body <text>] [--html-body <html>]
drafts send <draft-id>
drafts delete <draft-id> [--force]
Subcommand Description
list List drafts with filtering and pagination
create Create a new draft
update Update an existing draft
send Send a draft
delete Delete a draft

threads

threads list [--account <id>] [--start-date <date>] [--end-date <date>] [--unread] [--sort <order>] [--page <n>] [--page-size <n>]
threads get <thread-id>
Subcommand Description
list List email threads with filtering and pagination
get Get a thread with all its messages

folders

folders list <account-id>

attachments

attachments list <message-id>
attachments download <message-id> <attachment-id> [--output <path>]
Subcommand Description
list List attachments for a message
download Download an attachment (defaults to original filename)

batch

batch mark-read <message-ids> [--unread]
batch archive <message-ids>
batch move <message-ids> --folder <folder-id>

<message-ids> is a comma-separated list of message IDs.

Subcommand Description
mark-read Mark messages as read (or unread with --unread)
archive Archive multiple messages
move Move multiple messages to a folder

contacts

contacts list [--since <period>] [--account <id>] [--search <text>] [--sort <field>] [--page <n>] [--page-size <n>]

Sort options: name, email, count, recent.

digest

digest [--since <period>] [--account <id>] [--max-per-account <n>]

health

health <account-id>

test-connection

test-connection --host <hostname> --username <user> [--port <port>] [--no-ssl] [--password <pw>]

Tests IMAP and SMTP connectivity. Prompts for password if not provided.

tokens

Requires JWT authentication (--jwt-token flag or CLOUDWORKS_JWT_TOKEN env var).

tokens list [--jwt-token <token>]
tokens create --name <name> --scopes <scopes> [--expires <date>] [--accounts <ids>] [--jwt-token <token>]
tokens revoke <token-id> [--force] [--jwt-token <token>]

Scopes: email:read, email:send, email:drafts, email:manage.

Subcommand Description
list List API tokens
create Create a new API token with specified scopes
revoke Revoke an API token

token-usage

token-usage <token-id> [--since <period>]

webhooks

webhooks list [--page <n>] [--page-size <n>]
webhooks get <webhook-id>
webhooks create --url <url> --events <events> [--secret <secret>]
webhooks update <webhook-id> [--url <url>] [--events <events>] [--active <bool>]
webhooks delete <webhook-id> [--force]
webhooks regenerate-secret <webhook-id>
webhooks deliveries <webhook-id> [--page <n>] [--page-size <n>]
webhooks retry <webhook-id> <delivery-id>
webhooks purge <webhook-id> [--force]
webhooks templates
Subcommand Description
list List webhooks
get Get webhook details
create Create a webhook for specified events
update Update webhook URL, events, or active status
delete Delete a webhook
regenerate-secret Regenerate the webhook signing secret
deliveries List delivery history for a webhook
retry Retry a failed delivery
purge Purge all deliveries for a webhook
templates List available webhook templates

Global Options

Option Description
--json Output in JSON format
--no-color Disable colored output
--debug Enable debug output

Examples

# List email accounts
dotnet run --project mail-cli -- accounts list

# Send an email
dotnet run --project mail-cli -- send --to user@example.com --subject "Hello" --body "Message"

# Search messages
dotnet run --project mail-cli -- search --query "invoice" --json

# List messages in JSON format
dotnet run --project mail-cli -- messages list --json

Structure

mail-cli/
├── Program.cs          # Entry point, command registration, error handling
├── Commands/           # Command handlers (21 files)
│   ├── AccountCommands.cs
│   ├── AttachmentCommands.cs
│   ├── BatchCommands.cs
│   ├── CommandHelper.cs
│   ├── ConfigureCommand.cs
│   ├── ContactCommands.cs
│   ├── DigestCommand.cs
│   ├── DraftCommands.cs
│   ├── FolderCommands.cs
│   ├── ForwardCommand.cs
│   ├── GlobalOptions.cs
│   ├── HealthCommand.cs
│   ├── MessageCommands.cs
│   ├── ReplyCommand.cs
│   ├── SearchCommand.cs
│   ├── SendCommand.cs
│   ├── TestConnectionCommand.cs
│   ├── ThreadCommands.cs
│   ├── TokenCommands.cs
│   ├── TokenUsageCommand.cs
│   └── WebhookCommands.cs
├── Models/
│   ├── ApiModels.cs    # API response types
│   └── ConfigModels.cs # Local configuration types
└── Services/
    ├── ApiClient.cs    # HTTP client wrapper
    ├── ConfigService.cs # Config file management
    └── OutputService.cs # Console output formatting (Spectre.Console)

Key Dependencies

Package Purpose
System.CommandLine CLI argument parsing
Spectre.Console Rich console output (tables, colors, markup)

Notes

  • This is a standalone project — it does not reference saas-api or saas-data
  • All API communication is over HTTP via ApiClient
  • The binary can be published as a self-contained single-file executable (PublishSingleFile + SelfContained are enabled in the csproj)
  • Error handling maps API errors to user-friendly messages with appropriate exit codes (0=success, 1=error, 2=auth failure, 3=connection failure)
Product Compatible and additional computed target framework versions.
.NET net9.0 is compatible.  net9.0-android was computed.  net9.0-browser was computed.  net9.0-ios was computed.  net9.0-maccatalyst was computed.  net9.0-macos was computed.  net9.0-tvos was computed.  net9.0-windows was computed.  net10.0 was computed.  net10.0-android was computed.  net10.0-browser was computed.  net10.0-ios was computed.  net10.0-maccatalyst was computed.  net10.0-macos was computed.  net10.0-tvos was computed.  net10.0-windows was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

This package has no dependencies.

Version Downloads Last Updated
0.1.3 35 3/26/2026
0.1.2 27 3/26/2026
0.1.1 29 3/26/2026
0.1.0 31 3/26/2026