# Resolve an incident

Automatically resolve Uptime incidents from Jira by using our [Incidents API](https://betterstack.com/docs/uptime/api/getting-started-with-uptime-api/) and [Jira Automation](https://www.atlassian.com/software/jira/guides/expand-jira/automation ";_blank").

[warning]
## Custom fields required in Jira
This integration requires the custom field `incident_id`. For details, see the [Create an incident in Uptime from Jira](https://betterstack.com/docs/uptime/jira/better-uptime/create/) guide.
[/warning]

## Setting up the Jira automation rule

1. In your Jira project, go to **Project Settings** → **Automation**.
[info]
To apply this to all your projects, go to **Global administration** and create a global rule.
[/info]
2. Click on **Create rule**.
3. Select the **Issue transitioned** trigger.
4. For **To status**, enter `Done`, then click **Save**.
    ![ACK Trigger.png](https://imagedelivery.net/xZXo0QFi-1_4Zimer-T0XQ/ffde7bfa-ce88-47ef-3d59-f125a12ccd00/md2x =576x212)
    ![Resolve Trigger.png](https://imagedelivery.net/xZXo0QFi-1_4Zimer-T0XQ/b6abee68-343e-4553-fb2f-efc25194a200/orig =633x304)
5. Add an `IF` condition. Choose the `incident_id` field and set the condition to `is not empty`.
6. Add a `THEN` action and select **Send web request**.
    ![ACK Action.png](https://imagedelivery.net/xZXo0QFi-1_4Zimer-T0XQ/20f3da1a-9dcf-4c58-69ff-f7760dd22800/md2x =605x210)
7. Configure the web request:
      
    **Web request URL**: `https://uptime.betterstack.com/api/v2/incidents/{{incident_id}}/resolve`  
    **Headers**: `Authorization: Bearer $TOKEN`  
    **HTTP method**: `POST`  
    **Web request body**: `Custom data`  
    **Custom data**: `{"resolved_by": "{{updated}} - {{changelog.status}}"}`  
[note]
### Don't have an API token yet?
See our guide on [obtaining an API token](https://betterstack.com/docs/uptime/api/getting-started-with-uptime-api/).
[/note]
    ![Resolve Action Detail.png](https://imagedelivery.net/xZXo0QFi-1_4Zimer-T0XQ/7ab051bb-ad5f-4bde-6b5a-f4cd102d7000/lg2x =665x851)
8. (Optional) Add another `THEN` action to **Comment on issue**. You can use `{{webResponse.body}}` to add the API's response to the ticket.
    ![Resolve Comment.png](https://imagedelivery.net/xZXo0QFi-1_4Zimer-T0XQ/d2acc099-075f-4657-ff9e-71f8435c0c00/md1x =624x392)

[success]
## That's all. 🎉
From now on, when a Jira issue is moved to "Done", the corresponding Uptime incident will be resolved.
[/success]

[info]
### Need help with the Jira integration?
Please message us at **hello@betterstack.com**. We will help you with all the necessary configurations.
[/info]
