Newman --env-var not being used

Archived topic — this may be out of date.
Newman has been replaced by the Postman CLI, Postman’s official, signed command-line tool. It runs collections as Newman did, and also lints API specs, runs mocks and monitors, and syncs local files with Postman from your terminal, CI/CD pipeline or coding agent.
Working with an AI coding agent? The Postman plugin lets agents in Claude Code, Cursor, Codex and others design, mock, test and ship APIs with Postman.
For current help, see the Postman docs, try the free Postman tools (no account needed), or join us on Discord.

Everything I have read so far says this should work. For some reason the ‘base_url’ value is never updated to the value passed in. Is there something obvious I’m missing? Thanks.

newman run https://api.getpostman.com/collections/uuid?apikey=key --environment https://api.getpostman.com/environments/uuid?apikey=key –-env-var base_url=“localhost:5000”

Hey @paulsc

Welcome to the community!! :wave:

The syntax doesn’t look quite right to me, would this work?

--env-var "base_url=localhost:5000"

Just need to ensure that you have a variable in the collection called {{base_url}}.

@danny-dainton Thanks for the reply.

I should have mentioned I tried it quoted as you have it with the same result. I have a GET request that references {{base_url}} and hovering over it shows the variables scope as Environment. I also tried setting it as a global and passing it as --global-var with the same result. I must be overlooking something obvious. Thanks.

Have you tried with a variation of variable names?

Try with baseURL or just URL, basically anything without the underscore in the name. Not sure it that’s impacting it but worth a try.

I have a reporter that shows which variables and values are used if that’s any use to you?

You can see the variables by using the --reporter-htmlextra-showEnvironmentData flag.