Skip to content
SaaSFunnelsHelp

Developers

CLI

Reference for the saasfunnels command, its commands, flags, files, environment variables and exit codes.

On this page

The saasfunnels CLI runs in your app's repository and needs Node.js 22 or newer. For a guided start, see the Quickstart and How it works with your app.

Install

Add it to your project, write its settings and give your coding agent the playbooks:

Terminal
npm install --save-dev saasfunnels@^0.16.0 && npx saasfunnels init && npx saasfunnels agent install --target claude-code

Or run any command without installing:

Terminal
npx --yes saasfunnels@latest <command>

Sign in

Terminal
npx saasfunnels login

Opens app.saasfunnels.com/cli/connect with a one-time code. Confirm the code there. New users create their account on that page, and can connect Stripe and add their site. It needs a workspace owner or admin: otherwise the page says "Only a workspace owner or admin can connect the CLI."

  • --no-browser prints the link and code instead of opening the browser.
  • When an agent runs it without a terminal, it prints the link and code and waits. Approve in the browser, then run the same command again.

The key is saved to ~/.config/saasfunnels/credentials.json, readable only by you, and never printed.

Let SaaSFunnels read your app

Terminal
npx --yes saasfunnels@latest setup run

Reads your app to find your events, features, plans and prices. It asks before uploading anything and sends only what it found, never your source code. An admin then reviews the results in the app. If it stops partway, run it again with --resume. For scripts, add --send --non-interactive to approve the upload up front. See Let SaaSFunnels read your app.

Commands

CommandWhat it doesKey
login [--no-browser]Signs in with the browser and saves a key for this computerNone
whoamiShows the workspace you're signed in toSaved key or SAASFUNNELS_API_KEY
logoutRevokes the saved key and removes it from this computerSaved key
initWrites .saasfunnels/config.json (no secrets)None
agent install --target claude-code|codex|cursor|markdownWrites the Funnel and event-discovery playbooks for your agent. It doesn't connect the MCP server.None
setup run [--resume]Reads your app for events, features and plansSaved key or SAASFUNNELS_API_KEY
events sample --source directPrints an example server eventNone
events validate <file> --source directChecks an event payloadNone
events send-test --file <file>Sends one event to your workspaceSAASFUNNELS_INGEST_API_KEY
features setupFinds feature gates in your code and shows them for you to acceptNone
features check --feature <key> --account-id <id>Checks what a customer gets for one feature, in testSAASFUNNELS_FUNNELS_SERVER_KEY (a test key)
plans discoverLists the files that define your plans and pricesNone
catalog discover, catalog validate, catalog diffFinds your catalog in code, checks a catalog file, and compares it with your workspaceNone
funnels types <funnel_id>Writes TypeScript types for a Funnel's steps, fields and buttonsSaved key
doctorChecks your workspace's sources, events and destinationsSAASFUNNELS_API_KEY
readinessLists what's left to set upSAASFUNNELS_API_KEY
verify [--event <file>] [--live]One check for installs and CISAASFUNNELS_API_KEY with --live
mcp serveA local, read-only MCP server. For building, use the hosted MCP server.SAASFUNNELS_API_KEY

Prefix each with npx saasfunnels. Add --json to most commands for machine-readable output, and run npx saasfunnels --help for every command and flag.

Files

FileWhat's in it
.saasfunnels/config.jsonSettings for this repository. No secrets; safe to commit.
~/.config/saasfunnels/credentials.jsonThe key login saved. Readable only by you. Never commit it.
Playbooks from agent installSee How it works with your app

Environment variables

VariableUsed for
SAASFUNNELS_API_KEYA Developer tools or Discovery key, for workspace reads and setup run
SAASFUNNELS_INGEST_API_KEYAn Event ingestion key, for events send-test
SAASFUNNELS_FUNNELS_SERVER_KEYA test Funnel server key, for features check. Never put it in browser code.
SAASFUNNELS_API_BASE_URLDefaults to https://app.saasfunnels.com. Change it only for local testing.

See API keys and scopes for where to create each key.

Exit codes

CodeMeaning
0Passed
1The check failed, for example an invalid payload
2The check couldn't run: a missing key, a network problem or a bad setting

What's next