SafeSlugSafeSlug
Terminal & CI Workflow

URL Shortener CLIfor developers, scripts, and agents

Shorten links, assign custom slugs, inspect zero-IP analytics, and output clean JSON directly from your terminal with the official @safeslug/cli package.

@safeslug/cli
MIT · Node.js 18+

$ npm install -g @safeslug/cli

$ safeslug auth login

$ safeslug shorten https://example.com/docs --custom api-docs --json

{
  "slug": "api-docs",
  "shortUrl": "https://safeslug.3bits.me/r/api-docs",
  "encrypted": true
}

Free with your SafeSlug account. Manage API keys anytime from your dashboard.

Built for Workflows

Encrypted link management without leaving your shell.

Designed for developers who share documentation, release artifacts, preview deployments, and automated links from terminal sessions or CI.

Browser device-code login

Authenticate with safeslug auth login using a short-lived browser verification code. API tokens are stored as SHA-256 hashes on the server.

Instant custom or generated slugs

Shorten URLs in a single command with --custom for branded launch slugs or --length to control generated slug length.

Scriptable --json output

Pass --json to shorten or list commands so shell scripts, GitHub Actions, release pipelines, and AI coding agents can parse results cleanly.

Encrypted at rest by default

Every link created from the CLI gets the same AES-256-GCM encryption at rest, HMAC lookup hashing, and no-referrer redirects as the web app.

Command Reference

Core CLI commands.

Every command supports clean human output for interactive use and machine-friendly flags for automation.

npm install -g @safeslug/cliInstall globally (Node.js 18+)
safeslug auth loginApprove terminal session in browser
safeslug shorten https://example.com --custom launch-2026Create an encrypted custom short link
safeslug shorten https://example.com --jsonReturn structured JSON for scripts & CI
safeslug links --jsonList saved links as JSON
safeslug analytics <link-id>Inspect visit counts, countries & referrers

CLI FAQ

Terminal shortening questions.

How do I install and authenticate the SafeSlug CLI?

Run `npm install -g @safeslug/cli` on any machine with Node.js 18 or newer, then run `safeslug auth login`. A browser window opens with a short verification code so you can authorize your terminal without copying raw passwords.

Can I use SafeSlug CLI in shell scripts, CI/CD, or AI agents?

Yes. Commands such as `safeslug shorten <url> --json` and `safeslug links --json` emit structured JSON including the generated short URL and slug, making it straightforward to pipe into `jq`, release scripts, or developer agents.

Are links created through the CLI encrypted at rest?

Yes. CLI-created links use the exact same backend pipeline: destination URLs and slugs are encrypted with AES-256-GCM before storage, lookups use keyed HMAC-SHA256 hashes, and redirects never log raw visitor IP addresses.

Is @safeslug/cli free and open-source?

Yes. Both SafeSlug and `@safeslug/cli` are MIT-licensed open-source software, and CLI access is included free with any SafeSlug account.

Related features