Features

Collections

Save requests into named collections for reuse. Collections appear in the sidebar and persist in VS Code’s globalState.

  • Save — Press Cmd+S to save the current request
  • Organize — Drag and drop to reorder requests within a collection
  • Context menu — Right-click a request to duplicate, rename, or delete it
  • Load — Click any saved request to open it in a new tab

Environments & Variables

Define named sets of key-value variables and reference them anywhere with {{variableName}} syntax — in URLs, headers, body, params, and auth fields.

Creating Environments

Open the Environments panel in the sidebar. Create environments like “Development”, “Staging”, and “Production” with different base URLs, API keys, or tokens.

Switching

Only one environment is active at a time. Click the environment selector to switch. Variables resolve instantly.

Disabling Variables

Toggle individual variables on/off without deleting them — useful for temporary debugging.

Authentication

Rex supports 6 authentication methods, configured in the Auth tab:

Method Description
Bearer Token Token in the Authorization header
Basic Auth Base64-encoded username:password
API Key Key sent as a header or query parameter
OAuth 2.0 Authorization Code, Client Credentials, and PKCE grant types with automatic token refresh
AWS Signature V4 Request signing for AWS services
Digest Auth Challenge-response authentication with automatic retry

OAuth 2.0 tokens are tracked with expiration times and refreshed automatically before they expire.

Body Editor

The Body tab supports multiple content types:

Type Use Case
JSON API payloads with syntax highlighting and formatting
Form Data Multipart form submissions with file uploads
URL-Encoded Standard HTML form encoding
Raw Plain text or any custom content type
GraphQL Query editor with variables pane and introspection
None No body (GET, HEAD requests)

The editor uses Monaco (the same editor engine as VS Code) for syntax highlighting, formatting, and auto-complete.

Pre-Request & Test Scripts

Write JavaScript in the Scripts tab to run before sending (pre-request) or after receiving a response (test).

Pre-Request Scripts

Modify the request before it’s sent:

rex.request.headers.set("X-Request-ID", crypto.randomUUID());
rex.environment.set("timestamp", Date.now().toString());

Test Scripts

Assert on the response and extract values:

rex.test("Status is 200", rex.response.status === 200);

const data = rex.response.json();
rex.test("Has user ID", data.id !== undefined);
rex.variables.set("userId", data.id);

Available API

Object Scope Methods
rex.request Pre-request .url, .method, .headers.get/set, .body
rex.response Test only .status, .json(), .headers
rex.environment Both .get(key), .set(key, value)
rex.variables Both .get(key), .set(key, value)
rex.test Test only (name, assertion) — report pass/fail

Scripts have a 5-second timeout. Logs, warnings, and errors are captured and displayed.

Request Chaining

Build sequences of dependent API requests in the Chains panel:

  1. Create a chain and add steps (each step references a saved request)
  2. Configure variable overrides per step
  3. Add pre-request and test scripts to extract values
  4. Set failure handling: stop, skip, or retry (with configurable attempts)
  5. Run the chain and watch real-time progress with pass/fail indicators

Chains are useful for workflows like: authenticate → create resource → verify creation → clean up.

WebSocket

Connect to WebSocket endpoints (ws:// and wss://) from the request builder:

  • Send and receive messages in real-time
  • View a timestamped message log with direction badges (sent/received)
  • Support for subprotocols
  • Binary message handling
  • Connection state indicators (connecting, connected, error)

Server-Sent Events

Connect to SSE endpoints to watch events arrive in real-time:

  • Event type and payload display
  • Timestamps on each event
  • Auto-scroll with manual override
  • Expandable event details

GraphQL

Switch the body type to GraphQL for a dedicated editing experience:

  • Query editor with syntax highlighting
  • Variables pane (JSON format)
  • Operation name selector
  • Schema introspection — Rex fetches the schema from the endpoint and provides autocomplete for types, fields, queries, mutations, and fragments

Response Viewer

Responses are rendered based on content type:

Content Type Rendering
JSON Syntax highlighted with line numbers and auto-formatting
HTML Inline iframe preview + raw source view
Images Inline display with dimensions
PDF Built-in PDF viewer
Binary Hex dump with download option

Status codes are color-coded: green (2xx), blue (3xx), amber (4xx), red (5xx).

History & Diff

Every request is automatically logged in the History panel with the full request and response.

  • Search by URL, method, or status code
  • Filter by time range
  • Diff — Select any two history entries to compare body, headers, and status side by side with line-by-line change highlighting