CLI Reference

Complete reference for the oneshot command-line tool -- every command, every flag, with examples.

Installation

pip install oneshot-mail

The oneshot command is included with the Python SDK. It wraps the SDK with a rich terminal UI using Click and Rich.

Configuration

API key

Set your API key using any of these methods (in priority order):

# 1. Environment variable (highest priority)
export ONESHOT_API_KEY="osm_live_your_key"

# 2. Config command
oneshot config set api-key osm_live_your_key

The config file is stored at ~/.config/oneshot/config.toml.

Verify your setup

oneshot whoami

This prints your account details, plan, and usage.


Commands

oneshot create

Create a new receive-mode email address and optionally wait for an email to arrive.

# Create and print the address
oneshot create

# Create with custom TTL and label
oneshot create --ttl 30m --label "ci-test"

# Create and wait for an email (interactive, shows a live spinner)
oneshot create --wait

# Create and wait with a custom timeout
oneshot create --wait --timeout 120

# Output as JSON (for scripting)
oneshot create --ttl 5m --label "ci-test" --json

Flags:

FlagTypeDefaultDescription
--ttlstring1hTime-to-live (e.g., 30s, 5m, 1h).
--labelstring(none)Label for filtering and cleanup.
--waitflagfalseWait for an email to arrive before exiting.
--timeoutint60Seconds to wait (with --wait).
--jsonflagfalseOutput raw JSON.

When --wait is used, the CLI shows a live spinner with elapsed time, then renders the email beautifully when it arrives (sender, subject, text preview in a rich panel).


oneshot send

Send a one-shot email from a temporary address.

# Simple text email
oneshot send --to intake@myapp.com --subject "Test" --body "Hello world"

# HTML email from a file
oneshot send --to intake@myapp.com --subject "Test" --html-file ./email.html

# With attachments
oneshot send --to intake@myapp.com --subject "Invoice" --body "See attached" --attach invoice.pdf

# Multiple attachments
oneshot send --to intake@myapp.com --subject "Report" --body "See attached" \
  --attach report.pdf --attach data.csv

# JSON output for scripting
oneshot send --to intake@myapp.com --subject "Test" --body "Hi" --json

Flags:

FlagTypeDescription
--tostringDestination email address (required).
--subjectstringEmail subject (required).
--bodystringPlain text body.
--html-filepathPath to an HTML file for the body.
--attachpathAttachment file path (repeatable).
--ttlstringTTL for the address record.
--labelstringOptional label.
--jsonflagOutput raw JSON.

oneshot get

Retrieve and display an email for a given address ID.

# Show email summary (from, subject, snippet)
oneshot get abc123xyz789def456

# Show full email body
oneshot get abc123xyz789def456 --full

# Open HTML body in browser
oneshot get abc123xyz789def456 --html

# View raw RFC 822 source
oneshot get abc123xyz789def456 --raw

# Save raw email to file
oneshot get abc123xyz789def456 --save ./email.eml

# Download all attachments to a directory
oneshot get abc123xyz789def456 --save-attachments ./attachments/

# JSON output
oneshot get abc123xyz789def456 --json

Flags:

FlagTypeDescription
--fullflagShow complete email body.
--htmlflagOpen HTML body in default browser.
--rawflagShow raw RFC 822 source.
--savepathSave raw email to a file.
--save-attachmentspathDownload all attachments to a directory.
--jsonflagOutput raw JSON.

oneshot list

List your recent addresses in a rich table.

# List all addresses
oneshot list

# Filter by status
oneshot list --status waiting

# Filter by label (glob pattern)
oneshot list --label "ci-run-*"

# Filter by mode
oneshot list --mode send

# JSON output
oneshot list --json

Flags:

FlagTypeDefaultDescription
--statusstring(all)Filter: waiting, received, expired, sent.
--labelstring(all)Filter by label (glob pattern).
--modestring(all)Filter: receive or send.
--limitint20Max results.
--jsonflagfalseOutput raw JSON.

The table uses colour-coded status indicators:

  • Green: received
  • Yellow: waiting
  • Red: expired
  • Blue: sent

oneshot delete

Delete addresses.

# Delete a single address
oneshot delete abc123xyz789def456

# Bulk delete by label
oneshot delete --label "ci-run-abc123"

Flags:

FlagTypeDescription
--labelstringDelete all addresses with this label.

oneshot whoami

Show your current account, plan, and usage.

oneshot whoami

Example output:

Account: developer@example.com
Plan:    Solo ($10/mo)

Usage this period:
  Receive: 142 / 10,000 (1%)
  Send:     23 / 1,000 (2%)

Credits remaining: 450
Billing cycle ends: 2026-04-07

oneshot credits buy

Purchase additional credits.

# Interactive -- select a pack
oneshot credits buy

# Direct -- specify amount
oneshot credits buy --amount 500

Opens a Stripe Checkout URL in your default browser.


oneshot ping

Check API health and measure latency.

oneshot ping

Example output:

API Status: ok
Region:     ap-southeast-2
Version:    1.2.3
Latency:    142ms

oneshot config set

Set configuration values.

oneshot config set api-key osm_live_your_key

oneshot login

Interactive login — opens a browser window where you can authenticate and the API key is automatically configured.

oneshot login

Global flags

These flags are available on all commands:

FlagDescription
--jsonOutput raw JSON (for scripting).
--versionShow CLI version.
--helpShow help for any command.

Environment variables

VariableDescription
ONESHOT_API_KEYAPI key (takes precedence over config file).
ONESHOT_BASE_URLOverride the API base URL.
NO_COLORDisable all colour output when set.

Shell completions

The CLI supports shell completions for bash, zsh, and fish. Click generates these automatically:

# bash
eval "$(_ONESHOT_COMPLETE=bash_source oneshot)"

# zsh
eval "$(_ONESHOT_COMPLETE=zsh_source oneshot)"

# fish
_ONESHOT_COMPLETE=fish_source oneshot | source

Add the appropriate line to your shell profile (.bashrc, .zshrc, config.fish) for persistent completions.