How to delete Bamboo projects and plans in bulk using REST API

Platform Notice: Data Center Only - This article only applies to Atlassian products on the Data Center platform.

Note that this KB was created for the Data Center version of the product. Data Center KBs for non-Data-Center-specific features may also work for Server versions of the product, however they have not been tested. Support for Server* products ended on February 15th 2024. If you are running a Server product, you can visit the Atlassian Server end of support announcement to review your migration options.

*Except Fisheye and Crucible

Summary

The steps outlined on this article are provided AS-IS. This means we've had reports of them working for some customers — under certain circumstances — yet are not officially supported, nor can we guarantee they'll work for your specific scenario.

You may follow through and validate them on your own non-prod environments prior to production or fall back to supported alternatives if they don't work out.

We also invite you to reach out to our Community for matters that fall beyond Atlassian's scope of support!

This article outlines the process to delete Bamboo projects and plans in bulk using REST API.

Environment

This has been tested on Bamboo 8.0.9 but likely works with other versions as well.

Solution

To delete the Projects in bulk via REST API we need to execute the API call in a script. You can put the Project_Key is a file say PROJECT_KEY, then read the file line by line and call the API against each line:

Script to delete projects in bulk using RESTAPI

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 #!/bin/bash input="/<PATH>/PROJECT_KEY.txt" username="admin" password="****" ###################################### # Script to remove projects(empty ones) in bulk # ##################################### while read -r line do echo "$line" curl -k -u "$username:$password" -X DELETE --url https://<BAMBOO_URL>/bamboo/rest/api/latest/project/$line done < "$input" ******************** Example contents of the file PROJECT_KEY.txt cat PROJECT_KEY.txt PROJ1 PROJ2 PROJ3 PROJ4

The below script is to remove plans in bulk via REST API. PLAN_KEY file should have the list of the planKeys, e.g PROJ-PLAN:

Script to delete plans in bulk

1 2 3 4 5 6 7 8 9 10 11 12 13 14 15 16 17 18 19 20 21 22 23 24 #!/bin/bash input="/<PATH>/PROJ_KEY-PLAN_KEY.txt" username="admin" password="****" ###################################### # Script to remove plans in bulk # ##################################### while read -r line do echo "$line" curl -u "$username:$password" -X DELETE --url 'http://<BAMBOO_URL>/rest/api/latest/plan/$line' done < "$input" ******************** Example contents of the file PROJ_KEY-PLAN_KEY.txt cat PROJ_KEY-PLAN_KEY.txt PROJ1-PLAN1 PROJ2-PLAN2 PROJ3-PLAN3 PROJ4-PLAN4

⚠️ Please make sure you have a backup in place before you run the REST API to delete, this might be required in case of rollback.

⚠️ Kindly make sure to test these REST APIs in a test environment before running them in production to eliminate any risk.

Updated on April 24, 2025

Still need help?

The Atlassian Community is here for you.