CLI
The Pastebox CLI (@pastebox/cli) lets you create, retrieve, list, and delete pastes from the command line. It supports end-to-end encryption and piping from stdin.
Installation
# From the monorepo root
pnpm install
pnpm --filter @pastebox/shared build
pnpm --filter @pastebox/cli build
# Link the binary globally
cd apps/cli
pnpm link --globalAfter linking, the pastebox command is available in your shell.
Configuration
Before using the CLI, configure the server URL and API key:
pastebox config --url https://paste.example.com --api-key pb_<your-key>Configuration is saved to ~/.pastebox.json. You can set the URL and API key separately:
pastebox config --url https://paste.example.com
pastebox config --api-key pb_<your-key>View current configuration:
pastebox config
# Config saved.
# URL: https://paste.example.com
# API Key: pb_aBcDeF...The default server URL is http://localhost:3000 if not configured.
Commands
create
Create a new paste from a file or stdin.
pastebox create [options]| Option | Description |
|---|---|
-f, --file <path> | Read content from a file |
-t, --title <title> | Set paste title |
-s, --syntax <lang> | Syntax highlighting language (default: plaintext) |
--ttl <seconds> | Time-to-live in seconds (paste auto-expires) |
--burn | Burn after read (paste is deleted after first view) |
--e2ee | Enable end-to-end encryption (client-side) |
Examples:
# From a file
pastebox create --file script.py --syntax python --title "My Script"
# With TTL (1 hour)
pastebox create --file notes.txt --ttl 3600
# Burn after read
pastebox create --file secret.txt --burn --title "One-time secret"get
Retrieve a paste by its public ID.
pastebox get <publicId> [options]| Option | Description |
|---|---|
--key <key> | E2EE decryption key (base64url-encoded) |
Examples:
# Get a standard paste (Mode A -- server decrypts)
pastebox get aBcDeFgHiJkLmNoPqRsTuVwXyZ012345
# Get an E2EE paste (Mode B -- client decrypts)
pastebox get aBcDeFgHiJkLmNoPqRsTuVwXyZ012345 --key <base64url-key>list
List your pastes. Requires an API key.
pastebox list [options]| Option | Description |
|---|---|
-l, --limit <n> | Max number of results to return |
Example:
pastebox list
# aBcDeFgH... My Script python 2025-01-15T10:30:00Z
# xYzAbCdE... (untitled) plaintext 2025-01-14T08:00:00Z
pastebox list --limit 5delete
Delete a paste by its public ID. Requires an API key. You can only delete your own pastes.
pastebox delete <publicId>Example:
pastebox delete aBcDeFgHiJkLmNoPqRsTuVwXyZ012345
# Paste deleted.E2EE Usage
When creating a paste with --e2ee, the CLI encrypts the content locally before sending it to the server. The decryption key is appended to the URL as a fragment.
# Create an E2EE paste
pastebox create --file secret.txt --e2ee --title "Encrypted Note"
# Paste created!
# URL: https://paste.example.com/p/aBcDeFgH...#rAnDoMkEyHeRe
# Public ID: aBcDeFgHiJkLmNoPqRsTuVwXyZ012345
# E2EE key is in the URL fragment -- keep the full URL to decrypt.The full URL (including the #key fragment) must be shared for the recipient to decrypt the paste. The fragment is never sent to the server.
To retrieve an E2EE paste via CLI, you need to provide the key explicitly:
# Extract the key from the URL fragment and pass it with --key
pastebox get aBcDeFgH... --key rAnDoMkEyHeReIn a web browser, the JavaScript on the paste view page reads the key from window.location.hash and decrypts in the browser automatically.
Pipe from stdin
Content can be piped directly from other commands:
# Pipe command output
cat /var/log/app.log | pastebox create --syntax log --title "App logs"
# Pipe a diff
git diff | pastebox create --syntax diff --title "My changes"
# Pipe with E2EE
echo "super secret" | pastebox create --e2ee
# Clipboard (macOS)
pbpaste | pastebox create --syntax javascript
# Clipboard (Linux with xclip)
xclip -selection clipboard -o | pastebox createWhen stdin is not a TTY (i.e., data is piped), the CLI reads from stdin automatically. If stdin is a TTY and no --file is provided, the CLI exits with an error.