Skip to content

CLI Options

Inspectr supports a wide range of CLI flags to control how it captures, proxies, and exposes traffic. These options allow you to customize Inspectr to match your workflow.


Flag Type Default Description
--listen string :8080 Address where Inspectr listens for HTTP requests
--backend string (none) Forward requests to this backend service (e.g. http://localhost:3000", https://api.stripe.com)
--mock-backend string (none) Serve mock responses from OpenAPI spec (e.g. ./openapi.yaml, https://inspectr.dev/demo/hello.openapi.yaml)
--mirror boolean false Immediately echo the original request back
--catch boolean false Accept and log requests without forwarding

Flag Type Default Description
--app boolean true Enable embedded Inspectr App UI & API
--app-port string 4004 Port to serve the UI app
--print boolean true Print color-coded log output to the terminal

Flag Type Default Description
--expose boolean false Expose Inspectr publicly via Ingress
--channel string (none) Subdomain to use (e.g. my-api.in-spectr.dev)
--channel-code string (none) Secret code required for remote access to the channel

Key Type Description
--mock-backend string Path or URL to OpenAPI spec for mocking (e.g. ./openapi.yaml, https://inspectr.dev/demo/hello.openapi.yaml)
--mock-dynamic boolean Generate dynamic mock data instead of static examples

Flag Type Default Description
--auth-enabled boolean false Enable API key authentication for proxied requests
--auth-secret string (none) Guard secret used to generate API keys
--auth-token-ttl integer 24 Guard token expiration time in hours

Flag Type Default Description
--api-secret string (none) Protect access to Inspectr’s admin API
--backend-cors boolean false Let the backend handle CORS preflight instead of Inspectr
--data-dir string .inspectr/ Base directory for Inspectr data (DBs, logs)
--store-path string .inspectr/.inspectr.db Path to store request/response history
--store-in-memory boolean false Use in-memory storage instead of persistent disk file

Flag Type Default Description
--operations-retention-ttl string 0 Maximum age for stored operations (for example 24h, 168h). 0 disables TTL cleanup.
--operations-max-stored integer 0 Maximum number of stored operations. 0 disables the cap.

Flag Type Default Description
--config string .inspectr.yaml Path to YAML config file. Auto-detect .inspectr.yaml if present.
--version Print Inspectr version and exit

Flag Type Default Description
--rules-config string (none) Path to a rules YAML file to load at startup
--command string (none) Launch a command when Inspectr boots
--command-arg string Argument to pass to the managed command; repeatable
--command-log-file string .inspectr-command-process.log Log file for the managed command. Defaults to .inspectr/.inspectr-command-process.log
--command-stop-on-failure boolean true Exit Inspectr when the managed command exits with a non-zero status

Flag Type Default Description
--export boolean false Export operations to a timestamped JSON file on shutdown

Flag Type Default Description
--log-file string (none) Write logs to this file instead of .inspectr/inspectr.log
--log-level string none Set log verbosity (debug, info, warn, etc.)
--http-timeout integer 30 HTTP timeout in seconds for backend requests. Expose has a maxmium http-timeout of 30 seconds for non-streaming responses.
--session-expiration integer 24 Session expiration time in hours
--grace-period integer 30 Grace period for session cleanup in seconds

Terminal window
inspectr --backend=http://localhost:3000
Terminal window
inspectr --catch=true --expose --channel=webhook-test --channel-code=secure123
Terminal window
inspectr --mock-backend=./openapi.yaml --mock-dynamic=true
Terminal window
inspectr --operations-retention-ttl=24h --operations-max-stored=5000

By default, Inspectr looks for a .inspectr.yaml file in the current directory, so you can run

Terminal window
inspectr

which will load the default configuration.

If you prefer to use a different config file, you can specify it with the --config flag:

Terminal window
inspectr --config=./inspectr-webhook.yaml

Inspectr can also be used to trigger a command when it starts. This can be any command to start a program or a shell script. Common use cases include running a development server or running a test suite, launch a Inspectr Connector, or run a custom script.

Terminal window
inspectr --command=npm --command-arg=run --command-arg=dev

Inspectr will run the command npm run dev in the background and log its output to .inspectr/inspectr-command-process.log. When Inspectr exits, the command will be terminated.


Register and control Inspectr as a native background service on Windows, Linux, or macOS:

inspectr service install [name] --config <path>
inspectr service start [name]
inspectr service stop [name]
inspectr service restart [name]
inspectr service status [name]
inspectr service uninstall [name]

Run these commands with Administrator privileges on Windows or with sudo on Linux and macOS. See the complete Background Services guide for named instances, logs, recovery, upgrades, and migration.