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

# Convert a Service's Event Rules into Event Orchestration Rules

`POST https://api.pagerduty.com/services/{id}/rules/convert`

Convert this Service's Event Rules into functionally equivalent Event Orchestration Rules.

Sending a request to this API endpoint has several effects:

1. Automatically creates Event Orchestration Rules for this Service that will behave identically as this Service's currently configured Event Rules.
2. Makes all existing Event Rules for this Service read-only. All future updates need to be made via the newly created Event Orchestration rules.

Sending a request to this API endpoint will **not** change how future events will be processed. If past events for this Service have been evaluated via Event Rules then new events sent to this Service will also continue to be evaluated via the (now read-only) Event Rules. To change this Service so that new events start being evaluated via the newly created Event Orchestration Rules use the [Update the Service Orchestration active status for a Service API](https://docs.pagerduty.com/developer/api/reference/rest/event-orchestrations/update-orch-active-status).

> ### End-of-life
> Event Rules will end-of-life soon. We highly recommend that you use this API to [migrate to Event Orchestration](https://support.pagerduty.com/docs/migrate-to-event-orchestration) as soon as possible so you can take advantage of the new functionality, such as improved UI, rule creation, APIs and Terraform support, advanced conditions, and rule nesting.

Scoped OAuth requires: `services.write`

## Authorization

- **api_key** (apiKey) — `Authorization` header. The API Key with format `Token token=<API_KEY>`

## Path parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `id` | string | yes | The ID of the resource. |

## Header parameters

| Name | Type | Required | Description |
|---|---|---|---|
| `Accept` | string | yes | The `Accept` header is used as a versioning header. Default: `application/vnd.pagerduty+json;version=2`. |

## Response 200

The Event Orchestration Rules were successfully created

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `convert_status` | string |  | Did PagerDuty successfully create equivalent Event Orchestration rules. Read-only. |
| `converted_to` | string (url) |  | the API URL at which the newly created Event Orchestration rules are accessible. Read-only. |

Example: Response Example

```json
{
  "convert_status": "completed",
  "converted_to": "https://api.pagerduty.com/event_orchestrations/service/PC2D9ML"
}
```

## Response 400

Could not create equivalent Event Orchestration Rules based on the Service's current Event Rules

### `application/json`

| Field | Type | Required | Description |
|---|---|---|---|
| `error` | object |  | Read-only. |
| `error.message` | string |  | Error message string. Read-only. |
| `error.errors` | array of object |  | Read-only. |
| `error.errors[].rule_id` | string |  | The ID of the Service Event Rule that couldn't be successfully converted. Read-only. |
| `error.errors[].position` | integer |  | The position of the Service Event Rule that couldn't be successfully converted. Read-only. |
| `error.errors[].messages` | array of string |  | Human friendly explanations of why this Event Rule couldn't be converted into an equivalent Event Orchestration Rule. Read-only. |

Example: Response Example

```json
{
  "error": {
    "message": "Unable to convert given Ruleset to an Event Orchestration",
    "errors": [
      {
        "rule_id": "693cdcd1-ecfd-4064-a834-5cb28a74c060",
        "position": 0,
        "messages": [
          "Unable to convert a rule that has a `time_frame` with both `active_between` and `scheduled_weekly` settings."
        ]
      },
      {
        "rule_id": "9f6896c0-b435-401f-b25f-62e145d9ccf4",
        "position": 5,
        "messages": [
          "Unable to convert `actions.extractions`; Should have a most 25 extractions but this rule has 42 extractions."
        ]
      }
    ]
  }
}
```

## Response 401

Caller did not supply credentials or did not provide the correct credentials.
If you are using an API key, it may be invalid or your Authorization header may be malformed.

### `application/json`

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

## Response 403

Caller is not authorized to view the requested resource.
While your 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 |  | Read-only. |
| `error.message` | string |  | Error message string. Read-only. |
| `error.errors` | array of string |  | Read-only. |

## Response 404

The requested resource was not found.

### `application/json`

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

## Response 405

The request was received and recognized by the server, but its HTTP method was rejected for the requested resource.

### `application/json`

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

## Response 409

The request conflicts with the current state of the server.

### `application/json`

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

## 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).
