Skip to content

Your First .http File

Create a new file called requests.http in your project (or anywhere):

### Hello world
GET https://httpbin.org/get
Accept: application/json

If you're using VS Code with the REST Client extension, any JetBrains IDE, Visual Studio 2022, or Neovim with kulala.nvim or rest.nvim — the file will be recognized automatically.

Look for a "Send Request" link or button above the GET line.

Click "Send Request" (or use the keyboard shortcut — typically Ctrl+Alt+R in VS Code, Ctrl+Enter in JetBrains). The response appears in a side panel.

@host = httpbin.org
@accept = application/json
### Get request with variables
GET https://{{host}}/get
Accept: {{accept}}
### Post request
POST https://{{host}}/post
Content-Type: application/json
{
"message": "Hello from a .http file",
"timestamp": "{{$timestamp}}"
}
Universal Supported identically by all major implementations.

Variable definition with @var = value and substitution with {{var}} work in all clients.

For switching between dev and production, create an http-client.env.json file alongside your .http file:

{
"development": {
"host": "localhost:3000",
"token": "dev-token-123"
},
"production": {
"host": "api.example.com",
"token": "prod-token-456"
}
}

Then reference the variables in your requests:

GET https://{{host}}/api/users
Authorization: Bearer {{token}}
Widely Supported Supported by 3+ implementations, possibly with syntax variations.

The http-client.env.json format is supported by JetBrains, httpyac, Visual Studio 2022, and kulala.nvim. VS Code REST Client uses settings.json instead.