Skip to main content
Variable interpolation is the mechanism that replaces {{placeholder}} expressions with actual values at runtime. This page covers all interpolation contexts, resolution rules, and advanced patterns.

Interpolation Syntax

All interpolation uses double curly braces:

Where Interpolation Works

Variables can appear in:

Variable Sources

Inline Variables

Defined at the top of a .http file:

Environment Variables

From hitspec.yaml environments section:

System Environment Variables

Using the $env() function:

Built-in Functions

Dynamic values generated at runtime:

Captured Values

Values extracted from prior responses:

Resolution Order

When the same variable name exists in multiple sources, hitspec resolves in this order (later sources win):
  1. Config environmentshitspec.yaml environments section for the active --env
  2. Inline variables@variable = value in the file
  3. Captured values{{requestName.captureName}}
Built-in functions ($uuid(), $timestamp(), $env(), …) and system variables ({{$VAR}}) are evaluated wherever they appear.

Capture Chains

Chain captures across dependent requests:
Step 3 references captures from both Step 1 (login.token) and Step 2 (createResource.resourceId).

Nested Interpolation

Variables can reference other variables:

Unresolved Variables

If a variable cannot be resolved, it remains as the literal {{variableName}} string in the request. hitspec does not error on unresolved variables — the request is sent with the raw placeholder, which typically causes a server-side error that surfaces through your assertions.
Use --verbose (or -v) to see resolved variable values in the output, which helps debug interpolation issues.
Last modified on June 16, 2026