> Documentation index for AI agents: https://docs.pagerduty.com/llms.txt

# Update a rule

`PUT https://api.pagerduty.com/integration-jira-cloud/accounts_mappings/{id}/rules/{rule_id}`

Update an existing rule.

A Rule configures the bidirectional synchronization between Jira issues and PagerDuty incidents.

Scoped OAuth requires: `jira_cloud_rules.write`

## Authorization

- **apiKey** (apiKey) — `Authorization` header.
- **bearerAuth** (http) — HTTP bearer.

## Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string (PagerDuty Id) | yes | The ID of the account mapping. Pattern: `^(P[0-9A-Z]{6}\|Q[0-9A-Z]{13})$`. |
| `rule_id` | string (PagerDuty Id) | yes | The ID of the account rule. Pattern: `^(P[0-9A-Z]{6}\|Q[0-9A-Z]{13})$`. |

## Request body (`application/json`) — required

The rule to be updated.

| Field | Type | Required | Description |
|---|---|---|---|
| `config` | object | yes | Configuration for bidirectional synchronization between Jira issues and PagerDuty incidents. |
| `config.jira` | object | yes | Synchronization settings. |
| `config.jira.autocreate_jql` | string \| null | yes | JQL query to automatically create PagerDuty incidents when matching Jira issues are created. Leave empty to disable this feature. |
| `config.jira.create_issue_on_incident_trigger` | boolean | yes | When enabled, automatically creates a Jira issue whenever a PagerDuty incident is triggered. Default: `false`. |
| `config.jira.custom_fields` | array \| null | yes | Defines how Jira fields are populated when a Jira Issue is created from a PagerDuty Incident. |
| `config.jira.issue_type` | object | yes | Specifies the Jira issue type to be created or synchronized with PagerDuty incidents. |
| `config.jira.issue_type.id` | string | yes | Unique identifier for the Jira issue type. |
| `config.jira.issue_type.name` | string | yes |  |
| `config.jira.priorities` | array \| null | yes | Maps PagerDuty incident priorities to Jira issue priorities for synchronization. |
| `config.jira.status_mapping` | object | yes | Maps PagerDuty incident statuses to corresponding Jira issue statuses for synchronization. |
| `config.jira.status_mapping.acknowledged` | object \| null |  | Optional Jira status that maps to the PagerDuty `acknowledged` status. |
| `config.jira.status_mapping.acknowledged.id` | string | yes | Unique identifier for the Jira status. |
| `config.jira.status_mapping.acknowledged.name` | string | yes |  |
| `config.jira.status_mapping.resolved` | object \| null |  | Optional Jira status that maps to the PagerDuty `resolved` status. |
| `config.jira.status_mapping.resolved.id` | string | yes | Unique identifier for the Jira status. |
| `config.jira.status_mapping.resolved.name` | string | yes |  |
| `config.jira.status_mapping.triggered` | object | yes | Jira status that maps to the PagerDuty `triggered` status. |
| `config.jira.status_mapping.triggered.id` | string | yes | Unique identifier for the Jira status. |
| `config.jira.status_mapping.triggered.name` | string | yes |  |
| `config.jira.sync_notes_user` | object \| null | yes | PagerDuty user for syncing notes and comments between Jira issues and PagerDuty incidents. If not provided, note synchronization is disabled. |
| `config.jira.sync_notes_user.id` | string (PagerDuty Id) | yes | Unique identifier. Pattern: `^(P[0-9A-Z]{6}\|Q[0-9A-Z]{13})$`. |
| `config.jira.sync_notes_user.type` | string | yes | One of: `user_reference`. |
| `enabled` | boolean \| null |  | Indicates if the rule is enabled. |
| `name` | string | yes | The name of the rule. Max length: 100. Pattern: `^[^\x00-\x1F\x7F<>]+$`. |

Example: Request Example

```json
{
  "config": {
    "jira": {
      "autocreate_jql": "priority in (Highest, High)",
      "create_issue_on_incident_trigger": false,
      "custom_fields": [
        {
          "source_incident_field": "incident_description",
          "target_issue_field": "description",
          "target_issue_field_name": "Description",
          "type": "attribute"
        },
        {
          "source_incident_field": "incident_number",
          "target_issue_field": "customfield_10001",
          "target_issue_field_name": "PagerDuty Incident Number",
          "type": "attribute"
        },
        {
          "target_issue_field": "security",
          "target_issue_field_name": "Security Level",
          "type": "jira_value",
          "value": {
            "displayName": "Sec Level 1",
            "id": "10000"
          }
        }
      ],
      "issue_type": {
        "id": "10001",
        "name": "Incident"
      },
      "priorities": [
        {
          "jira_id": "1",
          "pagerduty_id": "PUS0KTE"
        },
        {
          "jira_id": "2",
          "pagerduty_id": "PQFCJER"
        },
        {
          "jira_id": "3",
          "pagerduty_id": "PN6RJ21"
        }
      ],
      "status_mapping": {
        "acknowledged": {
          "id": "2",
          "name": "In Progress"
        },
        "resolved": {
          "id": "3",
          "name": "Resolved"
        },
        "triggered": {
          "id": "1",
          "name": "Open"
        }
      },
      "sync_notes_user": {
        "id": "PBAZLIU",
        "type": "user_reference"
      }
    }
  },
  "name": "Critical IT Incidents",
  "enabled": true
}
```

