CLI Integration
BetaCLI Beta Notes
- The CLI supports both aliases:
fynandfynlink. - Interactive prompts are available for create flows when flags are omitted.
- For CI and automation, prefer explicit flags,
--json,--quiet, and--no-progress. - Built-in operational commands:
fyn about,fyn doctor, andfyn completion <shell>.
The CLI is the terminal interface for the Fynlink API and SDK capabilities. If you prefer shell workflows, automation pipelines, and repeatable commands over dashboard-only operations, this is the primary tool.
Prerequisites
Install Node.js before installing the CLI. npm is bundled with Node.js, so npm commands become available only after Node.js installation.
node -v npm -v
Installation
Install once globally, then use the same CLI across all your Fynlink teams and environments.
npm i -g @fynlink/cli
fyn --help fynlink --help
| Command | Description |
|---|---|
fyn --help | Primary CLI alias. |
fynlink --help | Secondary alias mapped to the same binary. |
Quick Start
First create a profile, then run API operations under that active profile context.
fyn profile addfyn profile add \ --name production \ --token "$FYN_TOKEN" \ --secret "$FYN_SECRET" \ --set-active
fyn profile current fyn links list --limit 10
Profiles
What Is A Profile?
In Fynlink, API tokens are team-scoped. One token represents access to one team. In the CLI, each team token is stored as a named profile.
You can save multiple profiles, list them, and switch the active one anytime. This lets you move safely between teams such as production, staging, client accounts, or internal environments.
Add Profile
fyn profile addfyn profile add --name staging --token "$FYN_TOKEN" --set-active
List & Switch
fyn profile list fyn profile use staging fyn profile show staging
Links
Create Link
Default behavior: CLI uses team defaults when values are omitted (for example domain, safe mode, and analytics). It fetches account info once for the current CLI session, reuses that cached data for subsequent commands in the same session, and refreshes again when a new session starts.
Mutation UX: create and update operations show transient progress and a result header before table output for better readability.
fyn links create
fyn links create \ --target "https://example.com" \ --domain links.example.com \ --slug launch \ --title "Launch Link" \ --tag launch campaign \ --analytics full
Creating link [███·········] Link created ------------ id : link_... domain : links.example.com slug : Ab12Cd shortUrl : https://links.example.com/Ab12Cd target.default : https://example.com
Get Link
fyn links get link_123
List Links
fyn links list --limit 20 --sort-by created_at --sort-order desc
Update Link
fyn links update link_123 --title "Updated Title" --private false
Updating link [███·········] Link updated ------------ id : link_123
Delete Link
fyn links delete link_123 --yesDomains
Create Domain
fyn domains create --domain links.example.com --gpc
List Domains
fyn domains list --page 1 --limit 20
Update Domain
fyn domains update domain_123 --description "Updated description" --gpc true
Verify Domain
fyn domains verify domain_123
Remove Domain
fyn domains remove domain_123 --yesMembers
Invite Member
fyn members invite --email dev@example.com --role admin
List Members
fyn members list --include-owner
Update Member
fyn members update member_123 --role editorRemove Member
fyn members remove member_123 --yesAnalytics
Clicks
fyn analytics clicks link_123
Timeseries
fyn analytics timeseries link_123 \ --start 2026-03-01T00:00:00Z \ --end 2026-03-31T23:59:59Z \ --granularity day
Breakdowns
fyn analytics countries link_123 fyn analytics browsers link_123 fyn analytics devices link_123
Output & CI
JSON / YAML
fyn links list --json fyn links list --output yaml fyn links get link_123 --no-color
Automation
FYN_TOKEN="$FYN_TOKEN" fyn links list --json --quiet --no-progress | jq '.data[0].id'
Diagnostics
fyn about
fyn doctor
fyn doctor --json| Flag | Purpose |
|---|---|
--quiet | Suppress non-essential diagnostics in stderr. |
--no-progress | Disable transient progress indicators. |
--debug | Enable debug diagnostics. |
Shell Completion
fyn completion bash > ~/.bashrc.d/fyn-completion.sh fyn completion zsh > ~/.zsh/completions/_fyn fyn completion fish > ~/.config/fish/completions/fyn.fish