Back to Docs

CLI Quick Start

Install the LinkSnap CLI, authenticate, and start shortening links from your terminal.

Installation

Install the CLI globally via npm:

npm install -g @forjio/linksnap-cli

Verify the installation:

linksnap --version

Authentication

Log in to your LinkSnap account. This opens the dashboard where you can generate an API key.

linksnap auth login

After generating your API key in the dashboard, save it:

linksnap auth token <your-api-key>

For CI environments or self-hosted instances, you can specify a custom API URL:

linksnap auth token <your-api-key> --api-url https://your-instance.com/api/v1

Create a Short Link

Create your first short link with a custom slug:

linksnap create https://example.com --slug my-link

You can also omit the slug and let LinkSnap generate one automatically:

linksnap create https://example.com

View Analytics

Check click stats for any link by slug:

linksnap stats my-link

QR Codes

Create, manage, and download QR codes from the CLI.

Create a QR Code

linksnap qr create https://example.com --title "My QR" --color "#000000" --pattern rounded

Options: --title, --color (foreground hex), --bg-color (background hex), --pattern (square|dots|rounded|classy), --corners (square|rounded|dots), --frame (none|border|rounded-border|badge), --link-id

List QR Codes

linksnap qr list
linksnap qr list --search "landing" --limit 10
linksnap qr list --all

Get QR Code Details

linksnap qr get <id>

Download QR Code Image

linksnap qr download <id> --format png -o my-qr.png
linksnap qr download <id> --format svg

QR Scan Analytics

linksnap qr stats <id>
linksnap qr stats <id> --breakdown country
linksnap qr stats <id> --from 2024-01-01 --to 2024-12-31

Delete a QR Code

linksnap qr delete <id>
linksnap qr delete <id> --force

Common Commands

CommandDescription
linksnap auth loginOpen dashboard to generate API key
linksnap auth token <key>Save API key locally
linksnap auth statusCheck authentication status
linksnap create <url>Create a short link
linksnap stats <slug>View link analytics
linksnap qr create <url>Create a QR code
linksnap qr listList all QR codes
linksnap qr download <id>Download QR code image
linksnap --helpShow all available commands