Commands Reference
Full reference for all shorten CLI commands and flags.
shorten <url>
Shorten a URL. This is the default command — you can omit the subcommand.
shorten https://docs.example.com/very-long-url
# => ✓ r.shorten.dev/x7kQ2m (copied to clipboard)URLs without a protocol are automatically prefixed with https://.
Flags
| Flag | Short | Description |
|---|---|---|
--slug <slug> | -s | Custom slug instead of auto-generated |
--tag <tag> | -t | Add tags (repeatable, max 3, each ≤ 50 chars) |
--quiet | -q | Output only the short URL, no formatting |
--json | -j | Output full response as JSON |
--qr | — | Display QR code in terminal after shortening |
--no-copy | — | Don't copy to clipboard |
--key <key> | -k | API key (overrides env var) |
shorten import <file>
Bulk import links from a CSV file. Creates up to 500 links in a single API call. Use "-" as the file path to read from stdin.
shorten import links.csv
# => ✓ Created 47 linksCSV format
| Column | Required | Description |
|---|---|---|
destination_url (or url) | Yes | The URL to redirect to |
custom_slug (or slug) | No | Custom slug |
tags | No | Pipe-separated tags (e.g. docs|tutorial) |
destination_url,custom_slug,tags
https://docs.example.com/guide-1,guide-1,docs|tutorial
https://docs.example.com/guide-2,,docs
https://blog.example.com/post-1,,blogFlags
| Flag | Short | Description |
|---|---|---|
--quiet | -q | Output only the count of created links |
--json | -j | Output full response as JSON |
--key <key> | -k | API key (overrides env var) |
shorten list
List your links with optional filtering and sorting.
shorten listFlags
| Flag | Short | Description |
|---|---|---|
--limit <n> | -n | Number of results (default: 10, max: 50) |
--status <status> | — | Filter by active, flagged, or revoked |
--search <query> | — | Search in slug and destination URL |
--sort <field> | — | Sort by created_at, updated_at, slug, destination_url, or status |
--order <dir> | — | asc or desc (default: desc) |
--json | -j | Output as JSON |
shorten stats <slug>
View click analytics for a specific link.
shorten stats x7kQ2mFlags
| Flag | Short | Description |
|---|---|---|
--period <period> | -p | Time window: 7d, 30d, or 90d (default: 7d) |
--json | -j | Output as JSON |
shorten revoke <slug>
Permanently revoke a link so it stops redirecting. This cannot be undone.
shorten revoke x7kQ2m
# => Revoke x7kQ2m? This is permanent and cannot be undone. [y/N] y
# => ✓ Revoked x7kQ2m — the short link will no longer redirect.Flags
| Flag | Short | Description |
|---|---|---|
--yes | -y | Skip confirmation prompt |
--json | -j | Output as JSON |
--key <key> | -k | API key (overrides env var) |
shorten whoami
Display the current authenticated user and API key info.
shorten whoami
# => Key: sk_...a1b2
# => Rate limit: 247/300 remaining
# => Resets: Feb 20, 2026shorten login
Authenticate interactively. Opens your browser to the API Keys page, prompts you to paste your key, validates it, and saves it to ~/.shorten.json.
shorten loginIn non-interactive environments (CI, piped input), use --key instead.
shorten config
Manage CLI configuration without editing ~/.shorten.json directly.
shorten config list
Show all configuration values. API keys are masked.
shorten config list
# => api_key = sk_…a1b2
# => api_url = http://localhost:3000/api/v1
# => default_format = jsonshorten config get <key>
Get a specific configuration value.
shorten config get api_url
# => http://localhost:3000/api/v1shorten config set <key> <value>
Set a configuration value.
shorten config set api_url http://localhost:3000/api/v1
# => ✓ Set api_url = http://localhost:3000/api/v1Valid keys: api_key, api_url, default_format, copy_to_clipboard.
shorten config reset
Delete the configuration file entirely.
shorten config reset
# => ✓ Deleted ~/.shorten.jsonshorten config path
Print the configuration file path.
shorten config path
# => /Users/you/.shorten.jsonGlobal flags
These flags work with any command:
| Flag | Short | Description |
|---|---|---|
--key <key> | -k | API key (overrides SHORTEN_API_KEY env var) |
--api-url <url> | — | API base URL (overrides SHORTEN_API_URL env var) |
--json | -j | Output as JSON |
--quiet | -q | Minimal output |
--no-color | — | Disable colored output |
--version | -v | Print CLI version |
--help | -h | Show help |