CLI
fks manages your short links from a terminal, a script or an AI agent. Every command accepts --json and exits with a documented code, so output is safe to parse.
Install
Once the package is on npm:
npx fks --help
# or install it globally
npm install -g fks
From source today (Node 22 or later), inside a checkout of the FunnelKit Shortener repository:
pnpm install
pnpm --filter fks build
node packages/cli/dist/fks.js --help
Add an alias to save typing: alias fks="node $PWD/packages/cli/dist/fks.js".
Log in
Create an API key in the dashboard (Settings, API keys), then:
fks login --api-key fks_YOUR_KEY
The key is saved in your user config directory. In CI or for agents, set the FKS_API_KEY environment variable instead; it takes precedence over the saved key. fks logout removes the saved key.
Commands
| Command | What it does |
|---|---|
fks login, fks logout | Save or remove your API key. |
fks links create <url> | Create a link. Options include --slug, --domain, --title and --tag (repeatable). |
fks links list | List links, newest first. Filter with --tag, --domain, --search; page with --limit and --cursor. |
fks links get <id> | Show one link. |
fks links update <id> | Change the destination or other fields, for example --url. |
fks links delete <id> | Delete a link. |
fks links bulk <file> | Create links from a JSON or CSV file (sent in batches of 50). |
fks stats [id] | Clicks for one link, or the whole workspace without an id. Supports --from, --to. |
fks qr <id> | Write the link's QR code as SVG to a file or stdout. |
fks domains list, add, verify, remove | Manage custom domains. |
fks keys list, create, revoke | Manage API keys. |
fks workspace | Show the current workspace, plan and usage. |
Run fks <command> --help for every option.
JSON output for agents
Add --json to any command to get machine-readable output on stdout. Errors go to stderr in the same shape as the API:
$ fks links create https://example.com --slug taken --json
{"error":{"code":"slug_taken","message":"That slug is already used on link-staging.funnelkit.com"}}
$ echo $?
6
Human-readable output (the default) may change between versions; JSON output and exit codes will not.
Exit codes
| Code | Meaning |
|---|---|
0 | Success. |
1 | Unexpected error. |
2 | Usage error: unknown command or bad flags. |
3 | Authentication failed: missing or invalid API key. |
4 | Not found. |
5 | Plan limit reached, or the feature needs a higher plan. |
6 | Validation error or conflict, such as an unsafe URL or a taken slug. |
7 | Rate limited. Wait and retry. |
8 | Network or server error. Retrying may help. |
Examples
Create a link and keep only the short URL:
fks links create https://example.com/launch --slug launch --json | jq -r .shortUrl
Point an existing link somewhere new:
fks links update lnk_123 --url https://example.com/launch-v2
Clicks for the last week:
fks stats lnk_123 --from 2026-09-29 --json