mock-api-studio-cli
Mock API Studio
Start a local mock API server from your Mock API Studio cloud project definitions.
Install
Run without installing globally:
npx mock-api-studio-cli --help
Or install the package globally:
npm install --global mock-api-studio-cli
mock-api-studio-cli --help
The legacy mock-api-studio executable remains available as a compatibility alias.
Quickstart
Run the interactive project picker:
npx mock-api-studio-cli
The first run asks for an API token, saves it locally, lists your projects, and starts the selected mock server.
Start a project directly by slug:
npx mock-api-studio-cli my-project
Use an explicit port when you want to override the project default:
npx mock-api-studio-cli my-project --port 4500
The interactive picker first lets you choose between your personal workspace and any active Team workspaces you joined. To start a Team project directly, pass its workspace ID:
npx mock-api-studio-cli start team-project --workspace 11111111-1111-4111-8111-111111111111
Team viewers can discover, sync, and run projects locally, but cannot change cloud project configuration. Suspended or revoked workspace access is reported before a project is started.
Commands
start <slug>
Starts a project without opening the interactive picker.
npx mock-api-studio-cli start my-project
Use --workspace <id> when the slug belongs to a joined Team workspace.
whoami
Shows the account associated with the saved token.
npx mock-api-studio-cli whoami
logout
Removes the locally saved token.
npx mock-api-studio-cli logout
Local Config
The interactive CLI stores the token in:
~/.mock-api-studio/config.json
Token resolution order:
--token- local config
MOCK_API_TOKEN
The CLI connects to https://api.mockapistudio.dev by default. For local backend
development, override it with MOCK_API_BASE_URL as shown in .env.example.
Mock Server
The synced mock server exposes:
- configured resource routes such as
/users - only the enabled operations for each resource
GET /openapi.jsonGET /docs- runtime control routes under
/_mock
Troubleshooting
Port is already in useUse--port <number>with a free port, or change the project local mock port in the dashboard.Invalid or expired API tokenRunnpx mock-api-studio-cli logout, then runnpx mock-api-studio-cliagain and paste a fresh token.Project has no mock resourcesAdd mock resources in the dashboard, then rerun the CLI.
Links
License
Mock API Studio CLI is commercial software. Use requires an authorized Mock API Studio account and is governed by the included license and the Terms of Service.