Command-line interface for shrtn.dev URL shortener.
npm install -g shrtn-cli- Node.js 18+
- shrtn.dev account (Standard or Premium plan)
- API key from https://shrtn.dev/dev/keys
# First, create an API key at https://shrtn.dev/dev/keys
# Log in (requires username, password, AND API key)
shrtn login
# Check current user
shrtn whoami
# Log out
shrtn logout# Create a short link
shrtn shorten https://example.com/long-url
# Create with custom code
shrtn shorten https://example.com -c mycode
# List your links
shrtn list
shrtn list --page 2 --limit 20
# View analytics
shrtn analytics mycode
# Delete a link
shrtn delete mycode
shrtn delete mycode --force # Skip confirmation# Human-readable tables (default)
shrtn list
# JSON output (for scripting)
shrtn list --json
shrtn analytics mycode --json| Command | Alias | Description |
|---|---|---|
login |
- | Log in and save API key |
logout |
- | Clear local credentials |
whoami |
- | Show current user info |
shorten <url> |
- | Create short link |
list |
ls |
List your links |
analytics <code> |
stats |
View link analytics |
delete <code> |
rm |
Delete a link |
Credentials are stored in:
- Windows:
%APPDATA%\shrtn-nodejs\Config\config.json - macOS:
~/Library/Preferences/shrtn-nodejs/config.json - Linux:
~/.config/shrtn-nodejs/config.json
When you log in, save an API key with full scope (read + write).
You can create read-only keys at https://shrtn.dev/dev/keys
MIT