Quick answer: Insomnia has no separate base URL list or dropdown. You store the base URL as an environment variable, create one sub-environment per target such as development, staging, or production, and reference it in every request with {{ _.base_url }}. Switching the active sub-environment repoints every request at once. Only one base URL is active at a time, so this is a switch-between-targets model, not a hit-all-targets-at-once model.
Why the base URL lives in an environment
An environment in Insomnia is a JSON object of key-value pairs you can reference in any text field. Base URLs, auth tokens, and resource IDs are the most common values because they change across deployments while the request paths stay the same. Keeping the host in a variable means you write the path once and never edit forty requests when the staging domain moves.
Set a base environment with the shared defaults, then add sub-environments that override only the host. A sub-environment inherits everything from its parent, so you declare just the values that differ.
{
"base_url": "https://localhost:8080",
"api_version": "v1"
}
A sub-environment named Staging only needs the override:
{
"base_url": "https://staging.example.com"
}
And Production gets its own:
{
"base_url": "https://api.example.com"
}
In the request URL field, combine the variable with the path. The _. prefix points at the currently active environment:
GET {{ _.base_url }}/{{ _.api_version }}/orders
Variable names can contain only letters, numbers, and underscores. Press Control+Space in a field to list available variables.
Where each value comes from: scope and priority
Insomnia runs environments at several levels. When the same variable name exists in more than one place, the level higher in this list wins.
| Priority | Environment level | Typical role |
|---|---|---|
| 1 | Folder environment | Values for requests inside one folder |
| 2 | Selected collection sub-environment | Staging or production overrides |
| 3 | Collection base environment | Shared defaults for the collection |
| 4 | Selected global sub-environment | Cross-collection overrides |
| 5 | Global base environment | Workspace-wide defaults |
This ordering explains a common surprise: a request that keeps hitting the wrong host even after you change the base environment usually has a folder-level variable or an active sub-environment overriding it. Trace the name down the table instead of editing every level.
The slash trap and the spec server question
Two practical issues cause most base URL bugs. The first is slash handling. If the variable ends with a slash and the path starts with one, the rendered URL contains a double slash; if neither carries a slash, the segments glue together. Pick one convention and hold to it: store base_url with no trailing slash and start every path with a leading slash.
The second is what happens after you import an OpenAPI document. The spec's server URL is used to seed the base URL variable, but the server entries inside the document are read-only. Multiple servers entries do not become runtime targets you can fire in parallel; you still manage the active host through environments. To change a server that lives in the spec, patch the document itself. To change the host you send requests to without touching the spec, edit the environment variable.
Sub-environments can also be marked private. A private sub-environment never syncs or exports and needs a vault key to open, which makes it the right place for host-specific secrets. Secret-type values are masked and encrypted at rest.
"Multiple base URLs" means several values you switch between, not several targets hit in a single run. If a regression check has to prove the same behavior across development, staging, and production, run the collection once per environment and compare the outcomes rather than expecting one execution to cover all three.
Frequently asked questions
Can one request hit two base URLs at the same time? No. The active environment supplies one value for the variable. To exercise two hosts, run the request against each environment in turn, or use the Collection Runner with different environments selected.
Why does my rendered URL show double slashes? The variable ends with a slash while the path also starts with one. Remove the trailing slash from base_url or the leading slash from the path, and apply the same rule across every request.
How do I change the base URL after importing an OpenAPI spec? Edit the environment variable for the host you call during testing. The server entries inside the spec stay read-only and change only through a spec patch.
Do sub-environment values sync to other machines? Ordinary sub-environments sync with the workspace. Private ones never sync or export, and secret variables stay encrypted and masked.
The bottom line
Treat the base URL as what it is: a deployment-specific value that belongs in an environment next to tokens and version numbers, not hardcoded into each request. The discipline that keeps this working is one variable name, a fixed slash convention, and a clear mental model that only one host is active at a time. When you want the same calls to run as an ordered sequence with assertions at each step instead of a manual switch-and-click loop, Powerduck keeps scenario runs and code review in one desktop app. For the broader set of differences across tools, the Insomnia comparison hub covers how each one handles environments and request workflows.
Top comments (0)