Skip to content

CLI Reference

OptionAliasTypeDescription
--help—booleanShow help for commands and options
--version—booleanShow 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
workspace—string.Workspace root directory (positional)
--port-pnumber4097Port to listen on
--host-Hstring127.0.0.1Host to bind to
--web—booleanfalseEnable web UI and open browser in addition to TUI
--expose—booleanfalseAllow 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
name—string—Project name / directory (positional)
--yes-ybooleanfalseSkip prompts, use defaults
--template-tstring—Template (empty, basic)
--no-tests—booleanfalseSkip test file generation
--test-runner—string—Test runner (bun, vitest, jest)

Execute a request from a .http file.

Terminal window
treq run <file>
OptionAliasTypeDefaultDescription
file—stringrequiredPath to .http file (positional)
--name-nstring—Select request by @name directive
--index-inumber—Select request by index (0-based)
--profile-pstring—Config profile to use
--env-estring—Environment loaded from environments/<env>.ts or .js
--var-vstring[]—Variables as key=value pairs
--timeout-tnumber—Request timeout in milliseconds
--workspace-wstring—Workspace root directory
--verbose—booleanfalseShow detailed output
--json—booleanfalseOutput response as JSON (includes plugin info/reports)
--no-plugins—booleanfalseDisable 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
url—string—WebSocket URL (ws:// or wss://) (positional)
--file-fstring—Path to .http file containing a WebSocket request
--name-nstring—Select request by @name directive (file mode)
--index-inumber—Select request by index (0-based, file mode)
--profile-pstring—Config profile to use
--var-vstring[]—Variables as key=value pairs
--server-sstringhttp://127.0.0.1:4097Server URL to connect to
--token-tstring—Bearer token for authentication
--timeout—number—WebSocket connect timeout in milliseconds
--execute-xstring—Send one message, then follow batch wait behavior
--wait-wnumber2Batch wait seconds before close (-1 waits indefinitely)
--json—booleanfalseEmit live NDJSON events
--verbose—booleanfalseShow verbose output
--no-color—booleanfalseDisable 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-wstring—Workspace root directory
--token-tstring—Bearer token for authentication
--cors-cstring—Allowed CORS origins (comma-separated)
--max-body-size—number10485760Max response body size in bytes
--max-sessions—number100Max concurrent sessions
--stdio—booleanfalseJSON-RPC over stdin/stdout
--web—booleanfalseEnable 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-tstring—Bearer token for authentication

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

Terminal window
treq web [workspace]
OptionAliasTypeDefaultDescription
workspace—string.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
target—stringlatestVersion to upgrade to (positional)

Validate .http files for syntax and diagnostics.

Terminal window
treq validate <path>
OptionAliasTypeDefaultDescription
path—stringrequiredPath to .http file or directory (positional)
--json—booleanfalseOutput diagnostics as JSON
--verbose—booleanfalseInclude 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
file—stringrequiredPath to Postman collection JSON file (positional)
--output-ostring./<collection-name>Output directory
--strategy—stringrequest-per-fileFile strategy (request-per-file, folder-per-file)
--report-disabled—booleanfalseEmit diagnostics for disabled Postman items
--dry-run—booleanfalsePreview import without writing files
--on-conflict—stringfailConflict policy (fail, skip, overwrite, rename)
--merge-variables—booleanfalseMerge collection variables into t-req config
--force—booleanfalseProceed even when converter emits error diagnostics