The following guide explains:

- How to set up a Jira app & configure it
- Connect Jira with Apideck
- Subscribe to Jira webhooks

## Create a Jira app & connect via Apideck

### Sign up for Jira

Go to the Atlassian website and [Sign up - Try Atlassian Cloud | Atlassian](https://www.atlassian.com/try/cloud/signup) to get a free account (no credit card required.)

Fill out the sign-up form with your details and click "Agree". You should receive a verification email. 

### Log in to Jira

After you have signed up with Jira, you can log in to Jira to create an "Application".

You can do this by visiting the Atlassian Developer Center (https://developer.atlassian.com/) and clicking on "Log in" in the top right corner.
Enter your login credentials and click on the "Continue" button.

### Register a Jira OAuth app

![jira developers console](https://res.cloudinary.com/apideck/image/upload/v1677667975/docs/connectors/jira/jira-developers-console.png)

After you are logged in, go to the "[Developer Console](https://developer.atlassian.com/console/myapps/)" page from the menu under your avatar in the right top part of the screen.

You can create a new OAuth app by clicking on the "Create" button within the "My Apps" section.

Select the "OAuth 2.0 integration" for creating a new application

![jira apps overview](https://res.cloudinary.com/apideck/image/upload/v1677664315/docs/connectors/jira/jira-apps-overview.png)

This will take you to a form where you can enter the required information about your app:

![jira app create](https://res.cloudinary.com/apideck/image/upload/v1677664315/docs/connectors/jira/jira-app-create.png)

- **Name**: Enter a meaningful name (for example, 'Apideck integration'). Consumers see this name when they authorise the connection to their Jira account.

Tick "I agree to be bound by Atlassian's developer terms". The "Create" button stays disabled until you do.

Press "Create" to go ahead and create the app.

### Configure your Jira OAuth app

After creating your app, you'll need to configure it by setting up various settings and permissions. 


![jira app overview](https://res.cloudinary.com/apideck/image/upload/v1677666599/docs/connectors/jira/jira-app-overview.png)This includes setting up OAuth 2.0 authentication, and configuring your app's terms & conditions, branding and icons.

#### Configure OAuth permissions

The next step is to configure the OAuth 2.0 permissions.

From the side menu, navigate to "Permissions".

![jira app permissions](https://res.cloudinary.com/apideck/image/upload/v1677666876/docs/connectors/jira/jira-app-permissions.png)

#### Jira API permissions

From the overview of Permissions, click on the "Add" button for Jira API to configure the permissions.

![jira app manage permissions](https://res.cloudinary.com/apideck/image/upload/v1677667142/docs/connectors/jira/jira-app-manage-permissions.png)

For the Issue tracking, we recommend setting the following Jira API permissions:

- View Jira issue data - `read:jira-work`
  Read Jira project and issue data, search for issues, and objects associated with issues like attachments and worklogs.

- Manage project settings - `manage:jira-project`
  Create and edit project settings and create new project-level objects (e.g. versions and components).

- Manage Jira global settings - `manage:jira-configuration`
  Take Jira administration actions (e.g. create projects and custom fields, view workflows, manage issue link types).

- View user profiles - `read:jira-user`
  View user information in Jira that the user has access to, including usernames, email addresses, and avatars.

- Create and manage issues - `write:jira-work`
  Create and edit issues in Jira, post comments as the user, create worklogs, and delete issues.

- Manage Jira webhooks - `manage:jira-webhook`
  
  Register and manage Jira webhooks.

- Manage development - `manage:jira-data-provider`
  Manage development and release information for third parties in Jira.


#### Configure authorization

To manage the authorization, go to "Authorization" in the side menu.

![jira app authorisation overview](https://res.cloudinary.com/apideck/image/upload/v1677667590/docs/connectors/jira/jira-app-authorisation-overview.png)

Click on the "Add" button, to set the callback URI for the OAuth app.

![jira app authorisation callback](https://res.cloudinary.com/apideck/image/upload/v1677667638/docs/connectors/jira/jira-app-authorisation-callback.png)

**Callback URL**: The URL where the consumer is returned after granting your app access to their Jira account. This should be `https://unify.apideck.com/vault/callback`.

Press "Save changes". An unsaved callback URL does not fail here: it fails much later, as a redirect error the first time a consumer tries to authorise.



#### Authentication details & app settings

To grab the authentication details, go to "Settings" in the side menu.
After you have defined the authorisation, the Client ID & Secret will be automatically generated.

![jira app settings client id secret](https://res.cloudinary.com/apideck/image/upload/v1677668766/docs/connectors/jira/jira-app-settings-client-id-secret.png)

**💡 TIP**: Copy the "Client ID" and the "Secret". You will need them in the next step. There is no need to generate anything: both values already exist on this screen. Only rotate the secret if it has been exposed, and be aware that rotating it stops any Apideck configuration still holding the old one.


The app setting allows you to configure the name, avatar and description + the Authentication details.

![jira app settings](https://res.cloudinary.com/apideck/image/upload/v1677666741/docs/connectors/jira/jira-app-settings.png)

#### Share the app: turn on Distribution

A new OAuth 2.0 integration is private. Until you switch Distribution on, you are the only person who can install and use it, so a consumer's authorisation will not work yet. Open your app in the [Developer Console](https://developer.atlassian.com/console/myapps/), go to **Distribution** and enable sharing.

Atlassian installs OAuth 2.0 (3LO) apps for each user individually, so there is no single site-wide install that an administrator performs once for everyone. Outside Apideck that means the app owner sends each person an Atlassian authorisation link. Here you do not: Vault builds the Atlassian link itself when a consumer starts the Jira connection, so all you ever send them is a Vault link, if anything.

#### Atlassian's app review

Distribution is all you need for consumers to authorise the app, and the integration works from that point on. Two things change once Atlassian has also reviewed it:

- Until the review, everyone who authorises the app is shown a notice that it has not yet been reviewed by Atlassian. The review is what removes that notice.
- Atlassian gives your app one hourly request quota that every connected Jira site draws from together. The review is the route to a larger allowance for an app with sustained heavy use. Atlassian's [rate limiting](https://developer.atlassian.com/cloud/jira/platform/rate-limiting/) page describes how the quota is counted.

A full Marketplace listing is not required to ask for a review. Atlassian's [managing OAuth 2.0 apps](https://developer.atlassian.com/cloud/oauth/getting-started/managing-oauth-apps/) page links the steps for submitting an integration.

### Vault Connection Setup

Now that you have your Jira app credentials, you can enable the integration so that a Jira site can be connected securely.

To try the integration without touching real project data, sign up for a second free Jira Cloud site and authorise against that one.

Go to the Apideck Dashboard > Configuration > Issue Tracking > [Jira](https://platform.apideck.com/configuration/issue-tracking/jira) 

![apideck configure](https://res.cloudinary.com/apideck/image/upload/v1677668425/docs/connectors/jira/apideck-configure.png)

Under Credentials, choose **Use your client credentials**. The Client ID and Client secret fields appear only under that option; the alternative, **Use Apideck credentials**, connects through Apideck's own OAuth app and is there for trying the connector out before you register your own.

Enter the Client ID and Secret you copied from the app's Settings page in Jira, then check the Scopes panel against the scopes you granted in Jira. Several scopes are unticked by default and some are hidden behind "Show more", so open the full list rather than trusting what is visible.

Press "Save settings" to save your credentials.

You can test the connection by clicking "Test Vault", which will check if the connection is working.

🚀 Now you are ready, and consumers can authorise the connection to their Jira account in a secure way.

### Do your first Jira API call via the Issue Tracking API

- Connect your Jira account through [Vault](https://platform.apideck.com/vault) with a test session.

- To test the access token, make a query to get your [`Collections`](https://developers.apideck.com/apis/issue-tracking/reference#operation/collectionsAll) endpoint using the [Issue Tracking API](https://developers.apideck.com/apis/issue-tracking/reference).

```
curl \
  --request GET \
  --url 'https://unify.apideck.com/issue-tracking/collections' \
  --header 'Authorization: Bearer {APIDECK_API_KEY}' \
  --header 'x-apideck-app-id: {APIDECK_APP_ID}' \
  --header 'x-apideck-consumer-id: test-consumer' \
  --header 'x-apideck-service-id: jira'
```


## Jira Webhook Registration

### Webhook subscription in Jira

Apideck registers the webhook subscription with Jira for each connection, and renews it on a schedule, so the subscription keeps delivering without anything for you to maintain.

**💡 IMPORTANT**: `manage:jira-webhook` has to be granted on both sides or registration fails silently. Add "Manage Jira webhooks - `manage:jira-webhook`" to the app in Atlassian's developer console (see [Configure OAuth permissions](#configure-oauth-permissions)), and tick it again in the Scopes panel of the Apideck configuration, where it is one of the entries hidden behind "Show more".

### Subscribe to Unify events

After you have completed the above steps, you can subscribe to your application to Unify Events.

![apideck webhook subscribe](https://res.cloudinary.com/apideck/image/upload/v1677669647/docs/connectors/jira/apideck-webhook-subscribe.png)

The following guide will explain all the steps to subscribe to Unify webhooks events: [How to subscribe to webhook events](https://developers.apideck.com/guides/webhooks#how-to-subscribe-to-webhook-events)