You know the basics. Now let us talk about the flags that solve real problems — timeouts for slow APIs, delays for rate limits, bail for fast failure, running specific folders, and more.
# Global timeout — kill the entire run after 5 minutes (300000ms)
newman run collection.json --timeout 300000
# Per-request timeout — each request must respond within 10 seconds
newman run collection.json --timeout-request 10000
# Script timeout — pre-req/test scripts must finish within 5 seconds
newman run collection.json --timeout-script 5000
# Combine all three
newman run collection.json \
--timeout 300000 \
--timeout-request 10000 \
--timeout-script 5000| Flag | Default | What It Does |
|---|---|---|
| --timeout | No limit | Maximum time for the entire run |
| --timeout-request | No limit | Maximum time per HTTP request |
| --timeout-script | No limit | Maximum time per script execution |
| --delay-request | 0 | Wait N ms between requests |
| --bail | Disabled | Stop on first error |
| --suppress-exit-code | Disabled | Always exit with 0 |
| --folder | All folders | Run only a specific folder |
| --ignore-redirects | Follow redirects | Do not follow 3xx redirects |
| -k / --insecure | Disabled | Skip SSL certificate verification |
Some APIs have rate limits. Send too many requests too fast and you get 429 Too Many Requests. The --delay-request flag adds a pause between each request.
# Wait 1 second between requests
newman run collection.json --delay-request 1000
# Wait 500ms — good for APIs with 2 requests/second limit
newman run collection.json --delay-request 500By default, Newman runs ALL requests even if early ones fail. The --bail flag stops the run on the first error. Useful when later requests depend on earlier ones — if login fails, no point running 50 more requests.
# Stop on the first failure
newman run collection.json --bail
# Bail on specific failure types
newman run collection.json --bail failure # Stop on assertion failure
newman run collection.json --bail folder # Stop if any request in a folder failsYour collection has 10 folders. You only want to run the "Auth" and "Users" folders. The --folder flag does this.
# Run only the "Auth" folder
newman run collection.json --folder "Auth"
# Run multiple folders (run the command multiple times)
newman run collection.json --folder "Auth" && \
newman run collection.json --folder "Users"
# Useful for production smoke tests
newman run collection.json \
-e environments/prod.json \
--folder "Smoke Tests" \
--folder "Health Checks"# Skip SSL certificate verification (for self-signed certs in dev/staging)
newman run collection.json -k
# Or the long form
newman run collection.json --insecure
# Provide client certificates for mutual TLS
newman run collection.json \
--ssl-client-cert client.pem \
--ssl-client-key client-key.pemOnly use -k (insecure) for development and staging with self-signed certificates. Never use it against production — it disables SSL validation, which means man-in-the-middle attacks would go undetected.
Sometimes you want Newman to run but NOT fail your pipeline — maybe you are running informational tests or collecting metrics. The --suppress-exit-code flag makes Newman always exit with 0, even if tests fail.
# Always exit with 0, even if tests fail
newman run collection.json --suppress-exit-code
# Useful for non-blocking informational runs
# The pipeline continues regardless of test resultsCombine flags for a production-grade command: newman run collection.json -e env.json --timeout 300000 --timeout-request 15000 --bail --delay-request 200 -r cli,junit --reporter-junit-export results.xml. This gives you timeouts, rate-limit safety, fast failure, and CI-compatible output.
Q: What advanced Newman options have you used? When would you use --bail?
A: Key options: --timeout-request to prevent hanging requests, --delay-request for rate-limited APIs, --bail to stop on first failure (critical when requests are chained — if login fails, do not run 50 dependent requests), --folder to run specific test suites (like smoke tests against production), and -k for self-signed SSL certs in dev. I use --bail in chained collections where later requests depend on earlier ones. Without it, Newman wastes time running requests that will definitely fail because a prerequisite step failed.
Key Point: Key flags: --timeout-request for slow APIs, --delay-request for rate limits, --bail for fast failure, --folder for running subsets, -k for self-signed certs.