Skip to content

CLI Reference

OptionAliasTypeDescription
--helpbooleanShow help for commands and options
--versionbooleanShow installed t-req version

Plugin commands may also appear in treq --help when loaded from your project config.

  • treq import postman <file>
  • treq import <source>
  • treq init [name]
  • treq open [workspace]
  • treq run <file>
  • treq serve
  • treq tui
  • treq upgrade [target]
  • treq validate <path>
  • treq web [workspace]
  • treq ws [url]

Launch the interactive TUI (starts a local server automatically).

Terminal window
treq open [workspace]
OptionAliasTypeDefaultDescription
workspacestring.Workspace root directory (positional)
--port-pnumber4097Port to listen on
--host-Hstring127.0.0.1Host to bind to
--webbooleanfalseEnable web UI and open browser in addition to TUI
--exposebooleanfalseAllow non-loopback binding (disables cookie auth)

--web and --expose cannot be used together.

Scaffold a new t-req workspace.

Terminal window
treq init [name]
OptionAliasTypeDefaultDescription
namestringProject name / directory (positional)
--yes-ybooleanfalseSkip prompts, use defaults
--template-tstringTemplate (empty, basic)
--no-testsbooleanfalseSkip test file generation
--test-runnerstringTest runner (bun, vitest, jest)

Execute a request from a .http file.

Terminal window
treq run <file>
OptionAliasTypeDefaultDescription
filestringrequiredPath to .http file (positional)
--name-nstringSelect request by @name directive
--index-inumberSelect request by index (0-based)
--profile-pstringConfig profile to use
--env-estringEnvironment loaded from environments/<env>.ts or .js
--var-vstring[]Variables as key=value pairs
--timeout-tnumberRequest timeout in milliseconds
--workspace-wstringWorkspace root directory
--verbosebooleanfalseShow detailed output
--jsonbooleanfalseOutput response as JSON (includes plugin info/reports)
--no-pluginsbooleanfalseDisable plugin loading
--plugin-Pstring[]Load additional plugins (npm package or file:// path)

--name and --index are mutually exclusive.

Open a WebSocket session through a running t-req server.

Terminal window
treq ws [url]
OptionAliasTypeDefaultDescription
urlstringWebSocket URL (ws:// or wss://) (positional)
--file-fstringPath to .http file containing a WebSocket request
--name-nstringSelect request by @name directive (file mode)
--index-inumberSelect request by index (0-based, file mode)
--profile-pstringConfig profile to use
--var-vstring[]Variables as key=value pairs
--server-sstringhttp://127.0.0.1:4097Server URL to connect to
--token-tstringBearer token for authentication
--timeoutnumberWebSocket connect timeout in milliseconds
--execute-xstringSend one message, then follow batch wait behavior
--wait-wnumber2Batch wait seconds before close (-1 waits indefinitely)
--jsonbooleanfalseEmit live NDJSON events
--verbosebooleanfalseShow verbose output
--no-colorbooleanfalseDisable ANSI colors in human-readable mode

Exactly one source is required: positional url or --file. --name and --index are file-mode only and cannot be combined. --timeout must be an integer and at least 100. --wait must be -1 or a non-negative integer.

Start the HTTP API server.

Terminal window
treq serve
OptionAliasTypeDefaultDescription
--port-pnumber4097Port to listen on
--host-Hstring127.0.0.1Host to bind to
--workspace-wstringWorkspace root directory
--token-tstringBearer token for authentication
--cors-cstringAllowed CORS origins (comma-separated)
--max-body-sizenumber10485760Max response body size in bytes
--max-sessionsnumber100Max concurrent sessions
--stdiobooleanfalseJSON-RPC over stdin/stdout
--webbooleanfalseEnable web UI

--token is required when binding to a non-loopback host.

Complete schema: GET /doc

Commonly used endpoints:

MethodPathDescription
GET/healthHealth check
GET/capabilitiesProtocol version and features
GET/configResolved project configuration
POST/parseParse .http file content
POST/executeExecute an HTTP request
POST/execute/wsExecute a WebSocket request definition
POST/sessionCreate a session
GET/session/{id}Get session state
PUT/session/{id}/variablesUpdate session variables
GET/eventSSE event stream
GET/event/wsWebSocket event stream
GET/ws/session/{wsSessionId}WebSocket request-session control channel
GET/workspace/filesList .http files
GET/workspace/requestsList requests in a file
POST/scriptRun a script
POST/testRun tests

Connect to a running server with the terminal UI.

Terminal window
treq tui
OptionAliasTypeDefaultDescription
--server-sstringhttp://localhost:4097Server URL to connect to
--token-tstringBearer token for authentication

Start server and open the web UI in a browser (no TUI).

Terminal window
treq web [workspace]
OptionAliasTypeDefaultDescription
workspacestring.Workspace root directory (positional)
--port-pnumber4097Port to listen on
--host-Hstring127.0.0.1Host to bind to

Upgrade t-req to a newer version.

Terminal window
treq upgrade [target]
OptionAliasTypeDefaultDescription
targetstringlatestVersion to upgrade to (positional)

Validate .http files for syntax and diagnostics.

Terminal window
treq validate <path>
OptionAliasTypeDefaultDescription
pathstringrequiredPath to .http file or directory (positional)
--jsonbooleanfalseOutput diagnostics as JSON
--verbosebooleanfalseInclude files with no issues

Exit codes: 1 when validation errors are found, otherwise 0.

Import requests from external formats.

Terminal window
treq import <source>

Currently supported source:

  • postman

Import requests from a Postman collection.

Terminal window
treq import postman <file>
OptionAliasTypeDefaultDescription
filestringrequiredPath to Postman collection JSON file (positional)
--output-ostring./<collection-name>Output directory
--strategystringrequest-per-fileFile strategy (request-per-file, folder-per-file)
--report-disabledbooleanfalseEmit diagnostics for disabled Postman items
--dry-runbooleanfalsePreview import without writing files
--on-conflictstringfailConflict policy (fail, skip, overwrite, rename)
--merge-variablesbooleanfalseMerge collection variables into t-req config
--forcebooleanfalseProceed even when converter emits error diagnostics