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.


FlagTypeDefaultDescription
--listenstring:8080Address where Inspectr listens for HTTP requests
--backendstring(none)Forward requests to this backend service
--mock-backendstring(none)Serve mock responses from OpenAPI spec
--mock-dynamicbooleanfalseGenerate dynamic mock data instead of static examples
--mirrorbooleanfalseImmediately echo the original request back
--catchbooleanfalseAccept and log requests without forwarding

FlagTypeDefaultDescription
--appbooleantrueEnable embedded Inspectr App UI & API
--app-portstring4004Port to serve the UI app
--printbooleantruePrint color-coded log output to the terminal

FlagTypeDefaultDescription
--exposebooleanfalseExpose Inspectr publicly via Ingress
--channelstring(none)Subdomain to use (e.g. my-api.in-spectr.dev)
--channel-codestring(none)Secret code required for remote access to the channel

FlagTypeDefaultDescription
--auth-enabledbooleanfalseEnable API key authentication for proxied requests
--auth-secretstring(none)Guard secret used to generate API keys
--auth-token-ttlinteger24Guard token expiration time in hours

FlagTypeDefaultDescription
--api-secretstring(none)Protect access to Inspectr’s admin API
--backend-corsbooleanfalseLet the backend handle CORS preflight instead of Inspectr
--data-dirstring.inspectr/Base directory for Inspectr data (DBs, logs)
--store-pathstring.inspectr/.inspectr.dbPath to store request/response history
--store-in-memorybooleanfalseUse in-memory storage instead of persistent disk file

FlagTypeDefaultDescription
--configstring.inspectr.yamlPath to YAML config file. Auto-detect .inspectr.yaml if present.
--versionPrint Inspectr version and exit

FlagTypeDefaultDescription
--rules-configstring(none)Path to a rules YAML file to load at startup
--commandstring(none)Launch a command when Inspectr boots
--command-argstringArgument to pass to the managed command; repeatable
--command-log-filestring.inspectr-command-process.logLog file for the managed command. Defaults to .inspectr/.inspectr-command-process.log
--command-stop-on-failurebooleantrueExit Inspectr when the managed command exits with a non-zero status

FlagTypeDefaultDescription
--exportbooleanfalseExport operations to a timestamped JSON file on shutdown

FlagTypeDefaultDescription
--log-filestring(none)Write logs to this file instead of .inspectr/inspectr.log
--log-levelstringnoneSet log verbosity (debug, info, warn, etc.)
--http-timeoutinteger30HTTP timeout in seconds for backend requests. Expose has a maxmium http-timeout of 30 seconds for non-streaming responses.
--session-expirationinteger24Session expiration time in hours
--grace-periodinteger30Grace 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

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 in the background and log its output to .inspectr/inspectr-command-process.log. When Inspectr exits, the command will be terminated.