The Adaptavist Group LogoDocumentation

Script Console

Run and test Groovy scripts interactively, query Jira data, make bulk changes, and experiment with the API from a single interface.

Cloud icon

Migrating to Jira Cloud? This feature is available in Cloud.

Cloud Script Console documentation

Script Console overview

The Script Console is the place for running one-off ad hoc scripts, and for learning and experimenting with the Jira REST API and HAPI.

Enter your script in the Script field, or select the File tab and type the path to a .groovy file the server can access. Relative paths are resolved from your script roots.

Using the Script Console

You can use the Script Console to:

  • Run a script to display information.
  • Run a one-off cleanup task.
  • Bulk update issues, projects, users, and versions.

For example, if you need to remove a list of users who've left the company, a script can delete them all in one action instead of you finding and deleting each one.

You can also make bulk changes to issues returned by a Jira Query Language (JQL) query. For example, find bugs with linked support cases and no watchers, then add each support case's reporter as a watcher.

Download Script Console output

After you run a script, you can save what it produced to a file. Downloads cover the most recent run only. Select Download next to Run, then select one of the following:

  • Result: the full output the script returned, unchanged. Not available if the script throws an exception or returns nothing.
  • Logs: the content of the Logs tab, as a .log file. Available even if the script fails. Only the last 300 lines are kept.
  • Run Details: a .json file with the output, logs, any error, timing, the Jira version, and when the script ran. It never includes your script's code.

The result uses the file extension that matches its content: .json for valid JSON, .xml for output that starts with an XML declaration, .html for output that contains HTML, and .txt for anything else.

Tip: To get a .json file, return JsonOutput.toJson(...) from your script. Groovy maps and lists returned directly are usually saved as .txt.

Files are named after the script file, or script-console-output for scripts entered in the Script field, followed by the date and time the script ran. For example, my-script-20261124-143005.json.

CAUTION: Downloaded HTML files aren't sanitized, so any JavaScript in the output runs when you open the file in a browser. Only open HTML output from scripts you trust.

Before you start

Hat icon

See our Introduction to Scripting in ScriptRunner course to learn about using Groovy to write new scripts, and modify existing scripts in ScriptRunner.

Scripting Training

Book icon

Broaden your horizons by exploring Script Console script examples.

Example Scripts

Remote script execution

You can also run scripts in the Script Console remotely, though URL encoding makes this a bit finicky. For example, to run this code from a file called script.groovy:

log.debug ("hello")
log.debug ("sailor")

Use the following curl command:

curl -u admin:admin -X POST "http://<jira>/jira/rest/scriptrunner/latest/user/exec/" -H "X-Atlassian-token: no-check" -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" -H "Accept: application/json" --data-urlencode "scriptText@script.groovy"

To run a file that already exists under a script root:

curl -u admin:admin -X POST "http://<jira>/jira/rest/scriptrunner/latest/user/exec/" -H "X-Atlassian-token: no-check" -H "Content-Type: application/x-www-form-urlencoded; charset=UTF-8" -H "Accept: application/json" --data-urlencode "scriptFile=foo/bar.groovy"

Search documentation

Start typing to search the docs.