# Update link

`PATCH /v2/environments/{environmentId}/alertLinks/{alertLinkId}`

Available as MCP tool `update-link-v2` (Replace).

Alert endpoints allow you to review or manage traffic alert rules, which monitor your integrations for healthy traffic. [Learn about alert rules](https://docs.redoxengine.com/permalink/RqjicoYocYtUDfFmaaoSt/#monitor-data-exchange-health) or [manage alert rules in the Redox dashboard](https://docs.redoxengine.com/permalink/39Lf3qtqeHmCZkFaKf5jKz).

There are different types of traffic alert rules: 

<details>
<summary>No traffic alert rule</summary>

A <u>No traffic</u> alert rule monitors whether traffic is flowing appropriately in a given subscription. 

With this type of alert rule, you receive a notification when no logs reach a terminal state (i.e., `Succeeded`, `Filtered`, `Failed`) during a given time period (i.e., as little as 30 minutes up to 72 hours). 

This type of alert isn’t meant for tracking errors since failed logs count as completed traffic. 

> **Pending logs not included**
>
> This doesn’t include pending logs since they aren’t in a terminal state.

</details>

<details>
<summary>Low traffic alert rule</summary>

A <u>Low traffic</u> alert rule monitors whether traffic is flowing as anticipated in a given subscription. 

With this type of alert rule, you receive a notification if less than X number of logs reach a terminal state (i.e., `Succeeded`, `Filtered`, `Failed`) within a specified time (i.e., as little as 30 minutes up to 72 hours).

This type of alert rule is one step more preemptive than a <u>no traffic</u> alert type since it can help you catch an unexpected dip in traffic before reaching no traffic at all. However, it still isn’t meant for tracking errors since failed logs count as completed traffic. 

> **Pending logs not included**
>
> This doesn’t include pending logs since they aren’t in a terminal state.

</details>

<details>
<summary>Error threshold alert rules</summary>

An <u>Error Threshold</u> alert rule monitors the number of errors in a given subscription. 

With this type of alert rule, you receive a notification if X number of logs reach a terminal state of `Failed` and will no longer be retried within a specified time (i.e., as little as 15 minutes up to 24 hours).

</details>

<details>
<summary>Retry threshold alert rule</summary>

A <u>Retry threshold</u> alert rule monitors the number of retries for any log in a given subscription. 

With this type of alert rule, you receive a notification if one or more logs has been retried more than X number of times within 15 minutes (this is a static lookback time).

For example, if you configure an alert rule with a retry threshold of 10, the alert rule triggers if one or more logs have reached at least 10 retries within the last 15 minutes. These logs might continue retrying, but the alert rule doesn’t clear until all logs for the linked subscription reach a terminal state or have fewer than 10 retries within 15 minutes. 

> **What’s not included**
>
> A <u>Retry threshold</u> alert doesn’t measure the cumulative number of retries for all logs combined, nor does it measure the number of individual logs that are retrying.

</details>

You can retrieve an alert rule, as well as create, update, or delete it. Alternatively, you can retrieve a list of alert rules. An alert rule response contains details about any related subscription links.  

You can also retrieve a subscription link for an alert rule, as well as create, pause, or delete it.

 

### Update link

Update an existing link for an alert rule within a Redox organization. You must use the correct ID to update the settings.

> **Only for engineer or support roles**
>
> Any user in an environment may view either your organization’s traffic alert rules. However, you must be assigned to an engineer or a support role to manage alert rules. [Learn about roles](/basics/managing-access-for-your-redox-organization/what-are-user-roles-and-groups).
>
> Alert rules aren’t available for free Redox accounts, so they won’t be visible in the dashboard or available via API. You must upgrade your Redox account to use alert rules.

## Request parameters

| Name | In | Type | Required | Description |
| --- | --- | --- | --- | --- |
| `environmentId` | path | string | Yes | Identifies the specific environment that you're operating in or on behalf of. |
| `alertLinkId` | path | string | Yes | Contains the unique identifier of the alert link. |

## Request body

Contains the fields that you can populate when updating an existing alert link.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `assignment` | object | No | Specifies the alert this link is assigned to. |
| `assignment.id` | string | No | Contains the unique identifier of the alert. |
| `assignment.kind` | string | No | Identifies what kind of link is assigned. Value: alert |
| `subscription` | object | No | The subscription to assign to the alert link. |
| `subscription.id` | number | No | Contains the unique identifier of subscription. |
| `status` | any | No | Indicates whether to activate or pause the alert link. If "active", the related alert rule will be monitored, so alerts and notifications may be triggered. If "paused", the alert rule won't be monitored, so no alerts or notifications will be triggered. Possible values: active, paused |

## Request example

_Generated from the schema: the values are placeholders, not a real payload._

```bash
curl 'https://api.redoxengine.com/platform/v2/environments/{environmentId}/alertLinks/{alertLinkId}' \
--request PATCH \
--header 'Authorization: Bearer $API_TOKEN' \
--header 'accept: application/json' \
--header 'Content-Type: application/json' \
--data '{
  "assignment": {
    "id": "1ee1d994-652f-44b5-9342-4b3e8b9918ee",
    "kind": "alert"
  },
  "subscription": {
    "id": "8675309"
  },
  "status": "active"
}'
```

## Responses

### 200

Contains a payload object with the successfully updated link.

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `meta` | object | No |  |
| `meta.version` | string | No | Lists the major and minor version number for the format of the returned payload. The payload format or shape may change between minor versions, like including additional or extended fields in later versions. We include the version data in each response so that you have the option to handle the signaled differences. |
| `payload` | object | No |  |
| `payload.alertLink` | object | No | Contains an alert link and its related details. |
| `payload.alertLink.id` | string (uuid) | No | Displays the unique identifier of the link for a specified alert. |
| `payload.alertLink.assignment` | object | No | Specifies the alert this link is assigned to. |
| `payload.alertLink.assignment.id` | string | No | Contains the unique identifier of the alert. |
| `payload.alertLink.assignment.kind` | string | No | Identifies what kind of link is assigned. Value: alert |
| `payload.alertLink.subscription` | object | No | Identifies the subscription that the alert is linked to. |
| `payload.alertLink.subscription.id` | number | No | Contains the unique identifier of subscription. |
| `payload.alertLink.subscription.dataModel` | string | No | Identifies the Redox data model that the link applies to. |
| `payload.alertLink.subscription.source` | object | No | Specifies the source of the subscription that the alert is linked to. |
| `payload.alertLink.subscription.source.id` | string | No | Contains the unique identifier of the source. |
| `payload.alertLink.subscription.source.name` | string, nullable | No | Displays the human-readable name of the source. |
| `payload.alertLink.subscription.destination` | object | No | Specifies the destination of the subscription that the alert is linked to. |
| `payload.alertLink.subscription.destination.id` | string | No | Contains the unique identifier of the destination. |
| `payload.alertLink.subscription.destination.name` | string, nullable | No | Displays the human-readable name of the destination. |
| `payload.alertLink.subscription.serviceRegion` | string | No | Identifies the region that the subscription is operating in. Possible values: AWS_USA_EAST_1, AWS_CAN_CENTRAL, GCP_USA_CENTRAL_1 |
| `payload.alertLink.connectingOrganization` | object | No | Specifies the organization the asset is connected to when the subscription relates to a partner organization. |
| `payload.alertLink.connectingOrganization.id` | number | No | Contains the unique identifier of the Redox organization. |
| `payload.alertLink.connectingOrganization.name` | string, nullable | No | Contains the human-readable name of the Redox organization. |
| `payload.alertLink.latestStatus` | object | No | Contains the code and timestamp for the current status of the alert for this link. |
| `payload.alertLink.latestStatus.code` | string | No | Describes the current status of the alert. Possible values: triggered, okay, paused, unknown |
| `payload.alertLink.latestStatus.timestamp` | string | No | Contains date and time for the current status update. |
| `payload.alertLink.environment` | object | No | Contains metadata about the environment within the associated Redox organization. |
| `payload.alertLink.environment.id` | string (uuid) | No | Contains the unique identifier of the Redox environment. |
| `payload.alertLink.createdAt` | string | No | Displays the date and time that the asset was originally created in ISO 8601 format. |
| `payload.alertLink.createdBy` | object | No | Contains the metadata about the user who created the asset. |
| `payload.alertLink.createdBy.id` | number | No | Contains the unique identifier of the user. |
| `payload.alertLink.createdBy.name` | string, nullable | No | Displays the user's full name. |
| `payload.alertLink.createdBy.email` | string, nullable | No | Displays the user's email address. |
| `payload.alertLink.updatedAt` | string | No | Displays the date and time that the asset was last updated in ISO 8601 format. |
| `payload.alertLink.updatedBy` | object | No | Contains the metadata about the user who last updated the asset. |
| `payload.alertLink.updatedBy.id` | number | No | Contains the unique identifier of the user. |
| `payload.alertLink.updatedBy.name` | string, nullable | No | Displays the user's full name. |
| `payload.alertLink.updatedBy.email` | string, nullable | No | Displays the user's email address. |

_Generated from the schema: the values are placeholders, not a real payload._

```json
{
  "meta": {
    "version": "1.0.0"
  },
  "payload": {
    "alertLink": {
      "id": "dc5d2a43-df19-459c-b14f-450584ce1c55",
      "assignment": {
        "id": "1ee1d994-652f-44b5-9342-4b3e8b9918ee",
        "kind": "alert"
      },
      "subscription": {
        "id": "8675309",
        "dataModel": "PatientAdmin",
        "source": {
          "id": "1ee1d994-652f-44b5-9342-4b3e8b9918ee",
          "name": "string"
        },
        "destination": {
          "id": "39a858ea-4474-4d04-b37e-88862fe4054d",
          "name": "string"
        },
        "serviceRegion": "AWS_USA_EAST_1"
      },
      "connectingOrganization": {
        "id": 122,
        "name": "string"
      },
      "latestStatus": {
        "code": "triggered",
        "timestamp": "2024-04-28T19:17:16.719Z"
      },
      "environment": {
        "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08"
      },
      "createdAt": "2024-04-25T18:17:16.719Z",
      "createdBy": {
        "id": 0,
        "name": "string",
        "email": "string"
      },
      "updatedAt": "2024-04-25T18:17:16.719Z",
      "updatedBy": {
        "id": 0,
        "name": "string",
        "email": "string"
      }
    }
  }
}
```

### 400

Bad Request

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `payload` | object | No | Contains the error message. |
| `payload.error` | object | No | Contains the error message details. |
| `payload.error.id` | string | No | Contains a unique identifier for the given error instance. |
| `payload.error.title` | string | No | Displays the high-level error message, typically something succinct like `Bad Request`. |
| `payload.error.code` | string | No | Contains an alternative ID for the error type, which can be used to find relevant troubleshooting information. |
| `payload.error.detail` | string | No | Contains the specific error details for this message. |
| `payload.error.status` | number | No | Displays the corresponding HTTP status code for the error. |
| `payload.error.transient` | boolean | No | Describes whether the error will resolve itself. If `true`, no further action needs to be taken. If `false`, you may need to troubleshoot on your end to resolve the issue before the error can be processed. |

```json
{
  "payload": {
    "error": {
      "title": "Bad Request",
      "code": "validation.error.bad.request",
      "detail": "Error details",
      "status": 400,
      "transient": false
    }
  }
}
```

### 403

Forbidden

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `payload` | object | No | Contains the error message. |
| `payload.errors` | Array of object | No |  |
| `payload.errors[].title` | string | No | Displays the high-level error message, typically something succinct like `Forbidden`. |
| `payload.errors[].code` | string | No | Contains an alternative ID for the error type, which can be used to find relevant troubleshooting information. |

```json
{
  "payload": {
    "errors": [
      {
        "title": "Forbidden",
        "code": "authorization.forbidden"
      }
    ]
  }
}
```

### 500

Internal Server Error

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `payload` | object | No | Contains the error message. |
| `payload.error` | object | No | Contains the error message details. |
| `payload.error.title` | string | No | Displays the high-level error message, typically something succinct like `Failed in step X`. |
| `payload.error.code` | string | No | Contains an alternative ID for the error type, which can be used to find relevant troubleshooting information. |
| `payload.error.detail` | string | No | Contains the specific error details for this message. |
| `payload.error.status` | number | No | Displays the corresponding HTTP status code for the error. |
| `payload.error.transient` | boolean | No | Describes whether the error will resolve itself. If `true`, no further action needs to be taken. If `false`, you may need to troubleshoot on your end to resolve the issue before the error can be processed. |

```json
{
  "payload": {
    "error": {
      "title": "Internal Server Error",
      "code": "failed.db.lookup",
      "detail": "Error details",
      "status": 500,
      "transient": true
    }
  }
}
```
