Skip to content

HTTP Mode

Build, test, and manage API requests with t-req's HTTP mode.

t-req includes a built-in HTTP client for building, testing, and managing API requests. Toggle between the AI assistant and HTTP mode with a single keybind.


Accessing HTTP Mode

Press ctrl+m to toggle between Agent mode (AI assistant) and HTTP mode (API client).

When you enter HTTP mode, you’ll see:

  • URL bar at the top for entering request URLs
  • Request panel (left) with tabs for params, headers, body, auth, docs, and scripts
  • Response panel (right) showing response body, headers, and status
  • Footer displaying workspace name and active environment

Making Requests

URL and Method

Enter your request URL in the URL bar at the top. The URL supports environment variable substitution using {{VARIABLE_NAME}} syntax.

Select the HTTP method using ctrl+shift+m or click the method dropdown:

  • GET, POST, PUT, PATCH, DELETE, HEAD, OPTIONS

Query Parameters

Use the Params tab to add query parameters as key-value pairs. Parameters are automatically synced with the URL - editing either updates the other.

ColumnDescription
KeyParameter name
ValueParameter value (supports {{variables}})
EnabledToggle to include/exclude parameter

Headers

Use the Headers tab to add custom HTTP headers. Common headers like Content-Type are set automatically based on body type.

Request Body

Use the Body tab to set the request body. Select from:

JSON

{
"name": "{{USER_NAME}}",
"email": "user@example.com"
}

Form (URL-encoded) Key-value pairs sent as application/x-www-form-urlencoded.

Raw Plain text content with any content type.

Documentation

Use the Docs tab to add markdown documentation to your request. This is useful for describing what the request does, expected responses, or usage notes.

  • Press Enter to start editing
  • Press Esc to exit editing mode
  • Use <leader>e to open in external editor

Scripts

Use the Scripts tab to add pre/post hooks and tests. See Scripts for details.

Sending Requests

Press ctrl+shift+return to send the request. If the request has tests, you’ll be prompted to choose:

  • Send - Execute request without tests
  • Send with Tests - Execute request and run tests

Authentication

Configure request authentication in the Auth tab.

Bearer Token

Adds Authorization: Bearer <token> header.

Type: Bearer Token
Token: {{API_TOKEN}}

Basic Auth

Adds Authorization: Basic <base64> header with encoded credentials.

Type: Basic Auth
Username: {{USERNAME}}
Password: {{PASSWORD}}

API Key

Adds a custom header with your API key.

Type: API Key
Header Name: X-API-Key
Value: {{API_KEY}}

Response Viewer

The response panel displays:

  • Status - HTTP status code and text (e.g., 200 OK)
  • Time - Request duration in milliseconds
  • Body - Response body with syntax highlighting for JSON
  • Headers - Response headers

Toggle the response panel visibility with ctrl+\.


History

t-req automatically tracks request history. Access previous requests through the command palette (ctrl+p) and search for “history”.

Configure history retention in your treq.json:

treq.json
{
"requests": {
"history_retention": "forever"
}
}

Options: "forever", "30days", "7days", "session"

See Requests Configuration for more options.


Cookies

Auto-Capture

By default, cookies from responses are automatically captured and stored in a cookie jar. They’re sent with subsequent requests to matching domains.

Configure per-request cookie behavior:

  • Auto Capture - Capture cookies from response
  • Send Cookies - Send cookies from jar with request

Manual Cookies

Add manual cookies that are sent with the request regardless of the cookie jar.

Access the cookie manager through the command palette to view, edit, or delete stored cookies.


Keybinds

KeybindAction
ctrl+mToggle between Agent/HTTP mode
ctrl+shift+returnSend request
ctrl+nNew collection or request
ctrl+sSave request
ctrl+lFocus URL bar
ctrl+\Toggle response panel
ctrl+shift+eManage environments
ctrl+shift+mSelect HTTP method
<leader>tCollection tree view
ctrl+pCommand palette