shorten.dev/docs
shorten.dev/docs
Getting StartedAuthentication
OverviewCommands Reference
CLI

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

FlagShortDescription
--slug <slug>-sCustom slug instead of auto-generated
--tag <tag>-tAdd tags (repeatable, max 3, each ≤ 50 chars)
--quiet-qOutput only the short URL, no formatting
--json-jOutput full response as JSON
--qr—Display QR code in terminal after shortening
--no-copy—Don't copy to clipboard
--key <key>-kAPI 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 links

CSV format

ColumnRequiredDescription
destination_url (or url)YesThe URL to redirect to
custom_slug (or slug)NoCustom slug
tagsNoPipe-separated tags (e.g. docs|tutorial)
links.csv
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,,blog

Flags

FlagShortDescription
--quiet-qOutput only the count of created links
--json-jOutput full response as JSON
--key <key>-kAPI key (overrides env var)


shorten list

List your links with optional filtering and sorting.

shorten list

Flags

FlagShortDescription
--limit <n>-nNumber 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-jOutput as JSON


shorten stats <slug>

View click analytics for a specific link.

shorten stats x7kQ2m

Flags

FlagShortDescription
--period <period>-pTime window: 7d, 30d, or 90d (default: 7d)
--json-jOutput 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

FlagShortDescription
--yes-ySkip confirmation prompt
--json-jOutput as JSON
--key <key>-kAPI 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, 2026

shorten 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 login

In 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 = json

shorten config get <key>

Get a specific configuration value.

shorten config get api_url
# => http://localhost:3000/api/v1

shorten 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/v1

Valid keys: api_key, api_url, default_format, copy_to_clipboard.

shorten config reset

Delete the configuration file entirely.

shorten config reset
# => ✓ Deleted ~/.shorten.json

shorten config path

Print the configuration file path.

shorten config path
# => /Users/you/.shorten.json

Global flags

These flags work with any command:

FlagShortDescription
--key <key>-kAPI key (overrides SHORTEN_API_KEY env var)
--api-url <url>—API base URL (overrides SHORTEN_API_URL env var)
--json-jOutput as JSON
--quiet-qMinimal output
--no-color—Disable colored output
--version-vPrint CLI version
--help-hShow help

Overview

Shorten URLs from your terminal with the shorten CLI.

Overview

Connect AI agents to Shorten using the Model Context Protocol.

On this page

shorten <url>shorten import <file>shorten listshorten stats <slug>shorten revoke <slug>shorten whoamishorten loginshorten configGlobal flags