Developers
CLI
Reference for the saasfunnels command, its commands, flags, files, environment variables and exit codes.
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:
npm install --save-dev saasfunnels@^0.16.0 && npx saasfunnels init && npx saasfunnels agent install --target claude-codeOr run any command without installing:
npx --yes saasfunnels@latest <command>Sign in
npx saasfunnels loginOpens 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-browserprints 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
npx --yes saasfunnels@latest setup runReads 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
| Command | What it does | Key |
|---|---|---|
login [--no-browser] | Signs in with the browser and saves a key for this computer | None |
whoami | Shows the workspace you're signed in to | Saved key or SAASFUNNELS_API_KEY |
logout | Revokes the saved key and removes it from this computer | Saved key |
init | Writes .saasfunnels/config.json (no secrets) | None |
agent install --target claude-code|codex|cursor|markdown | Writes 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 plans | Saved key or SAASFUNNELS_API_KEY |
events sample --source direct | Prints an example server event | None |
events validate <file> --source direct | Checks an event payload | None |
events send-test --file <file> | Sends one event to your workspace | SAASFUNNELS_INGEST_API_KEY |
features setup | Finds feature gates in your code and shows them for you to accept | None |
features check --feature <key> --account-id <id> | Checks what a customer gets for one feature, in test | SAASFUNNELS_FUNNELS_SERVER_KEY (a test key) |
plans discover | Lists the files that define your plans and prices | None |
catalog discover, catalog validate, catalog diff | Finds your catalog in code, checks a catalog file, and compares it with your workspace | None |
funnels types <funnel_id> | Writes TypeScript types for a Funnel's steps, fields and buttons | Saved key |
doctor | Checks your workspace's sources, events and destinations | SAASFUNNELS_API_KEY |
readiness | Lists what's left to set up | SAASFUNNELS_API_KEY |
verify [--event <file>] [--live] | One check for installs and CI | SAASFUNNELS_API_KEY with --live |
mcp serve | A 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
| File | What's in it |
|---|---|
.saasfunnels/config.json | Settings for this repository. No secrets; safe to commit. |
~/.config/saasfunnels/credentials.json | The key login saved. Readable only by you. Never commit it. |
Playbooks from agent install | See How it works with your app |
Environment variables
| Variable | Used for |
|---|---|
SAASFUNNELS_API_KEY | A Developer tools or Discovery key, for workspace reads and setup run |
SAASFUNNELS_INGEST_API_KEY | An Event ingestion key, for events send-test |
SAASFUNNELS_FUNNELS_SERVER_KEY | A test Funnel server key, for features check. Never put it in browser code. |
SAASFUNNELS_API_BASE_URL | Defaults to https://app.saasfunnels.com. Change it only for local testing. |
See API keys and scopes for where to create each key.
Exit codes
| Code | Meaning |
|---|---|
0 | Passed |
1 | The check failed, for example an invalid payload |
2 | The check couldn't run: a missing key, a network problem or a bad setting |