Running the CLI
Thetwenty CLI connects to Twenty workspaces from your terminal. Use it to inspect metadata, read records, send API requests, and create, sync and debug apps. The CLI itself requires Node.js 24.5+. App development also needs a Node version supported by the installed SDK, see Quick Start.
Run any command through npx, without a global installation:
twenty directly:
twenty. Replace twenty with npx twenty@latest if you did not install it globally. Run twenty commands for the full command list and twenty <command> --help for the options of one command.
Every command that talks to a workspace accepts
--remote <name> to target a saved connection other than the default one, and --json for structured output.
Connecting to a workspace
Sign in with your browser.--use makes this connection the default one:
http://localhost:2020 for the local development environment, http://localhost:3000 for a source checkout. You can copy the exact command from Settings > Developers > CLI. Browser sign-in needs Twenty 2.42 or later.
Keep several connections by naming them:
TWENTY_API_URL and TWENTY_API_KEY for a single run without saving anything. Saved connections live in ~/.twenty/config.json.
Commands select a workspace in this order:
- An explicit
--remote <name>, which overrides the target environment variables. TWENTY_REMOTE, or the pairTWENTY_API_URLandTWENTY_API_KEY. Do not combine these two methods.- The saved default remote.
auth login --name <name> saves a connection but keeps an existing default. Add --use, or run twenty remote use <name>, to change the default.
Exploring your data
company or companies). Raw API writes run without a confirmation step, and your permissions in the workspace still apply.
Building an app
app initwrites a new project from the template. It does not install dependencies or contact a workspace.app apply --createbuilds the app, registers it in the workspace, installs it and syncs its metadata.app devwatches your source and syncs every successful build.
Definitions missing from your source are deleted from the workspace by default. Pass
--no-prune to keep them. The workspace Custom application keeps them unless you pass --prune. Deleting objects or fields also deletes their data, so it requires confirmation. See Syncing & recovery for details.
Executing functions
Run a deployed logic function without triggering it through a route, a cron or a database event. Sync your local changes withapp apply or app dev first.
Watching function logs
Stream the output of your app’s logic functions as executions finish:Uninstalling an app
twenty app apply can install it again.
Diagnosing problems
doctor checks your Node version, which twenty binary is on your PATH, your saved connections and the app SDK, then reports what to fix.
Scripts and tests
Build output belongs to the CLI. Do not read.twenty/output/manifest.json or import internal build code; read data.manifest from twenty app build --json.