Showing results for 
Search instead for 
Did you mean: 
Sign up Log in
It's not the same without you

Join the community to find out what other Atlassian users are discussing, debating and creating.

Atlassian Community Hero Image Collage

Delete projects automatically in JIRA

Hi ,

How to delete projects in jira automatically based on conditions like projects belonging to category A or project created before 2 years. The script or trigger should automatically check for condition and delete the projects without any manual intervention.

How to achieve this?



2 answers

1 vote

Technically, you can't do this.  Jira does not record when a project is created, so you have no date to work with.

That just means you need a different rule.  I'd base a rule on looking for the earliest created issue (which is an approximation for "project created") and maybe also check "last updated" or "last created" issue for a sanity check on if the project is still actively used.

Then, yes, use one of the automation apps to code a script to do this.  You'll need Scriptrunner or Powerscripts (I'm not sure this can do it, but I don't want to look like I'm selling SR as the only option)

Be warned though, you must think about backups before trying anything like this.  Deleted projects are gone, completely, and there's no way to get them back other than from a backup, so one error, and you could destroy something you need.

I'd also look at housekeeping - deleting a project destroys the header and all the issues in it, but leaves all the config behind.  You might want to look at something that kills off unused schemes (and fields) after a project deletion as well.

I want to delete the projects that are archived  before 2 yrs. The script/listerener should delete those projects ? is this possible?



0 votes
DPK J Community Leader Jul 31, 2019

You can do that using CRON jobs and Jira's rest API.

  1. Just make a curl request to fetch all projects
  2. Find those that match your criteria
  3. Make a curl request to delete them one by one.

This fetch all project in JSON format

curl --request GET \
  --url '/rest/api/3/project' \
  --header 'Authorization: Bearer ' \
  --header 'Accept: application/json'


This deletes project,

curl --request DELETE \
  --url '/rest/api/3/project/{projectIdOrKey}' \
  --header 'Authorization: Bearer ' 

Does this REST API call delete project and its configurations (workflows, if not shared), screen(if no shared) etc. or it is just a doing what we do in the front-end - Deleting project's data and Nothing else.

Suggest an answer

Log in or Sign up to answer

Community Events

Connect with like-minded Atlassian users at free events near you!

Find an event

Connect with like-minded Atlassian users at free events near you!

Unfortunately there are no Community Events near you at the moment.

Host an event

You're one step closer to meeting fellow Atlassian users at your local event. Learn more about Community Events

Events near you