rq.execution namespace gives your scripts control over how a request runs: where it sits in your collection, whether to skip it, which request the collection runner goes to next, and how to run another saved request on demand.
rq.execution.location
A read-only array describing where the current request sits. The array lists the path from the top of your collection down to the request itself:[collection, ...folders, request]. The last element is always the request’s own name.
rq.execution.location.current returns the name of the current request (the last element of the array).
Available in both pre-request and post-response scripts.
Example:
The full folder path is available when a request runs inside a collection (for example during a collection run). In some contexts the array contains only the request name. Always check
rq.execution.location.length before reading a specific level.rq.execution.skipRequest()
Skips the current request. Call it from a pre-request script to stop the request from being sent. Everything after theskipRequest() call in that pre-request script is also skipped.
Use it to conditionally bypass a request, for example when a required variable is missing.
Parameters: none.
Example:
rq.execution.setNextRequest(nameOrNull)
Tells the collection runner which request to run next. This only has an effect during a collection run; it is ignored when you send a single request on its own. Parameters:nameOrNull(string or null): The name of the request to run next, ornullto stop the run.
- Jump to a request: pass the name of another request in the run. The runner continues from that request.
- Repeat the current request: pass the current request’s own name to run it again. (Requestly guards against an endless loop.)
- Stop the run: pass
nullto end the current run. If the run uses a data file, the current iteration ends and the next data row still runs.
If you name a request that is not part of the current run, the run stops and reports an error. Use the exact request name as it appears in your collection.
rq.execution.runRequest(id, opts?)
Runs another saved request from inside your script and returns its response. Use it to reuse a saved login request, fetch a dependency, or chain a saved call without leaving the current request. Parameters:id(string, required): The target request’s ID. This is the request’s saved ID, not its name. See Getting a request ID.opts(object, optional):{ variables }, wherevariablesis an object of name/value pairs applied to the request being run. Use it to override variables for that run only.
Promise that resolves to a response object with the same shape as rq.sendRequest: code, status, headers, responseTime, json(), and text().
Example:
Getting a request ID
runRequest needs the saved ID of the request you want to run, not its name. There are two ways to get it.
Copy it from the UI:
- Open the request you want to run.
- In the request header, next to Get client code, select Copy request ID.
- Paste the copied ID into your
runRequestcall.
rq.info.requestId:
rq.info.requestId returns the saved ID of the request the script is running in. This is the same ID that runRequest accepts, so you can capture it in one request and run that request from another. Store it in a variable that outlives the script, such as a global or collection variable.
runRequest is run-scoped: during a collection run, the request you run must be part of that same run. Make sure both requests run in the same collection run, or run the target request on its own.Things to know
- The returned response is read-only data. Variables that the other request sets do not flow back into your current script. Read what you need from the returned response and set your own variables.
- Run-scoped during a collection run. When used inside a collection run, the request you run must be part of that same run.
- No nesting. A request started with
runRequestcannot itself callrunRequest. - Up to 10
runRequestcalls per script. - An HTTP error status such as
404or500is not treated as a failure. Inspectres.code.

