CLI reference
Mock API Studio CLI Reference
Use the Mock API Studio CLI to authenticate, choose a workspace and project, synchronize its configuration, and start the mock server. The official package can run through npx or a global installation.
Install or run the CLI
Node.js 20.19 or a compatible newer release is required. npx runs the published package without adding a global executable.
npx mock-api-studio-cli --help
# Optional global install
npm install --global mock-api-studio-cli
mock-api-studio-cli --helpStart a project
Run without arguments for the interactive workspace and project picker, or use start with a slug. Joined Team workspaces can be selected with an explicit workspace ID.
npx mock-api-studio-cli
npx mock-api-studio-cli start customer-portal
npx mock-api-studio-cli start team-project --workspace <workspace-id>Manage local authentication
The first interactive run asks for an API token. Token resolution checks --token, the local config file, then MOCK_API_TOKEN. Treat the value as a secret.
npx mock-api-studio-cli whoami
npx mock-api-studio-cli logoutTroubleshoot a start command
Use --port when the configured port is occupied. If authentication fails, log out and supply a current token. If no routes load, validate the project has at least one bound resource.
Related questions
Where is the saved CLI token?
The interactive CLI stores it in ~/.mock-api-studio/config.json unless an explicit token or environment variable is used.
Keep exploring
Last updated September 17, 2026. Product behavior described here is verified against the current Mock API Studio runtime.