API Reference

Complete reference for request syntax, environment variables, authentication, and VS Code extension commands.

Request Syntax

HttpForge uses a plain-text format for defining HTTP requests. Each request begins with the method and URL on the first line, followed by optional headers and a body.

### Get all users
GET {{baseUrl}}/api/v1/users
Authorization: Bearer {{token}}
Accept: application/json

### Create a user
POST {{baseUrl}}/api/v1/users
Content-Type: application/json

{
  "name": "Jane Developer",
  "email": "jane@example.com"
}

Separate multiple requests in a single file using a line containing three hash characters (###) followed by a descriptive name.

Variables

Reference environment variables using double curly braces: {{variableName}}. Variables are resolved at request time from the active environment.

// Environment: Production
{
  "baseUrl": "https://api.example.com",
  "token": "sk_live_..."
}

// Usage in a request
GET {{baseUrl}}/v1/health

Variable names are case-sensitive. Undefined variables produce a validation warning before the request is sent.

Authentication

Bearer Token

Authorization: Bearer {{accessToken}}

Basic Authentication

Authorization: Basic {{base64Credentials}}

API Key

X-API-Key: {{apiKey}}

HttpForge also supports OAuth 2.0 authorization code flow with automatic token refresh. Configure OAuth providers in Settings > Authentication.

VS Code Commands

The following commands are available in the VS Code Command Palette (Ctrl+Shift+P):

  • HttpForge: Send Request — Execute the request at the current cursor position.
  • HttpForge: Send All Requests — Run every request in the active file sequentially.
  • HttpForge: Switch Environment — Change the active environment for variable resolution.
  • HttpForge: Open Collection — Browse and open saved request collections.
  • HttpForge: New Request — Create a new request in the active editor.