@tracklink/cli

Your link data, in the terminal

Create tracked links, pull click analytics and check usage without opening a browser. Built to be piped, scripted and run in CI.

npm i -g @tracklink/cli
tl auth login
tl stats --from 7d

It pipes properly

Columns for you, tab-separated for your tools, JSON for jq. No sed gymnastics.

# a terminal gets aligned columns and colour
tl links ls

# a pipe gets TSV — no header, no escape codes
tl links ls | cut -f2

# or ask for JSON
tl links ls --json | jq -r '.data[].slug'

# create prints ONLY the short URL, so this works
URL=$(tl links create https://example.com/promo --slug promo)

Details that matter in a script

Real exit codes

0 success, 2 usage, 4 auth, 5 rate limited. Branch on $? instead of grepping English.

Errors say what to do

A 403 tells you whether you need a write key or a plan upgrade, not just the status.

Relative dates

--from 7d, 24h, 2w. Typing an ISO timestamp to ask about last week is friction.

Nothing on stdout but data

Ticks, hints and pagination notes go to stderr.

Confirms destructive things

links rm refuses to run without --yes when it is not attached to a terminal.

Respects your terminal

NO_COLOR and FORCE_COLOR both honoured; escape sequences in your data are stripped.

Questions

Do I need a paid plan to use the CLI?

No. Reading — listing links, pulling clicks, stats and usage — works on every plan including free. Creating, editing and deleting links from the CLI needs a write-scoped key on Agency or Business.

Does it work in CI?

Yes, that is a design target. Authenticate with the TRACKLINK_API_KEY environment variable rather than a config file, and branch on the exit code: 4 means not authenticated, 5 means rate limited. Set FORCE_COLOR=1 if your CI renders ANSI.

How do I use it in a script?

Piped output is tab-separated with no header, so cut and awk work directly. Use --json for the full envelope and pipe it to jq. Creating a link prints only the short URL on stdout, so URL=$(tl links create https://example.com) does what you would expect.

Where is my API key stored?

In ~/.config/tracklink/config.json, written 0600 inside a 0700 directory. The key is verified against the API before it is saved, so a bad paste fails at login instead of turning every later command into a confusing 401. Environment variables take precedence over the file.

Is there shell completion?

Yes — tl completion bash, zsh or fish prints a script you can source from your shell profile.

Install it now

Create a key, run tl auth login, and you are working.

Start free