- Pre-request scripts run before a request is sent. Use them to set variables, build a signature, fetch a token, or skip the request.
- Post-response scripts run after the response arrives. Use them to validate the response, extract values, and write tests.
rq object. This reference documents every part of it.
The rq object
rq is the entry point for reading request and response data, managing variables, sending requests, and writing tests. The cards below link to the reference page for each part.
rq.request
Read and modify the request: method, URL, headers, body, query parameters.
rq.response
Read the response: status, headers, body, and parsed JSON.
rq.sendRequest
Send an HTTP request from a script and read its response.
rq.execution
Skip a request, control collection-run order, and run another saved request.
rq.environment
Read and write environment variables.
rq.collectionVariables
Read and write variables scoped to a collection.
rq.globals
Read and write variables available everywhere.
rq.vault
Read secrets stored securely in your vault.
rq.test
Define tests that pass or fail based on the response.
rq.expect
Write assertions inside your tests.
rq.iterationData
Read the current row of data during a collection run.
rq.info
Read information about the current execution.
Script execution modes
Requestly runs your scripts in one of two modes. You pick the mode per request from the mode menu in the Scripts editor toolbar, next to the pre-request and post-response toggle.Safe Mode
Safe Mode is the default. Scripts run in an isolated sandbox with no access to your system. This is the right choice for almost every script: reading and writing variables, building requests, sending requests withrq.sendRequest, and writing tests all work in Safe Mode.
For security, Safe Mode does not allow a script to:
- load a package that needs a native add-on,
- read or write your file system, or
- use asymmetric cryptography such as RS256, ES, or PS (use HS256 instead).
Package 'some-package' cannot be used in Safe mode.