## Response 200

The rule that was updated.

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `account_mapping` | object | yes | Account mapping to which the rule belongs. |
| `account_mapping.id` | string (PagerDuty Id) | yes | Unique identifier. Pattern: `^(P[0-9A-Z]{6}\|Q[0-9A-Z]{13})$`. |
| `account_mapping.self` | string | yes | The API URL at which the object is accessible. |
| `account_mapping.type` | string | yes | One of: `account_mapping_reference`. |
| `autocreate_jql_disabled_reason` | string \| null |  | If auto-creation using JQL is disabled, this field provides the reason for the disablement. |
| `autocreate_jql_disabled_until` | string \| null |  | The timestamp until which the auto-creation using JQL feature is disabled. |
| `config` | object | yes | Configuration for bidirectional synchronization between Jira issues and PagerDuty incidents. |
| `config.jira` | object | yes | Synchronization settings. |
| `config.jira.autocreate_jql` | string \| null |  | JQL query to automatically create PagerDuty incidents when matching Jira issues are created. Leave empty to disable this feature. |
| `config.jira.create_issue_on_incident_trigger` | boolean | yes | When enabled, automatically creates a Jira issue whenever a PagerDuty incident is triggered. Default: `false`. |
| `config.jira.custom_fields` | array \| null |  | Defines how Jira fields are populated when a Jira Issue is created from a PagerDuty Incident. |
| `config.jira.issue_type` | object | yes | Jira issue type to be created or synchronized with PagerDuty incidents. |
| `config.jira.issue_type.id` | string | yes | Unique identifier for the Jira issue type. |
| `config.jira.issue_type.name` | string | yes |  |
| `config.jira.priorities` | array \| null |  | Maps PagerDuty incident priorities to Jira issue priorities for synchronization. |
| `config.jira.project` | object | yes | Jira project where issues will be created or synchronized. |
| `config.jira.project.id` | string | yes | Unique identifier for the Jira project. |
| `config.jira.project.key` | string | yes | Unique identifier key for the Jira project. |
| `config.jira.project.name` | string | yes |  |
| `config.jira.status_mapping` | object | yes | Maps PagerDuty incident statuses to corresponding Jira issue statuses for synchronization. |
| `config.jira.status_mapping.acknowledged` | object \| null |  | Optional Jira status that maps to the PagerDuty `acknowledged` status. |
| `config.jira.status_mapping.acknowledged.id` | string \| null |  | Unique identifier for the Jira status. |
| `config.jira.status_mapping.acknowledged.name` | string \| null |  |  |
| `config.jira.status_mapping.resolved` | object \| null |  | Optional Jira status that maps to the PagerDuty `resolved` status. |
| `config.jira.status_mapping.resolved.id` | string \| null |  | Unique identifier for the Jira status. |
| `config.jira.status_mapping.resolved.name` | string \| null |  |  |
| `config.jira.status_mapping.triggered` | object | yes | Jira status that maps to the PagerDuty `triggered` status. |
| `config.jira.status_mapping.triggered.id` | string | yes | Unique identifier for the Jira status. |
| `config.jira.status_mapping.triggered.name` | string | yes |  |
| `config.jira.sync_notes_user` | object \| null |  | PagerDuty user for syncing notes and comments between Jira issues and PagerDuty incidents. If not provided, note synchronization is disabled. |
| `config.jira.sync_notes_user.email` | string | yes |  |
| `config.jira.sync_notes_user.html_url` | string \| null |  | The URL at which the user is uniquely displayed in the PagerDuty web app. |
| `config.jira.sync_notes_user.id` | string (PagerDuty Id) | yes | Unique identifier. Pattern: `^(P[0-9A-Z]{6}\|Q[0-9A-Z]{13})$`. |
| `config.jira.sync_notes_user.name` | string | yes |  |
| `config.jira.sync_notes_user.self` | string |  | The API URL at which the object is accessible. |
| `config.jira.sync_notes_user.type` | string | yes | One of: `user_reference`. |
| `config.service` | object | yes | The PagerDuty service associated with this rule. |
| `config.service.html_url` | string \| null |  | The URL at which the service is uniquely displayed in the PagerDuty web app. |
| `config.service.id` | string (PagerDuty Id) | yes | Unique identifier. Pattern: `^(P[0-9A-Z]{6}\|Q[0-9A-Z]{13})$`. |
| `config.service.self` | string |  | The API URL at which the object is accessible. |
| `config.service.summary` | string | yes | The name or summary of the PagerDuty service. |
| `config.service.type` | string | yes | One of: `service_reference`. |
| `created_at` | string | yes | The time when the rule was created. |
| `enabled` | boolean |  | Indicates if the rule is enabled. |
| `id` | string (PagerDuty Id) | yes | Unique identifier. Pattern: `^(P[0-9A-Z]{6}\|Q[0-9A-Z]{13})$`. |
| `name` | string | yes | The name of the rule. Max length: 100. Pattern: `^[^\x00-\x1F\x7F<>]+$`. |
| `updated_at` | string \| null |  | The time when the rule was last modified. |

