---
title: "Close package when all versions are closed"
canonical: "https://help.releasemanagement.app/space/RM4J/3092612353/Close%20package%20when%20all%20versions%20are%20closed"
format: markdown
---
> Macro (include)

# Topics

> Macro (toc)

# Disclaimer

> ⚠️ This functionality should be archived by delegating business logic to 3rd party system that should check conditions and execute calls to the Release management API

# Step 1: Obtain Token

Go to [https://releasemanagement.atlassian.net/wiki/spaces/RM4J/pages/1081347#How-I-can-get-a-Token-to-access-API?](https://releasemanagement.atlassian.net/wiki/spaces/RM4J/pages/1081347#How-I-can-get-a-Token-to-access-API?) section to learn how to generate token and [https://releasemanagement.atlassian.net/wiki/spaces/RM4J/pages/1081347#How-to-execute-calls-to-our-APIs?](https://releasemanagement.atlassian.net/wiki/spaces/RM4J/pages/1081347#How-to-execute-calls-to-our-APIs?) section to learn how to make calls to our Rest API.

> ℹ️ Find out more about personalized tokens here [https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html](https://confluence.atlassian.com/enterprise/using-personal-access-tokens-1026032365.html).

# Step 2:  Find out some properties you would need (e.g. destination ColumnID)

If you want to move version into certain column upon issues status update you would need to know **destination column id**. You would need to use our [https://releasemanagement.atlassian.net/wiki/spaces/RM4J/pages/1081347](https://releasemanagement.atlassian.net/wiki/spaces/RM4J/pages/1081347) to get it.

Please copy board ID:

![image](media://f5af3593-696b-489d-8fea-ef1fd138635f)

.. and click on API icon:

![image](media://9e3cc163-cb65-443b-a7a4-cbae19add7c7)

Find board by ID endpoint:

![image](media://6f325247-3cac-4257-bffd-9029ffe21ec7)

Past BoardID copied above and execute it.

In response you will get a collection of columns and versions associated with it.

Please find the column you need and copy ColumnID for versions:

![image](media://ed0b24ea-14fb-470f-aa43-c22bb64f83ff)

and for packages:

![image-20241206-103918.png](media://b41b5b60-e714-4d35-a055-15399d90fbad)

# Step 3: Create Jira automation to trigger 3rd party system that will execute the logic

For this step, an external processor should process incoming webhooks and make a set of API calls to release management, as Jira automation is not powerful enough to cover that need.

The processor should be chosen and configured to accept Jira version ID

![image-20241206-104130.png](media://cead7532-e161-41ab-b425-501c769020f7)


![image-20241206-104408.png](media://a922b9e5-9ef5-4684-9ffd-3517c3c723d0)

After that, the processor would need to execute the following actions with token from the [Step 1](https://releasemanagement.atlassian.net/wiki/spaces/RM4J/pages/3092612353#Step-1%3A-Obtain-Token)

**Get all packages for the version **

Get version details to collect all packages from the version:

![image-20241206-104952.png](media://384b3f23-fcc0-41f1-9103-a2ebb990c7c7)

![image-20241206-105055.png](media://feeb6ead-cba7-432e-8d70-b233007bacef)

> 📝 Please NOTE that the version could belong to multiple packages


Get package details for each package from the previous step:

![image-20241206-105319.png](media://dd7aa70f-accd-49af-a067-c60a7b064bc8)

Get IDs of all versions in the package

![image-20241206-105855.png](media://c3c44baa-d25e-47ee-bab1-7a17d6f85e8b)

Check if all the versions are in needed status by using the previous endpoint 

![image-20241206-110056.png](media://e1f8d2b6-d88a-4f2b-b98d-27c63737c559)

If all versions in the needed status, execute a call for moving package to needed destination status:

**URL:  <**https://your_jira_url/rest/release-management/1.0/release/PACKAGE_ID/move>

**Method:** <PUT>

**Request Body:** 

`{"columnId":<destination_column_id>,"afterReleaseId":null}`

> 📝 Replace <destination_column_id> to package columns ID where the package should be moved

> Macro (include)