Example: Response Example

```json
{
  "account_mapping": {
    "id": "PIJ90N7",
    "self": "https://api.pagerduty.com/integration-jira-cloud/account_mappings/PIJ90N7",
    "type": "accounts_mapping_reference"
  },
  "config": {
    "jira": {
      "autocreate_jql": "priority in (Highest, High)",
      "create_issue_on_incident_trigger": false,
      "custom_fields": [
        {
          "source_incident_field": "incident_description",
          "target_issue_field": "description",
          "target_issue_field_name": "Description",
          "type": "attribute"
        },
        {
          "source_incident_field": "incident_number",
          "target_issue_field": "customfield_10001",
          "target_issue_field_name": "PagerDuty Incident Number",
          "type": "attribute"
        },
        {
          "target_issue_field": "security",
          "target_issue_field_name": "Security Level",
          "type": "jira_value",
          "value": {
            "displayName": "Sec Level 1",
            "id": "10000"
          }
        }
      ],
      "issue_type": {
        "id": "10001",
        "name": "Incident"
      },
      "priorities": [
        {
          "jira_id": "1",
          "pagerduty_id": "PUS0KTE"
        },
        {
          "jira_id": "2",
          "pagerduty_id": "PQFCJER"
        },
        {
          "jira_id": "3",
          "pagerduty_id": "PN6RJ21"
        }
      ],
      "project": {
        "id": "10100",
        "key": "ITS",
        "name": "IT Support"
      },
      "status_mapping": {
        "acknowledged": {
          "id": "2",
          "name": "In Progress"
        },
        "resolved": {
          "id": "3",
          "name": "Resolved"
        },
        "triggered": {
          "id": "1",
          "name": "Open"
        }
      },
      "sync_notes_user": {
        "email": "e.greenholt@example.com",
        "html_url": "https://subdomain.pagerduty.com/users/PBAZLIU",
        "id": "PBAZLIU",
        "name": "Earline Greenholt",
        "self": "https://api.pagerduty.com/users/PBAZLIU",
        "type": "user_reference"
      },
      "version": 1
    },
    "service": {
      "html_url": "https://api.pagerduty.com/services/PY1OL64",
      "id": "PY1OL64",
      "self": "https://api.pagerduty.com/services/PY1OL64",
      "summary": "Main Web Application",
      "type": "service_reference"
    }
  },
  "created_at": "2023-09-01T12:00:00.000Z",
  "id": "PF9KMXH",
  "name": "Critical IT Incidents",
  "enabled": true,
  "updated_at": "2023-09-01T12:00:00.000Z"
}
```

## Response 400

Caller provided invalid arguments.

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | object |  |  |
| `error.code` | integer |  | Error code. |
| `error.errors` | array of string |  | Error details. |
| `error.message` | string |  | Error message. |

Example: Response Example

```json
{
  "error": {
    "code": 2001,
    "errors": [
      "Invalid value for field 'name'"
    ],
    "message": "Invalid Input Provided"
  }
}
```

## Response 401

Caller did not supply credentials or did not provide the correct credentials.

## Response 403

Caller is not authorized to manage the requested resource. While the authentication is valid,
the authenticated user or token does not have permission to perform this action.

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | object |  |  |
| `error.code` | integer |  | Error code. |
| `error.errors` | array of string |  | Error details. |
| `error.message` | string |  | Error message. |

Example: Response Example

```json
{
  "error": {
    "errors": [],
    "message": "Forbidden"
  }
}
```

## Response 429

Too many requests have been made, the rate limit has been reached.

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | object |  |  |
| `error.code` | integer |  | Error code. |
| `error.errors` | array of string |  | Error details. |
| `error.message` | string |  | Error message. |

Example: Response Example

```json
{
  "error": {
    "code": 2020,
    "message": "Rate Limit Exceeded"
  }
}
```

## Response 500

Internal server error.

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | object |  |  |
| `error.code` | integer |  | Error code. |
| `error.errors` | array of string |  | Error details. |
| `error.message` | string |  | Error message. |

Example: Response Example

```json
{
  "error": {
    "errors": [],
    "message": "Internal server error"
  }
}
```

## Developer Agreement

Your access to and use of the PagerDuty Developer Services is governed by the [PagerDuty Developer Agreement](https://docs.pagerduty.com/developer/pagerduty-developer-agreement).
