{
  "openapi": "3.0.3",
  "info": {
    "title": "REST API documentation",
    "version": "v1",
    "description": ""
  },
  "servers": [
    {
      "url": "https://cloud.kaaiot.com/re/api/v1",
      "description": "API Server"
    }
  ],
  "paths": {
    "/rules": {
      "post": {
        "description": "Creates a new rule.",
        "responses": {
          "201": {
            "description": "Rule is successfully created.",
            "headers": {
              "Location": {
                "description": "URI in format `{schema}://{host}/re/api/v1/rules/{ruleId}`",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:rule:create"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertRuleRequest"
              }
            }
          }
        }
      },
      "get": {
        "description": "Retrieves rules.",
        "responses": {
          "200": {
            "description": "Rules are successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RulesResponse"
                },
                "example": {
                  "content": [
                    {
                      "id": "47e17fc5-060c-4923-b315-d17f6a1bf8d6",
                      "name": "Low battery",
                      "description": "Checks if sensor has low battery",
                      "expression": "return ctx.endpoint.getMetadata().battery.status == 'low'",
                      "state": "ENABLED",
                      "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                      "espEnabled": false,
                      "statistics": {
                        "minDuration": 12,
                        "maxDuration": 12,
                        "avgDuration": 12,
                        "lastDuration": 12,
                        "count": 1
                      },
                      "createdAt": "2023-06-30T12:30:54.540Z",
                      "updatedAt": "2023-06-30T12:30:54.541Z"
                    }
                  ],
                  "totalElements": 1
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule:read"
            ]
          }
        ]
      }
    },
    "/rules/{ruleId}": {
      "parameters": [
        {
          "name": "ruleId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Rule ID"
        }
      ],
      "get": {
        "description": "Retrieves a specific rule.",
        "responses": {
          "200": {
            "description": "Rule is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "id": "47e17fc5-060c-4923-b315-d17f6a1bf8d6",
                  "name": "Low battery",
                  "description": "Checks if sensor has low battery",
                  "expression": "return ctx.endpoint.getMetadata().battery.status == 'low'",
                  "state": "ENABLED",
                  "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                  "espEnabled": false,
                  "statistics": {
                    "minDuration": 12,
                    "maxDuration": 12,
                    "avgDuration": 12,
                    "lastDuration": 12,
                    "count": 1
                  },
                  "createdAt": "2023-06-30T12:30:54.540Z",
                  "updatedAt": "2023-06-30T12:30:54.541Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule:read"
            ]
          }
        ]
      },
      "put": {
        "description": "Updates a rule.",
        "responses": {
          "204": {
            "description": "Rule is successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "Low battery",
                "description": "Checks if sensor has low battery",
                "expression": "return ctx.endpoint.getMetadata().battery.status == 'low'",
                "state": "ENABLED",
                "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                "espEnabled": false
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes rule.",
        "responses": {
          "204": {
            "description": "Rule is successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule:delete"
            ]
          }
        ]
      }
    },
    "/rules/{ruleId}/execute": {
      "parameters": [
        {
          "name": "ruleId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Rule ID"
        }
      ],
      "post": {
        "description": "Executes the rule.",
        "responses": {
          "200": {
            "description": "Rule is successfully executed.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/OnDemandRuleExecutionResponse"
                },
                "example": {
                  "returnedValue": "\"Hello from rule\"",
                  "traces": [
                    {
                      "id": "aa54a074-6c87-46cf-a4a1-fbec44dd4ac8",
                      "traceId": "da7c72c6-d914-4ab8-ac45-e7f6fb6a2c15",
                      "entityType": "COMMAND_INVOCATION_ACTION",
                      "entityId": "74",
                      "outcome": "FAILURE",
                      "stage": "ENDPOINT_ID_EXPRESSION_EVALUATION",
                      "reason": "TypeError: Cannot read property 'getChildren' of undefined",
                      "metadata": {
                        "endpointIdExpression": "return ctx.endpoin.getChildren().length"
                      }
                    },
                    {
                      "id": "ea279e04-3f0d-49f5-a3c5-fc46acfbd675",
                      "traceId": "da7c72c6-d914-4ab8-ac45-e7f6fb6a2c15",
                      "entityType": "DATA_SAMPLE_ACTION",
                      "entityId": "91",
                      "outcome": "SUCCESS"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule:execute"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {},
              "example": {
                "myKey": "myValue"
              }
            }
          }
        }
      }
    },
    "/rules/{ruleId}/actions": {
      "parameters": [
        {
          "name": "ruleId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Rule ID"
        }
      ],
      "get": {
        "description": "Retrieves actions attached to rule.",
        "responses": {
          "200": {
            "description": "Actions attached to the rule are successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AttachedActions"
                },
                "example": {
                  "positiveActions": [
                    {
                      "id": "1",
                      "name": "Switch light",
                      "type": "command-invocation"
                    }
                  ],
                  "negativeActions": [
                    {
                      "id": "2",
                      "name": "Turn on water pump",
                      "type": "command-invocation"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule:read"
            ]
          }
        ]
      }
    },
    "/rules/{ruleId}/triggers": {
      "parameters": [
        {
          "name": "ruleId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Rule ID"
        }
      ],
      "get": {
        "description": "Retrieves triggers attached to rule.",
        "responses": {
          "200": {
            "description": "Triggers attached to the rule are successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": [
                  {
                    "id": "1",
                    "name": "Simple trigger",
                    "type": "cron"
                  }
                ]
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule:read"
            ]
          }
        ]
      }
    },
    "/rules/{ruleId}/action-types/command-invocation/actions": {
      "parameters": [
        {
          "name": "ruleId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Rule ID"
        }
      ],
      "put": {
        "description": "Updates attached command invocation actions.",
        "responses": {
          "204": {
            "description": "Attached to rule command invocation actions are successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule:update",
              "command-invocation-action:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AttachedActionsRequest"
              },
              "example": {
                "positiveActions": [
                  "1",
                  "2"
                ],
                "negativeActions": [
                  "3",
                  "4"
                ]
              }
            }
          }
        }
      }
    },
    "/rules/{ruleId}/action-types/metadata-update/actions": {
      "parameters": [
        {
          "name": "ruleId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Rule ID"
        }
      ],
      "put": {
        "description": "Updates attached metadata update actions.",
        "responses": {
          "204": {
            "description": "Attached to rule metadata update actions are successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule:update",
              "metadata-update-action:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "positiveActions": [
                  "1",
                  "2"
                ],
                "negativeActions": [
                  "3",
                  "4"
                ]
              }
            }
          }
        }
      }
    },
    "/rules/{ruleId}/action-types/webhook/actions": {
      "parameters": [
        {
          "name": "ruleId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Rule ID"
        }
      ],
      "put": {
        "description": "Updates attached webhook actions.",
        "responses": {
          "204": {
            "description": "Attached to rule webhook actions are successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule:update",
              "webhook-action:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "positiveActions": [
                  "1",
                  "2"
                ],
                "negativeActions": [
                  "3",
                  "4"
                ]
              }
            }
          }
        }
      }
    },
    "/rules/{ruleId}/action-types/rule-execution/actions": {
      "parameters": [
        {
          "name": "ruleId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Rule ID"
        }
      ],
      "put": {
        "description": "Updates attached rule execution actions.",
        "responses": {
          "204": {
            "description": "Attached rule execution actions are successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule:update",
              "rule-execution-action:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "positiveActions": [
                  "1",
                  "2"
                ],
                "negativeActions": [
                  "3",
                  "4"
                ]
              }
            }
          }
        }
      }
    },
    "/rules/{ruleId}/action-types/data-sample/actions": {
      "parameters": [
        {
          "name": "ruleId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Rule ID"
        }
      ],
      "put": {
        "description": "Updates attached data sample actions.",
        "responses": {
          "204": {
            "description": "Attached data sample actions are successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule:update",
              "data-sample-action:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "positiveActions": [
                  "1",
                  "2"
                ],
                "negativeActions": [
                  "3",
                  "4"
                ]
              }
            }
          }
        }
      }
    },
    "/rules/{ruleId}/action-types/time-series/actions": {
      "parameters": [
        {
          "name": "ruleId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Rule ID"
        }
      ],
      "put": {
        "description": "Updates attached time series actions.",
        "responses": {
          "204": {
            "description": "Attached time series event actions are successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule:update",
              "time-series-action:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "positiveActions": [
                  "1",
                  "2"
                ],
                "negativeActions": [
                  "3",
                  "4"
                ]
              }
            }
          }
        }
      }
    },
    "/rules/{ruleId}/action-types/alert-activation/actions": {
      "parameters": [
        {
          "name": "ruleId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Rule ID"
        }
      ],
      "put": {
        "description": "Updates attached alert activation actions.",
        "responses": {
          "204": {
            "description": "Attached alert activation actions are successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule:update",
              "alert-activation-action:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "positiveActions": [
                  "1",
                  "2"
                ],
                "negativeActions": [
                  "3",
                  "4"
                ]
              }
            }
          }
        }
      }
    },
    "/rules/{ruleId}/action-types/alert-resolution/actions": {
      "parameters": [
        {
          "name": "ruleId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Rule ID"
        }
      ],
      "put": {
        "description": "Updates attached alert resolution actions.",
        "responses": {
          "204": {
            "description": "Attached alert resolution actions are successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule:update",
              "alert-resolution-action:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "positiveActions": [
                  "1",
                  "2"
                ],
                "negativeActions": [
                  "3",
                  "4"
                ]
              }
            }
          }
        }
      }
    },
    "/rules/{ruleId}/trigger-types/endpoint-metadata-updated/triggers": {
      "parameters": [
        {
          "name": "ruleId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Rule ID"
        }
      ],
      "put": {
        "description": "Updates attached 'endpoint metadata updated' triggers.",
        "responses": {
          "204": {
            "description": "Attached 'endpoint metadata updated' triggers are successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule:update",
              "endpoint-metadata-updated-trigger:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": [
                "1"
              ]
            }
          }
        }
      }
    },
    "/rules/{ruleId}/trigger-types/cron/triggers": {
      "parameters": [
        {
          "name": "ruleId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Rule ID"
        }
      ],
      "put": {
        "description": "Updates attached 'cron' triggers.",
        "responses": {
          "204": {
            "description": "Attached 'cron' triggers are successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule:update",
              "cron-trigger:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": [
                "1"
              ]
            }
          }
        }
      },
      "patch": {
        "description": "Patches attached 'cron' triggers.",
        "responses": {
          "200": {
            "description": "Attached 'cron' trigger IDs",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": [
                  "1"
                ]
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule:update",
              "cron-trigger:read"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/PatchTriggerRequest"
              },
              "example": {
                "add": [
                  "1",
                  "3"
                ],
                "remove": [
                  "5"
                ]
              }
            }
          }
        }
      }
    },
    "/rules/{ruleId}/trigger-types/endpoint-time-series-updated/triggers": {
      "parameters": [
        {
          "name": "ruleId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Rule ID"
        }
      ],
      "put": {
        "description": "Updates attached 'endpoint time series updated' triggers.",
        "responses": {
          "204": {
            "description": "Attached 'endpoint time series updated' triggers are successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule:update",
              "endpoint-time-series-updated-trigger:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": [
                "1"
              ]
            }
          }
        }
      }
    },
    "/action-types/command-invocation/actions": {
      "post": {
        "description": "Creates a new action.",
        "responses": {
          "201": {
            "description": "Action is successfully created.",
            "headers": {
              "Location": {
                "description": "URI in format `{schema}://{host}/re/api/v1/action-types/command-invocation/actions/{actionId}`",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:command-invocation-action:create"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertCommandActionRequest"
              },
              "example": {
                "name": "Switch light",
                "description": "Turns on/off light depending on the endpoint state",
                "endpointIdExpression": "return '65efe88c-6875-4aa6-a064-8c65f9f40514'",
                "commandType": "SWITCH_LIGHT",
                "commandPayloadExpression": "return {switch: ctx.endpoint.getMetadata().state === 'opened' ? 'on' : 'off'};",
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "get": {
        "description": "Retrieves actions.",
        "responses": {
          "200": {
            "description": "Actions are successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CommandActionsResponse"
                },
                "example": {
                  "content": [
                    {
                      "id": "1",
                      "name": "Switch light",
                      "description": "Turns on/off light depending on the endpoint state",
                      "endpointIdExpression": "return '65efe88c-6875-4aa6-a064-8c65f9f40514'",
                      "commandType": "SWITCH_LIGHT",
                      "commandPayloadExpression": "return {switch: ctx.endpoint.getMetadata().state === 'opened' ? 'on' : 'off'}",
                      "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                      "statistics": {
                        "minDuration": 12,
                        "maxDuration": 12,
                        "avgDuration": 12,
                        "lastDuration": 12,
                        "count": 1
                      },
                      "createdAt": "2023-06-30T12:30:54.540Z",
                      "updatedAt": "2023-06-30T12:30:54.541Z"
                    },
                    {
                      "id": "2",
                      "name": "Switch heater",
                      "description": "Turns on/off parent endpoint heater depending on the child endpoint state",
                      "endpointIdExpression": "return ctx.endpoint.getParent().getId()",
                      "commandType": "SWITCH_HEATER",
                      "commandPayloadExpression": "return {switch: ctx.endpoint.getMetadata().state === 'opened' ? 'on' : 'off'}",
                      "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                      "statistics": {
                        "minDuration": 12,
                        "maxDuration": 12,
                        "avgDuration": 12,
                        "lastDuration": 12,
                        "count": 1
                      },
                      "createdAt": "2023-06-30T12:30:54.540Z",
                      "updatedAt": "2023-06-30T12:30:54.541Z"
                    }
                  ],
                  "totalElements": 2
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "command-invocation-action:read"
            ]
          }
        ]
      }
    },
    "/action-types/command-invocation/actions/{actionId}": {
      "parameters": [
        {
          "name": "actionId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Action ID"
        }
      ],
      "get": {
        "description": "Retrieves action.",
        "responses": {
          "200": {
            "description": "Action is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "id": "1",
                  "name": "Switch light",
                  "description": "Turns on/off light depending on the endpoint state",
                  "endpointIdExpression": "return '65efe88c-6875-4aa6-a064-8c65f9f40514'",
                  "commandType": "SWITCH_LIGHT",
                  "commandPayloadExpression": "return {switch: ctx.endpoint.getMetadata().state === 'opened' ? 'on' : 'off'}",
                  "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                  "statistics": {
                    "minDuration": 12,
                    "maxDuration": 12,
                    "avgDuration": 12,
                    "lastDuration": 12,
                    "count": 1
                  },
                  "createdAt": "2023-06-30T12:30:54.540Z",
                  "updatedAt": "2023-06-30T12:30:54.541Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "command-invocation-action:read"
            ]
          }
        ]
      },
      "put": {
        "description": "Updates action.",
        "responses": {
          "204": {
            "description": "Action is successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "command-invocation-action:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "Switch light",
                "description": "Turns on/off light depending on the endpoint state",
                "endpointIdExpression": "return '65efe88c-6875-4aa6-a064-8c65f9f40514'",
                "commandType": "SWITCH_LIGHT",
                "commandPayloadExpression": "return {switch: ctx.endpoint.getMetadata().state === 'opened' ? 'on' : 'off'};",
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes action.",
        "responses": {
          "204": {
            "description": "Action is successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "command-invocation-action:delete"
            ]
          }
        ]
      }
    },
    "/action-types/metadata-update/actions": {
      "post": {
        "description": "Creates a new metadata update action.",
        "responses": {
          "201": {
            "description": "Action is successfully created.",
            "headers": {
              "Location": {
                "description": "URI in format `{schema}://{host}/re/api/v1/action-types/metadata-update/actions/{actionId}`",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:metadata-update-action:create"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertMetadataUpdateActionRequest"
              },
              "example": {
                "name": "Lighting state",
                "description": "Updates the parent endpoint lighting state depending on the child endpoint state",
                "endpointIdExpression": "return ctx.endpoint.getParent().getId()",
                "metadataKeyExpression": "return ctx.endpoint.getMetadata().device_type + '.status'",
                "metadataValueExpression": "return ctx.endpoint.getMetadata().state == 'opened' ? 'on' : 'off'",
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "get": {
        "description": "Retrieves actions.",
        "responses": {
          "200": {
            "description": "Actions are successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/MetadataUpdateActionsResponse"
                },
                "example": {
                  "content": [
                    {
                      "id": "2",
                      "name": "Lighting state",
                      "description": "Updates the parent endpoint lighting state depending on the child endpoint state",
                      "endpointIdExpression": "return ctx.endpoint.getParent().getId()",
                      "metadataKeyExpression": "return ctx.endpoint.getMetadata().device_type + '.status'",
                      "metadataValueExpression": "return ctx.endpoint.getMetadata().state == 'opened' ? 'on' : 'off'",
                      "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                      "statistics": {
                        "minDuration": 12,
                        "maxDuration": 12,
                        "avgDuration": 12,
                        "lastDuration": 12,
                        "count": 1
                      },
                      "createdAt": "2023-06-30T12:30:54.540Z",
                      "updatedAt": "2023-06-30T12:30:54.541Z"
                    }
                  ],
                  "totalElements": 1
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "metadata-update-action:read"
            ]
          }
        ]
      }
    },
    "/action-types/metadata-update/actions/{actionId}": {
      "parameters": [
        {
          "name": "actionId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Action ID"
        }
      ],
      "get": {
        "description": "Retrieves action.",
        "responses": {
          "200": {
            "description": "Action is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "id": "2",
                  "name": "Lighting state",
                  "description": "Updates the parent endpoint lighting state depending on the child endpoint state",
                  "endpointIdExpression": "return ctx.endpoint.getParent().getId()",
                  "metadataKeyExpression": "return ctx.endpoint.getMetadata().device_type + '.status'",
                  "metadataValueExpression": "return ctx.endpoint.getMetadata().state == 'opened' ? 'on' : 'off'",
                  "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                  "statistics": {
                    "minDuration": 12,
                    "maxDuration": 12,
                    "avgDuration": 12,
                    "lastDuration": 12,
                    "count": 1
                  },
                  "createdAt": "2023-06-30T12:30:54.540Z",
                  "updatedAt": "2023-06-30T12:30:54.541Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "metadata-update-action:read"
            ]
          }
        ]
      },
      "put": {
        "description": "Updates action.",
        "responses": {
          "204": {
            "description": "Action is successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "metadata-update-action:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "Lighting state",
                "description": "Updates the parent endpoint lighting state depending on the child endpoint state",
                "endpointIdExpression": "return ctx.endpoint.getParent().getId()",
                "metadataKeyExpression": "return ctx.endpoint.getMetadata().device_type + '.status'",
                "metadataValueExpression": "return ctx.endpoint.getMetadata().state == 'opened' ? 'on' : 'off'",
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes action.",
        "responses": {
          "204": {
            "description": "Action is successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "metadata-update-action:delete"
            ]
          }
        ]
      }
    },
    "/action-types/webhook/actions": {
      "post": {
        "description": "Creates a new action.",
        "responses": {
          "201": {
            "description": "Action is successfully created.",
            "headers": {
              "Location": {
                "description": "URI in format `{schema}://{host}/re/api/v1/action-types/webhook/actions/{actionId}`",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:webhook-action:create"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertWebhookActionRequest"
              },
              "example": {
                "name": "Water leakage email alert",
                "description": "Sends email alert with the endpoint water leakage state",
                "webhookUrl": "https://cloud.kaaiot.com/aa/api/v1/applications/cdhn26a09eau0udkrcj2/actions/email-notification/32/webhooks/cf8qn5ooq9sqgvjlajod",
                "headersExpression": "return {'X-Token':'mySecret'};",
                "webhookPayloadExpression": "return 'Water leakage state is ' + ctx.endpoint.getMetadata().state.waterLeakage",
                "retryConfig": {
                  "maxAttempts": 3,
                  "timeoutMs": 1000,
                  "backoffMultiplier": 2.0
                },
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "get": {
        "description": "Retrieves actions.",
        "responses": {
          "200": {
            "description": "Actions are successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/WebhookActionsResponse"
                },
                "example": {
                  "content": [
                    {
                      "id": "4",
                      "name": "Water leakage email alert",
                      "description": "Sends email alert with the endpoint water leakage state",
                      "webhookUrl": "https://cloud.kaaiot.com/aa/api/v1/applications/cdhn26a09eau0udkrcj2/actions/email-notification/32/webhooks/cf8qn5ooq9sqgvjlajod",
                      "headersExpression": "return {'X-Token':'mySecret'};",
                      "webhookPayloadExpression": "return 'Water leakage state is ' + ctx.endpoint.getMetadata().state.waterLeakage",
                      "retryConfig": {
                        "maxAttempts": 3,
                        "timeoutMs": 1000,
                        "backoffMultiplier": 2.0
                      },
                      "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                      "statistics": {
                        "minDuration": 12,
                        "maxDuration": 12,
                        "avgDuration": 12,
                        "lastDuration": 12,
                        "count": 1
                      },
                      "createdAt": "2023-06-30T12:30:54.540Z",
                      "updatedAt": "2023-06-30T12:30:54.541Z"
                    }
                  ],
                  "totalElements": 1
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "webhook-action:read"
            ]
          }
        ]
      }
    },
    "/action-types/webhook/actions/{actionId}": {
      "parameters": [
        {
          "name": "actionId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Action ID"
        }
      ],
      "get": {
        "description": "Retrieves action.",
        "responses": {
          "200": {
            "description": "Action is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "id": "4",
                  "name": "Water leakage email alert",
                  "description": "Sends email alert with the endpoint water leakage state",
                  "webhookUrl": "https://cloud.kaaiot.com/aa/api/v1/applications/cdhn26a09eau0udkrcj2/actions/email-notification/32/webhooks/cf8qn5ooq9sqgvjlajod",
                  "headersExpression": "return {'X-Token':'mySecret'};",
                  "webhookPayloadExpression": "return 'Water leakage state is ' + ctx.endpoint.getMetadata().state.waterLeakage",
                  "retryConfig": {
                    "maxAttempts": 3,
                    "timeoutMs": 1000,
                    "backoffMultiplier": 2.0
                  },
                  "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                  "statistics": {
                    "minDuration": 12,
                    "maxDuration": 12,
                    "avgDuration": 12,
                    "lastDuration": 12,
                    "count": 1
                  },
                  "createdAt": "2023-06-30T12:30:54.540Z",
                  "updatedAt": "2023-06-30T12:30:54.541Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "webhook-action:read"
            ]
          }
        ]
      },
      "put": {
        "description": "Updates action.",
        "responses": {
          "204": {
            "description": "Action is successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "webhook-action:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "Water leakage email alert",
                "description": "Sends email alert with the endpoint water leakage state",
                "webhookUrl": "https://cloud.kaaiot.com/aa/api/v1/applications/cdhn26a09eau0udkrcj2/actions/email-notification/32/webhooks/cf8qn5ooq9sqgvjlajod",
                "headersExpression": "return {'X-Token':'mySecret'};",
                "webhookPayloadExpression": "return 'Water leakage state is ' + ctx.endpoint.getMetadata().state.waterLeakage",
                "retryConfig": {
                  "maxAttempts": 3,
                  "timeoutMs": 1000,
                  "backoffMultiplier": 2.0
                },
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes action.",
        "responses": {
          "204": {
            "description": "Action is successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "webhook-action:delete"
            ]
          }
        ]
      }
    },
    "/action-types/rule-execution/actions": {
      "post": {
        "description": "Creates a new action.",
        "responses": {
          "201": {
            "description": "Action is successfully created.",
            "headers": {
              "Location": {
                "description": "URI in format `{schema}://{host}/re/api/v1/action-types/rule-execution/actions/{actionId}`",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:rule-execution-action:create",
              "rule:execute"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertRuleExecutionActionRequest"
              },
              "example": {
                "name": "Check lighting state",
                "description": "Runs the rule that checks lighting state",
                "ruleId": "f6fde168-bbff-4383-9912-b9e6c51b7a88",
                "executeAtExpression": "return new Date().getTime() + 60 * 1000",
                "endpointIdExpression": "return ctx.endpoint.getId();",
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "get": {
        "description": "Retrieves actions.",
        "responses": {
          "200": {
            "description": "Actions are successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuleExecutionActionsResponse"
                },
                "example": {
                  "content": [
                    {
                      "id": "3",
                      "name": "Check lighting state",
                      "description": "Runs the rule that checks lighting state",
                      "ruleId": "f6fde168-bbff-4383-9912-b9e6c51b7a88",
                      "executeAtExpression": "return new Date().getTime() + 60 * 1000",
                      "endpointIdExpression": "return ctx.endpoint.getId();",
                      "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                      "statistics": {
                        "minDuration": 12,
                        "maxDuration": 12,
                        "avgDuration": 12,
                        "lastDuration": 12,
                        "count": 1
                      },
                      "createdAt": "2023-06-30T12:30:54.540Z",
                      "updatedAt": "2023-06-30T12:30:54.541Z"
                    }
                  ],
                  "totalElements": 1
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule-execution-action:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "ruleId",
            "in": "query",
            "description": "Rule ID.",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "47e17fc5-060c-4923-b315-d17f6a1bf8d6"
          }
        ]
      }
    },
    "/action-types/rule-execution/actions/{actionId}": {
      "parameters": [
        {
          "name": "actionId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Action ID"
        }
      ],
      "get": {
        "description": "Retrieves action.",
        "responses": {
          "200": {
            "description": "Action is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "id": "3",
                  "name": "Check lighting state",
                  "description": "Runs the rule that checks lighting state",
                  "ruleId": "f6fde168-bbff-4383-9912-b9e6c51b7a88",
                  "executeAtExpression": "return new Date().getTime() + 60 * 1000",
                  "endpointIdExpression": "return ctx.endpoint.getId();",
                  "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                  "statistics": {
                    "minDuration": 12,
                    "maxDuration": 12,
                    "avgDuration": 12,
                    "lastDuration": 12,
                    "count": 1
                  },
                  "createdAt": "2023-06-30T12:30:54.540Z",
                  "updatedAt": "2023-06-30T12:30:54.541Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule-execution-action:read"
            ]
          }
        ]
      },
      "put": {
        "description": "Updates action.",
        "responses": {
          "204": {
            "description": "Action is successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule-execution-action:update",
              "rule:execute"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "Check lighting state",
                "description": "Runs the rule that checks lighting state",
                "ruleId": "f6fde168-bbff-4383-9912-b9e6c51b7a88",
                "executeAtExpression": "return new Date().getTime() + 60 * 1000",
                "endpointIdExpression": "return ctx.endpoint.getId();",
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes action.",
        "responses": {
          "204": {
            "description": "Action is successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule-execution-action:delete"
            ]
          }
        ]
      }
    },
    "/action-types/data-sample/actions": {
      "post": {
        "description": "Creates a new action.",
        "responses": {
          "201": {
            "description": "Action is successfully created.",
            "headers": {
              "Location": {
                "description": "URI in format `{schema}://{host}/re/api/v1/action-types/data-sample/actions/{actionId}`",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:data-sample-action:create"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertDataSampleActionRequest"
              },
              "example": {
                "name": "Temperature sensor",
                "description": "Publishes temperature data samples.",
                "endpointIdExpression": "return '65efe88c-6875-4aa6-a064-8c65f9f40514'",
                "dataSamplesExpression": "return [{temperature:23}];",
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "get": {
        "description": "Retrieves actions.",
        "responses": {
          "200": {
            "description": "Actions are successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DataSampleActionsResponse"
                },
                "example": {
                  "content": [
                    {
                      "id": "5",
                      "name": "Temperature sensor",
                      "description": "Publishes temperature data samples.",
                      "endpointIdExpression": "return '65efe88c-6875-4aa6-a064-8c65f9f40514'",
                      "dataSamplesExpression": "return [{temperature:23}];",
                      "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                      "statistics": {
                        "minDuration": 12,
                        "maxDuration": 12,
                        "avgDuration": 12,
                        "lastDuration": 12,
                        "count": 1
                      },
                      "createdAt": "2023-06-30T12:30:54.540Z",
                      "updatedAt": "2023-06-30T12:30:54.541Z"
                    }
                  ],
                  "totalElements": 2
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "data-sample-action:read"
            ]
          }
        ]
      }
    },
    "/action-types/data-sample/actions/{actionId}": {
      "parameters": [
        {
          "name": "actionId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Action ID"
        }
      ],
      "get": {
        "description": "Retrieves action.",
        "responses": {
          "200": {
            "description": "Action is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "id": "5",
                  "name": "Temperature sensor",
                  "description": "Publishes temperature data samples.",
                  "endpointIdExpression": "return '65efe88c-6875-4aa6-a064-8c65f9f40514'",
                  "dataSamplesExpression": "return [{temperature:23}]",
                  "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                  "statistics": {
                    "minDuration": 12,
                    "maxDuration": 12,
                    "avgDuration": 12,
                    "lastDuration": 12,
                    "count": 1
                  },
                  "createdAt": "2023-06-30T12:30:54.540Z",
                  "updatedAt": "2023-06-30T12:30:54.541Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "data-sample-action:read"
            ]
          }
        ]
      },
      "put": {
        "description": "Updates action.",
        "responses": {
          "204": {
            "description": "Action is successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "data-sample-action:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "Temperature sensor",
                "description": "Publishes temperature data samples.",
                "endpointIdExpression": "return '65efe88c-6875-4aa6-a064-8c65f9f40514'",
                "dataSamplesExpression": "return [{temperature:23}];",
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes action.",
        "responses": {
          "204": {
            "description": "Action is successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "data-sample-action:delete"
            ]
          }
        ]
      }
    },
    "/action-types/time-series/actions": {
      "post": {
        "description": "Creates a new action.",
        "responses": {
          "201": {
            "description": "Action is successfully created.",
            "headers": {
              "Location": {
                "description": "URI in format `{schema}://{host}/re/api/v1/action-types/time-series/actions/{actionId}`",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:time-series-action:create"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertTimeSeriesEventActionRequest"
              },
              "example": {
                "name": "Weather sensor",
                "description": "Publishes weather time series data",
                "endpointIdExpression": "return '65efe88c-6875-4aa6-a064-8c65f9f40514'",
                "timeSeriesNameExpression": "return 'time-series'",
                "timeSeriesExpression": "return [{temperature:10,humidity:63}]",
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "get": {
        "description": "Retrieves actions.",
        "responses": {
          "200": {
            "description": "Actions are successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TimeSeriesEventActionsResponse"
                },
                "example": {
                  "content": [
                    {
                      "id": "7",
                      "name": "Weather sensor",
                      "description": "Publishes weather time series data",
                      "endpointIdExpression": "return '65efe88c-6875-4aa6-a064-8c65f9f40514'",
                      "timeSeriesNameExpression": "return 'time-series'",
                      "timeSeriesExpression": "return [{temperature:10,humidity:63}]",
                      "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                      "statistics": {
                        "minDuration": 12,
                        "maxDuration": 12,
                        "avgDuration": 12,
                        "lastDuration": 12,
                        "count": 1
                      },
                      "createdAt": "2023-07-30T12:30:54.540Z",
                      "updatedAt": "2023-08-30T12:30:54.541Z"
                    }
                  ],
                  "totalElements": 1
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "time-series-action:read"
            ]
          }
        ]
      }
    },
    "/action-types/time-series/actions/{actionId}": {
      "parameters": [
        {
          "name": "actionId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Action ID"
        }
      ],
      "get": {
        "description": "Retrieves action.",
        "responses": {
          "200": {
            "description": "Action is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "id": "7",
                  "name": "Weather sensor",
                  "description": "Publishes weather time series data",
                  "endpointIdExpression": "return '65efe88c-6875-4aa6-a064-8c65f9f40514'",
                  "timeSeriesNameExpression": "return 'time-series'",
                  "timeSeriesExpression": "return [{temperature:10,humidity:63}]",
                  "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                  "statistics": {
                    "minDuration": 12,
                    "maxDuration": 12,
                    "avgDuration": 12,
                    "lastDuration": 12,
                    "count": 1
                  },
                  "createdAt": "2023-07-30T12:30:54.540Z",
                  "updatedAt": "2023-08-30T12:30:54.541Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "time-series-action:read"
            ]
          }
        ]
      },
      "put": {
        "description": "Updates action.",
        "responses": {
          "204": {
            "description": "Action is successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "time-series-action:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "Weather sensor",
                "description": "Publishes weather time series data",
                "endpointIdExpression": "return '65efe88c-6875-4aa6-a064-8c65f9f40514'",
                "timeSeriesNameExpression": "return 'time-series'",
                "timeSeriesExpression": "return [{temperature:10,humidity:63}]",
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes action.",
        "responses": {
          "204": {
            "description": "Action is successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "time-series-action:delete"
            ]
          }
        ]
      }
    },
    "/action-types/alert-activation/actions": {
      "post": {
        "description": "Creates a new action.",
        "responses": {
          "201": {
            "description": "Action is successfully created.",
            "headers": {
              "Location": {
                "description": "URI in format `{schema}://{host}/re/api/v1/action-types/alert-activation/actions/{actionId}`",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:alert-activation-action:create"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertActionRequest"
              },
              "example": {
                "name": "High temperature",
                "description": "Sensor reports high temperature",
                "alertTypeExpression": "return 'HIGH_TEMPERATURE';",
                "severityLevelExpression": "return 'HIGH';",
                "entityType": "ENDPOINT",
                "entityIdExpression": "return 'endpoint-id-1';",
                "activateReasonExpression": "return 'High temperature';",
                "metadataExpression": "return {location: 'Kyiv'};",
                "startedAtExpression": "return new Date('2023-11-06T21:53:07Z').getTime();",
                "lastActiveAtExpression": "return 1699307588000;",
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "get": {
        "description": "Retrieves actions.",
        "responses": {
          "200": {
            "description": "Actions are successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ActionsResponse"
                },
                "example": {
                  "content": [
                    {
                      "id": "75b05695-27ca-46eb-9481-69c199088d99",
                      "name": "High temperature",
                      "description": "Sensor reports high temperature",
                      "alertTypeExpression": "return 'HIGH_TEMPERATURE';",
                      "severityLevelExpression": "return 'HIGH';",
                      "entityType": "ENDPOINT",
                      "entityIdExpression": "return 'endpoint-id-1';",
                      "activateReasonExpression": "return 'High temperature';",
                      "metadataExpression": "return {location: 'Kyiv'};",
                      "startedAtExpression": "return new Date('2023-11-06T21:53:07Z').getTime();",
                      "lastActiveAtExpression": "return 1699307588000;",
                      "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                      "statistics": {
                        "minDuration": 12,
                        "maxDuration": 12,
                        "avgDuration": 12,
                        "lastDuration": 12,
                        "count": 1
                      },
                      "createdAt": "2023-06-30T12:30:54.540Z",
                      "updatedAt": "2023-06-30T12:30:54.541Z"
                    }
                  ],
                  "totalElements": 2
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "alert-activation-action:read"
            ]
          }
        ]
      }
    },
    "/action-types/alert-activation/actions/{actionId}": {
      "parameters": [
        {
          "name": "actionId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Action ID"
        }
      ],
      "get": {
        "description": "Retrieves action.",
        "responses": {
          "200": {
            "description": "Action is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "id": "75b05695-27ca-46eb-9481-69c199088d99",
                  "name": "High temperature",
                  "description": "Sensor reports high temperature",
                  "alertTypeExpression": "return 'HIGH_TEMPERATURE';",
                  "severityLevelExpression": "return 'HIGH';",
                  "entityType": "ENDPOINT",
                  "entityIdExpression": "return 'endpoint-id-1';",
                  "activateReasonExpression": "return 'High temperature';",
                  "metadataExpression": "return {location: 'Kyiv'};",
                  "startedAtExpression": "return new Date('2023-11-06T21:53:07Z').getTime();",
                  "lastActiveAtExpression": "return 1699307588000;",
                  "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                  "statistics": {
                    "minDuration": 12,
                    "maxDuration": 12,
                    "avgDuration": 12,
                    "lastDuration": 12,
                    "count": 1
                  },
                  "createdAt": "2023-06-30T12:30:54.540Z",
                  "updatedAt": "2023-06-30T12:30:54.541Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "alert-activation-action:read"
            ]
          }
        ]
      },
      "put": {
        "description": "Updates action.",
        "responses": {
          "204": {
            "description": "Action is successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "alert-activation-action:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "High temperature",
                "description": "Sensor reports high temperature",
                "alertTypeExpression": "return 'HIGH_TEMPERATURE';",
                "severityLevelExpression": "return 'HIGH';",
                "entityType": "ENDPOINT",
                "entityIdExpression": "return 'endpoint-id-1';",
                "activateReasonExpression": "return 'High temperature';",
                "metadataExpression": "return {location: 'Kyiv'};",
                "startedAtExpression": "return new Date('2023-11-06T21:53:07Z').getTime();",
                "lastActiveAtExpression": "return 1699307588000;",
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes action.",
        "responses": {
          "204": {
            "description": "Action is successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "alert-activation-action:delete"
            ]
          }
        ]
      }
    },
    "/action-types/alert-resolution/actions": {
      "post": {
        "description": "Creates a new action.",
        "responses": {
          "201": {
            "description": "Action is successfully created.",
            "headers": {
              "Location": {
                "description": "URI in format `{schema}://{host}/re/api/v1/action-types/alert-resolution/actions/{actionId}`",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:alert-resolution-action:create"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "OK temperature",
                "description": "Sensor reports OK temperature",
                "alertType": "HIGH_TEMPERATURE",
                "entityType": "ENDPOINT",
                "entityIdExpression": "return 'endpoint-id-1';",
                "resolveReasonExpression": "return 'temperature back to norm';",
                "metadataExpression": "return {location: 'Kyiv'};",
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "get": {
        "description": "Retrieves actions.",
        "responses": {
          "200": {
            "description": "Actions are successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "content": [
                    {
                      "id": "6b8b6b4d-127d-44b6-9a14-10b0bc60b7dd",
                      "name": "OK temperature",
                      "description": "Sensor reports OK temperature",
                      "alertType": "HIGH_TEMPERATURE",
                      "entityType": "ENDPOINT",
                      "entityIdExpression": "return 'endpoint-id-1';",
                      "resolveReasonExpression": "return 'temperature back to norm';",
                      "metadataExpression": "return {location: 'Kyiv'};",
                      "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                      "statistics": {
                        "minDuration": 12,
                        "maxDuration": 12,
                        "avgDuration": 12,
                        "lastDuration": 12,
                        "count": 1
                      },
                      "createdAt": "2023-06-30T12:30:54.540Z",
                      "updatedAt": "2023-06-30T12:30:54.541Z"
                    }
                  ],
                  "totalElements": 2
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "alert-resolution-action:read"
            ]
          }
        ]
      }
    },
    "/action-types/alert-resolution/actions/{actionId}": {
      "parameters": [
        {
          "name": "actionId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Action ID"
        }
      ],
      "get": {
        "description": "Retrieves action.",
        "responses": {
          "200": {
            "description": "Action is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "id": "6b8b6b4d-127d-44b6-9a14-10b0bc60b7dd",
                  "name": "OK temperature",
                  "description": "Sensor reports OK temperature",
                  "alertType": "HIGH_TEMPERATURE",
                  "entityType": "ENDPOINT",
                  "entityIdExpression": "return 'endpoint-id-1';",
                  "resolveReasonExpression": "return 'temperature back to norm';",
                  "metadataExpression": "return {location: 'Kyiv'};",
                  "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                  "statistics": {
                    "minDuration": 12,
                    "maxDuration": 12,
                    "avgDuration": 12,
                    "lastDuration": 12,
                    "count": 1
                  },
                  "createdAt": "2023-06-30T12:30:54.540Z",
                  "updatedAt": "2023-06-30T12:30:54.541Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "alert-resolution-action:read"
            ]
          }
        ]
      },
      "put": {
        "description": "Updates action.",
        "responses": {
          "204": {
            "description": "Action is successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "alert-resolution-action:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "OK temperature",
                "description": "Sensor reports OK temperature",
                "alertType": "HIGH_TEMPERATURE",
                "entityType": "ENDPOINT",
                "entityIdExpression": "return 'endpoint-id-1';",
                "resolveReasonExpression": "return 'temperature back to norm';",
                "metadataExpression": "return {location: 'Kyiv'};",
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes action.",
        "responses": {
          "204": {
            "description": "Action is successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "alert-resolution-action:delete"
            ]
          }
        ]
      }
    },
    "/action-types/send-email/actions": {
      "post": {
        "description": "Creates a new action.",
        "responses": {
          "201": {
            "description": "Action is successfully created.",
            "headers": {
              "Location": {
                "description": "URI in format `{schema}://{host}/re/api/v1/action-types/send-email/actions/{actionId}`",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:send-email-action:create"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "High temperature",
                "description": "Sensor reports high temperature",
                "recipientsExpression": "return ['tom@acme.com', 'jerry@acme.com']",
                "subjectExpression": "return 'High temperature';",
                "textExpression": "return 'Current temperature is ' + 20;",
                "attachmentExpression": "var payload = ctx.toolbox.base64.encode(\"file payload\"); return `{\"fileName\":\"test.txt\", \"type\":\"text/plain\", \"payload\":\"${payload}\"}`",
                "contentType": "TEXT",
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "get": {
        "description": "Retrieves actions.",
        "responses": {
          "200": {
            "description": "Actions are successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "content": [
                    {
                      "id": "75b05695-27ca-46eb-9481-69c199088d99",
                      "name": "High temperature",
                      "description": "Sensor reports high temperature",
                      "recipientsExpression": "return ['tom@acme.com', 'jerry@acme.com']",
                      "subjectExpression": "return 'High temperature';",
                      "textExpression": "return 'Current temperature is ' + 20;",
                      "attachmentExpression": "var payload = ctx.toolbox.base64.encode(\"file payload\"); return `{\"fileName\":\"test.txt\", \"type\":\"text/plain\", \"payload\":\"${payload}\"}`",
                      "contentType": "TEXT",
                      "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                      "statistics": {
                        "minDuration": 12,
                        "maxDuration": 12,
                        "avgDuration": 12,
                        "lastDuration": 12,
                        "count": 1
                      },
                      "createdAt": "2023-06-30T12:30:54.540Z",
                      "updatedAt": "2023-06-30T12:30:54.541Z"
                    }
                  ],
                  "totalElements": 2
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "send-email-action:read"
            ]
          }
        ]
      }
    },
    "/action-types/send-email/actions/{actionId}": {
      "parameters": [
        {
          "name": "actionId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Action ID"
        }
      ],
      "get": {
        "description": "Retrieves action.",
        "responses": {
          "200": {
            "description": "Action is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "id": "75b05695-27ca-46eb-9481-69c199088d99",
                  "name": "High temperature",
                  "description": "Sensor reports high temperature",
                  "recipientsExpression": "return ['tom@acme.com', 'jerry@acme.com']",
                  "subjectExpression": "return 'High temperature';",
                  "textExpression": "return 'Current temperature is ' + 20;",
                  "attachmentExpression": "var payload = ctx.toolbox.base64.encode(\"file payload\"); return `{\"fileName\":\"test.txt\", \"type\":\"text/plain\", \"payload\":\"${payload}\"}`",
                  "contentType": "TEXT",
                  "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                  "statistics": {
                    "minDuration": 12,
                    "maxDuration": 12,
                    "avgDuration": 12,
                    "lastDuration": 12,
                    "count": 1
                  },
                  "createdAt": "2023-06-30T12:30:54.540Z",
                  "updatedAt": "2023-06-30T12:30:54.541Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "send-email-action:read"
            ]
          }
        ]
      },
      "put": {
        "description": "Updates action.",
        "responses": {
          "204": {
            "description": "Action is successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "send-email-action:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "High temperature",
                "description": "Sensor reports high temperature",
                "recipientsExpression": "return ['tom@acme.com', 'jerry@acme.com']",
                "subjectExpression": "return 'High temperature';",
                "textExpression": "return 'Current temperature is ' + 20;",
                "attachmentExpression": "var payload = ctx.toolbox.base64.encode(\"file payload\"); return `{\"fileName\":\"test.txt\", \"type\":\"text/plain\", \"payload\":\"${payload}\"}`",
                "contentType": "TEXT",
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes action.",
        "responses": {
          "204": {
            "description": "Action is successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "send-email-action:delete"
            ]
          }
        ]
      }
    },
    "/expressions/evaluation": {
      "post": {
        "description": "Evaluates expression against provided data.",
        "responses": {
          "200": {
            "description": "Expression is successfully evaluated.",
            "content": {
              "application/json": {
                "schema": {},
                "example": true
              }
            }
          }
        },
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/ExpressionEvaluationRequest"
              },
              "example": {
                "expression": "ctx.endpointMetadata['fed5c358-1240-4ff0-adca-929bae563ad3'].currentStatus == 'alarm' && ctx.childrenEndpoints['d006175b-69bc-40a1-8bda-89686102933e'].size() == 2",
                "endpointMetadata": {
                  "currentStatus": "alarm"
                },
                "childrenEndpoints": [
                  "d006175b-69bc-40a1-8bda-89686102933e",
                  "7981f9a6-00b0-11ee-be56-0242ac120002"
                ]
              }
            }
          }
        }
      }
    },
    "/trigger-types/endpoint-metadata-updated/triggers": {
      "post": {
        "description": "Creates a new trigger.",
        "responses": {
          "201": {
            "description": "Trigger is successfully created.",
            "headers": {
              "Location": {
                "description": "URI in format `{schema}://{host}/re/api/v1/trigger-types/endpoint-metadata-updated/triggers/{triggerId}`",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:endpoint-metadata-updated-trigger:create"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertTriggerRequest"
              },
              "example": {
                "name": "1",
                "description": "Trigger description",
                "endpointIds": [
                  "98ced78d-6875-8bd6-c064-8c65f9f40514",
                  "65efe88c-6875-4aa6-a064-7a38f9c40519"
                ],
                "endpointFilterIds": [
                  "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                ],
                "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                "metadata": {
                  "longitude": "*"
                }
              }
            }
          }
        }
      },
      "get": {
        "description": "Returns trigger list.",
        "responses": {
          "200": {
            "description": "Triggers are successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TriggersResponse"
                },
                "example": {
                  "content": [
                    {
                      "id": "2",
                      "name": "Trigger name",
                      "description": "Trigger description",
                      "endpointIds": [
                        "98ced78d-6875-8bd6-c064-8c65f9f40514",
                        "65efe88c-6875-4aa6-a064-7a38f9c40519"
                      ],
                      "endpointFilterIds": [
                        "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                      ],
                      "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                      "metadata": {
                        "longitude": "*"
                      },
                      "createdAt": "2023-06-30T12:30:54.540Z",
                      "updatedAt": "2023-06-30T12:30:54.541Z"
                    }
                  ],
                  "totalElements": 1
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint-metadata-updated-trigger:read"
            ]
          }
        ]
      }
    },
    "/trigger-types/endpoint-metadata-updated/triggers/{triggerId}": {
      "parameters": [
        {
          "name": "triggerId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Trigger ID"
        }
      ],
      "get": {
        "description": "Returns trigger by ID.",
        "responses": {
          "200": {
            "description": "Trigger is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "id": "2",
                  "name": "Trigger name",
                  "description": "Trigger description",
                  "endpointIds": [
                    "98ced78d-6875-8bd6-c064-8c65f9f40514",
                    "65efe88c-6875-4aa6-a064-7a38f9c40519"
                  ],
                  "endpointFilterIds": [
                    "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                  ],
                  "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                  "metadata": {
                    "longitude": "*"
                  },
                  "createdAt": "2023-06-30T12:30:54.540Z",
                  "updatedAt": "2023-06-30T12:30:54.541Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint-metadata-updated-trigger:read"
            ]
          }
        ]
      },
      "put": {
        "description": "Updates a trigger.",
        "responses": {
          "204": {
            "description": "Trigger is successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint-metadata-updated-trigger:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "1",
                "description": "Trigger description",
                "endpointIds": [
                  "98ced78d-6875-8bd6-c064-8c65f9f40514",
                  "65efe88c-6875-4aa6-a064-7a38f9c40519"
                ],
                "endpointFilterIds": [
                  "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                ],
                "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                "metadata": {
                  "longitude": "*"
                }
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes trigger.",
        "responses": {
          "204": {
            "description": "Trigger is successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint-metadata-updated-trigger:delete"
            ]
          }
        ]
      }
    },
    "/trigger-types/endpoint-time-series-updated/triggers": {
      "post": {
        "description": "Creates a new trigger.",
        "responses": {
          "201": {
            "description": "Trigger is successfully created.",
            "headers": {
              "Location": {
                "description": "URI in format `{schema}://{host}/re/api/v1/trigger-types/endpoint-time-series-updated/triggers/{triggerId}`",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:endpoint-time-series-updated-trigger:create"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertTriggerRequest"
              },
              "example": {
                "name": "Trigger name",
                "description": "Trigger description",
                "endpointIds": [
                  "98ced78d-6875-8bd6-c064-8c65f9f40514",
                  "65efe88c-6875-4aa6-a064-7a38f9c40519"
                ],
                "endpointFilterIds": [
                  "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                ],
                "timeSeriesNames": [
                  "temperature",
                  "humidity"
                ],
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "get": {
        "description": "Returns trigger list.",
        "responses": {
          "200": {
            "description": "Triggers are successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "content": [
                    {
                      "id": "1",
                      "name": "Trigger name",
                      "description": "Trigger description",
                      "endpointIds": [
                        "98ced78d-6875-8bd6-c064-8c65f9f40514",
                        "65efe88c-6875-4aa6-a064-7a38f9c40519"
                      ],
                      "endpointFilterIds": [
                        "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                      ],
                      "metadata:": {
                        "timeSeriesName_1": "temperature",
                        "timeSeriesName_2": "humidity"
                      },
                      "uiMetadata": "{\"severity\": \"CRITICAL\"}"
                    }
                  ],
                  "totalElements": 1
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint-time-series-updated-trigger:read"
            ]
          }
        ]
      }
    },
    "/trigger-types/endpoint-time-series-updated/triggers/{triggerId}": {
      "parameters": [
        {
          "name": "triggerId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Trigger ID"
        }
      ],
      "get": {
        "description": "Returns trigger by ID.",
        "responses": {
          "200": {
            "description": "Trigger is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "id": "1",
                  "name": "Trigger name",
                  "description": "Trigger description",
                  "endpointIds": [
                    "98ced78d-6875-8bd6-c064-8c65f9f40514",
                    "65efe88c-6875-4aa6-a064-7a38f9c40519"
                  ],
                  "endpointFilterIds": [
                    "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                  ],
                  "metadata:": {
                    "timeSeriesName_1": "temperature",
                    "timeSeriesName_2": "humidity"
                  },
                  "uiMetadata": "{\"severity\": \"CRITICAL\"}"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint-time-series-updated-trigger:read"
            ]
          }
        ]
      },
      "put": {
        "description": "Updates a trigger.",
        "responses": {
          "204": {
            "description": "Trigger is successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint-time-series-updated-trigger:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "Trigger name",
                "description": "Trigger description",
                "endpointIds": [
                  "98ced78d-6875-8bd6-c064-8c65f9f40514",
                  "65efe88c-6875-4aa6-a064-7a38f9c40519"
                ],
                "endpointFilterIds": [
                  "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                ],
                "timeSeriesNames": [
                  "temperature",
                  "humidity"
                ],
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes trigger.",
        "responses": {
          "204": {
            "description": "Trigger is successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint-time-series-updated-trigger:delete"
            ]
          }
        ]
      }
    },
    "/trigger-types/endpoint-command-result-received/triggers": {
      "post": {
        "description": "Creates a new trigger.",
        "responses": {
          "201": {
            "description": "Trigger is successfully created.",
            "headers": {
              "Location": {
                "description": "URI in format `{schema}://{host}/re/api/v1/trigger-types/endpoint-command-result-received/triggers/{triggerId}`",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:endpoint-command-result-received-trigger:create"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertTriggerRequest"
              },
              "example": {
                "name": "Trigger name",
                "description": "Trigger description",
                "endpointIds": [
                  "98ced78d-6875-8bd6-c064-8c65f9f40514",
                  "65efe88c-6875-4aa6-a064-7a38f9c40519"
                ],
                "endpointFilterIds": [
                  "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                ],
                "commandTypes": [
                  "goto",
                  "reboot"
                ],
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "get": {
        "description": "Returns trigger list.",
        "responses": {
          "200": {
            "description": "Triggers are successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "content": [
                    {
                      "id": "1",
                      "name": "Trigger name",
                      "description": "Trigger description",
                      "endpointIds": [
                        "98ced78d-6875-8bd6-c064-8c65f9f40514",
                        "65efe88c-6875-4aa6-a064-7a38f9c40519"
                      ],
                      "endpointFilterIds": [
                        "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                      ],
                      "metadata:": {
                        "commandType_1": "goto",
                        "commandType_2": "reboot"
                      },
                      "uiMetadata": "{\"severity\": \"CRITICAL\"}"
                    }
                  ],
                  "totalElements": 1
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint-command-result-received-trigger:read"
            ]
          }
        ]
      }
    },
    "/trigger-types/endpoint-command-result-received/triggers/{triggerId}": {
      "parameters": [
        {
          "name": "triggerId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Trigger ID"
        }
      ],
      "get": {
        "description": "Returns trigger by ID.",
        "responses": {
          "200": {
            "description": "Trigger is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "id": "1",
                  "name": "Trigger name",
                  "description": "Trigger description",
                  "endpointIds": [
                    "98ced78d-6875-8bd6-c064-8c65f9f40514",
                    "65efe88c-6875-4aa6-a064-7a38f9c40519"
                  ],
                  "endpointFilterIds": [
                    "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                  ],
                  "metadata:": {
                    "commandType_1": "goto",
                    "commandType_2": "reboot"
                  },
                  "uiMetadata": "{\"severity\": \"CRITICAL\"}"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint-command-result-received-trigger:read"
            ]
          }
        ]
      },
      "put": {
        "description": "Updates a trigger.",
        "responses": {
          "204": {
            "description": "Trigger is successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint-command-result-received-trigger:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "Trigger name",
                "description": "Trigger description",
                "endpointIds": [
                  "98ced78d-6875-8bd6-c064-8c65f9f40514",
                  "65efe88c-6875-4aa6-a064-7a38f9c40519"
                ],
                "endpointFilterIds": [
                  "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                ],
                "commandTypes": [
                  "goto",
                  "reboot"
                ],
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes trigger.",
        "responses": {
          "204": {
            "description": "Trigger is successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint-command-result-received-trigger:delete"
            ]
          }
        ]
      }
    },
    "/trigger-types/endpoint-command-dispatched/triggers": {
      "post": {
        "description": "Creates a new trigger.",
        "responses": {
          "201": {
            "description": "Trigger is successfully created.",
            "headers": {
              "Location": {
                "description": "URI in format `{schema}://{host}/re/api/v1/trigger-types/endpoint-command-dispatched/triggers/{triggerId}`",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:endpoint-command-dispatched-trigger:create"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "Trigger name",
                "description": "Trigger description",
                "endpointIds": [
                  "98ced78d-6875-8bd6-c064-8c65f9f40514",
                  "65efe88c-6875-4aa6-a064-7a38f9c40519"
                ],
                "endpointFilterIds": [
                  "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                ],
                "commandTypes": [
                  "goto",
                  "reboot"
                ],
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "get": {
        "description": "Returns trigger list.",
        "responses": {
          "200": {
            "description": "Triggers are successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "content": [
                    {
                      "id": "1",
                      "name": "Trigger name",
                      "description": "Trigger description",
                      "endpointIds": [
                        "98ced78d-6875-8bd6-c064-8c65f9f40514",
                        "65efe88c-6875-4aa6-a064-7a38f9c40519"
                      ],
                      "endpointFilterIds": [
                        "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                      ],
                      "metadata:": {
                        "commandType_1": "goto",
                        "commandType_2": "reboot"
                      },
                      "uiMetadata": "{\"severity\": \"CRITICAL\"}"
                    }
                  ],
                  "totalElements": 1
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint-command-dispatched-trigger:read"
            ]
          }
        ]
      }
    },
    "/trigger-types/endpoint-command-dispatched/triggers/{triggerId}": {
      "parameters": [
        {
          "name": "triggerId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Trigger ID"
        }
      ],
      "get": {
        "description": "Returns trigger by ID.",
        "responses": {
          "200": {
            "description": "Trigger is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "id": "1",
                  "name": "Trigger name",
                  "description": "Trigger description",
                  "endpointIds": [
                    "98ced78d-6875-8bd6-c064-8c65f9f40514",
                    "65efe88c-6875-4aa6-a064-7a38f9c40519"
                  ],
                  "endpointFilterIds": [
                    "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                  ],
                  "metadata:": {
                    "commandType_1": "goto",
                    "commandType_2": "reboot"
                  },
                  "uiMetadata": "{\"severity\": \"CRITICAL\"}"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint-command-dispatched-trigger:read"
            ]
          }
        ]
      },
      "put": {
        "description": "Updates a trigger.",
        "responses": {
          "204": {
            "description": "Trigger is successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint-command-dispatched-trigger:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "Trigger name",
                "description": "Trigger description",
                "endpointIds": [
                  "98ced78d-6875-8bd6-c064-8c65f9f40514",
                  "65efe88c-6875-4aa6-a064-7a38f9c40519"
                ],
                "endpointFilterIds": [
                  "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                ],
                "commandTypes": [
                  "goto",
                  "reboot"
                ],
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes trigger.",
        "responses": {
          "204": {
            "description": "Trigger is successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint-command-dispatched-trigger:delete"
            ]
          }
        ]
      }
    },
    "/trigger-types/endpoint-data-samples-received/triggers": {
      "post": {
        "description": "Creates a new trigger.",
        "responses": {
          "201": {
            "description": "Trigger is successfully created.",
            "headers": {
              "Location": {
                "description": "URI in format `{schema}://{host}/re/api/v1/trigger-types/endpoint-data-samples-received/triggers/{triggerId}`",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:endpoint-data-samples-received-trigger:create"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "1",
                "description": "Trigger description",
                "endpointIds": [
                  "98ced78d-6875-8bd6-c064-8c65f9f40514",
                  "65efe88c-6875-4aa6-a064-7a38f9c40519"
                ],
                "endpointFilterIds": [
                  "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                ],
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "get": {
        "description": "Returns trigger list.",
        "responses": {
          "200": {
            "description": "Triggers are successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "content": [
                    {
                      "id": "2",
                      "name": "Trigger name",
                      "description": "Trigger description",
                      "endpointIds": [
                        "98ced78d-6875-8bd6-c064-8c65f9f40514",
                        "65efe88c-6875-4aa6-a064-7a38f9c40519"
                      ],
                      "endpointFilterIds": [
                        "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                      ],
                      "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                      "createdAt": "2023-06-30T12:30:54.540Z",
                      "updatedAt": "2023-06-30T12:30:54.541Z"
                    }
                  ],
                  "totalElements": 1
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint-data-samples-received-trigger:read"
            ]
          }
        ]
      }
    },
    "/trigger-types/endpoint-data-samples-received/triggers/{triggerId}": {
      "parameters": [
        {
          "name": "triggerId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Trigger ID"
        }
      ],
      "get": {
        "description": "Returns trigger by ID.",
        "responses": {
          "200": {
            "description": "Trigger is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "id": "2",
                  "name": "Trigger name",
                  "description": "Trigger description",
                  "endpointIds": [
                    "98ced78d-6875-8bd6-c064-8c65f9f40514",
                    "65efe88c-6875-4aa6-a064-7a38f9c40519"
                  ],
                  "endpointFilterIds": [
                    "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                  ],
                  "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                  "createdAt": "2023-06-30T12:30:54.540Z",
                  "updatedAt": "2023-06-30T12:30:54.541Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint-data-samples-received-trigger:read"
            ]
          }
        ]
      },
      "put": {
        "description": "Updates a trigger.",
        "responses": {
          "204": {
            "description": "Trigger is successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint-data-samples-received-trigger:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "1",
                "description": "Trigger description",
                "endpointIds": [
                  "98ced78d-6875-8bd6-c064-8c65f9f40514",
                  "65efe88c-6875-4aa6-a064-7a38f9c40519"
                ],
                "endpointFilterIds": [
                  "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                ],
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes trigger.",
        "responses": {
          "204": {
            "description": "Trigger is successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint-data-samples-received-trigger:delete"
            ]
          }
        ]
      }
    },
    "/trigger-types/endpoint-config-updated/triggers": {
      "post": {
        "description": "Creates a new trigger.",
        "responses": {
          "201": {
            "description": "Trigger is successfully created.",
            "headers": {
              "Location": {
                "description": "URI in format `{schema}://{host}/re/api/v1/trigger-types/endpoint-config-updated/triggers/{triggerId}`",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:endpoint-config-updated-trigger:create"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "1",
                "description": "Trigger description",
                "endpointIds": [
                  "98ced78d-6875-8bd6-c064-8c65f9f40514",
                  "65efe88c-6875-4aa6-a064-7a38f9c40519"
                ],
                "endpointFilterIds": [
                  "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                ],
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "get": {
        "description": "Returns trigger list.",
        "responses": {
          "200": {
            "description": "Triggers are successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "content": [
                    {
                      "id": "2",
                      "name": "Trigger name",
                      "description": "Trigger description",
                      "endpointIds": [
                        "98ced78d-6875-8bd6-c064-8c65f9f40514",
                        "65efe88c-6875-4aa6-a064-7a38f9c40519"
                      ],
                      "endpointFilterIds": [
                        "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                      ],
                      "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                      "createdAt": "2023-06-30T12:30:54.540Z",
                      "updatedAt": "2023-06-30T12:30:54.541Z"
                    }
                  ],
                  "totalElements": 1
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint-config-updated-trigger:read"
            ]
          }
        ]
      }
    },
    "/trigger-types/endpoint-config-updated/triggers/{triggerId}": {
      "parameters": [
        {
          "name": "triggerId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Trigger ID"
        }
      ],
      "get": {
        "description": "Returns trigger by ID.",
        "responses": {
          "200": {
            "description": "Trigger is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "id": "2",
                  "name": "Trigger name",
                  "description": "Trigger description",
                  "endpointIds": [
                    "98ced78d-6875-8bd6-c064-8c65f9f40514",
                    "65efe88c-6875-4aa6-a064-7a38f9c40519"
                  ],
                  "endpointFilterIds": [
                    "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                  ],
                  "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                  "createdAt": "2023-06-30T12:30:54.540Z",
                  "updatedAt": "2023-06-30T12:30:54.541Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint-config-updated-trigger:read"
            ]
          }
        ]
      },
      "put": {
        "description": "Updates a trigger.",
        "responses": {
          "204": {
            "description": "Trigger is successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint-config-updated-trigger:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "1",
                "description": "Trigger description",
                "endpointIds": [
                  "98ced78d-6875-8bd6-c064-8c65f9f40514",
                  "65efe88c-6875-4aa6-a064-7a38f9c40519"
                ],
                "endpointFilterIds": [
                  "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                ],
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes trigger.",
        "responses": {
          "204": {
            "description": "Trigger is successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint-config-updated-trigger:delete"
            ]
          }
        ]
      }
    },
    "/trigger-types/alert-lifecycle-event/triggers": {
      "post": {
        "description": "Creates a new trigger.",
        "responses": {
          "201": {
            "description": "Trigger is successfully created.",
            "headers": {
              "Location": {
                "description": "URI in format `{schema}://{host}/re/api/v1/trigger-types/alert-lifecycle-event/triggers/{triggerId}`",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:alert-lifecycle-event-trigger:create"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertTriggerRequest"
              },
              "example": {
                "name": "1",
                "description": "Trigger description",
                "endpointIds": [
                  "98ced78d-6875-8bd6-c064-8c65f9f40514",
                  "65efe88c-6875-4aa6-a064-7a38f9c40519"
                ],
                "endpointFilterIds": [
                  "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                ],
                "metadata:": {
                  "alertLifecycleEventType": "SEVERITY_LEVEL_INCREASED,RESOLVED"
                },
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "get": {
        "description": "Returns trigger list.",
        "responses": {
          "200": {
            "description": "Triggers are successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "content": [
                    {
                      "id": "1",
                      "name": "'endpoint time series updated' trigger",
                      "description": "'endpoint time series updated' trigger that reacts to events on endpoints",
                      "endpointIds": [
                        "98ced78d-6875-8bd6-c064-8c65f9f40514",
                        "65efe88c-6875-4aa6-a064-7a38f9c40519"
                      ],
                      "endpointFilterIds": [
                        "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                      ],
                      "metadata:": {
                        "alertLifecycleEventType": "SEVERITY_LEVEL_INCREASED,RESOLVED"
                      },
                      "uiMetadata": "{\"severity\": \"CRITICAL\"}"
                    }
                  ],
                  "totalElements": 1
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "alert-lifecycle-event-trigger:read"
            ]
          }
        ]
      }
    },
    "/trigger-types/alert-lifecycle-event/triggers/{triggerId}": {
      "parameters": [
        {
          "name": "triggerId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Trigger ID"
        }
      ],
      "get": {
        "description": "Returns trigger by ID.",
        "responses": {
          "200": {
            "description": "Trigger is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "id": "1",
                  "name": "'endpoint time series updated' trigger",
                  "description": "'endpoint time series updated' trigger that reacts to events on endpoints",
                  "endpointIds": [
                    "98ced78d-6875-8bd6-c064-8c65f9f40514",
                    "65efe88c-6875-4aa6-a064-7a38f9c40519"
                  ],
                  "endpointFilterIds": [
                    "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                  ],
                  "metadata:": {
                    "alertLifecycleEventType": "SEVERITY_LEVEL_INCREASED,RESOLVED"
                  },
                  "uiMetadata": "{\"severity\": \"CRITICAL\"}"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "alert-lifecycle-event-trigger:read"
            ]
          }
        ]
      },
      "put": {
        "description": "Updates a trigger.",
        "responses": {
          "204": {
            "description": "Trigger is successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "alert-lifecycle-event-trigger:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "1",
                "description": "Trigger description",
                "endpointIds": [
                  "98ced78d-6875-8bd6-c064-8c65f9f40514",
                  "65efe88c-6875-4aa6-a064-7a38f9c40519"
                ],
                "endpointFilterIds": [
                  "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                ],
                "metadata:": {
                  "alertLifecycleEventType": "SEVERITY_LEVEL_INCREASED,RESOLVED"
                },
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes trigger.",
        "responses": {
          "204": {
            "description": "Trigger is successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "alert-lifecycle-event-trigger:delete"
            ]
          }
        ]
      }
    },
    "/trigger-types/cron/triggers": {
      "post": {
        "description": "Creates a new trigger.",
        "responses": {
          "201": {
            "description": "Trigger is successfully created.",
            "headers": {
              "Location": {
                "description": "URI in format `{schema}://{host}/re/api/v1/trigger-types/cron/triggers/{triggerId}`",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:cron-trigger:create"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "Trigger name",
                "description": "Trigger description",
                "cron": "0 */10 * * * ?",
                "timeZoneId": "Europe/Kyiv",
                "endpointIds": [
                  "98ced78d-6875-8bd6-c064-8c65f9f40514",
                  "65efe88c-6875-4aa6-a064-7a38f9c40519"
                ],
                "endpointFilterIds": [
                  "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                ],
                "parallelism": 3,
                "delayBetweenRuleExecutionsMillis": 500,
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "get": {
        "description": "Returns trigger list.",
        "responses": {
          "200": {
            "description": "Triggers are successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "content": [
                    {
                      "id": "1",
                      "name": "Trigger name",
                      "description": "Trigger description",
                      "cron": "0 */10 * * * ?",
                      "timeZoneId": "Europe/Kyiv",
                      "endpointIds": [
                        "98ced78d-6875-8bd6-c064-8c65f9f40514",
                        "65efe88c-6875-4aa6-a064-7a38f9c40519"
                      ],
                      "endpointFilterIds": [
                        "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                      ],
                      "parallelism": 3,
                      "delayBetweenRuleExecutionsMillis": 500,
                      "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                      "createdAt": "2023-06-30T12:30:54.540Z",
                      "updatedAt": "2023-06-30T12:30:54.541Z"
                    }
                  ],
                  "totalElements": 1
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "cron-trigger:read"
            ]
          }
        ]
      }
    },
    "/trigger-types/cron/triggers/{triggerId}": {
      "parameters": [
        {
          "name": "triggerId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Trigger ID"
        }
      ],
      "get": {
        "description": "Returns trigger by ID.",
        "responses": {
          "200": {
            "description": "Trigger is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "id": "1",
                  "name": "Trigger name",
                  "description": "Trigger description",
                  "cron": "0 */10 * * * ?",
                  "timeZoneId": "Europe/Kyiv",
                  "endpointIds": [
                    "98ced78d-6875-8bd6-c064-8c65f9f40514",
                    "65efe88c-6875-4aa6-a064-7a38f9c40519"
                  ],
                  "endpointFilterIds": [
                    "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                  ],
                  "parallelism": 3,
                  "delayBetweenRuleExecutionsMillis": 500,
                  "uiMetadata": "{\"severity\": \"CRITICAL\"}",
                  "createdAt": "2023-06-30T12:30:54.540Z",
                  "updatedAt": "2023-06-30T12:30:54.541Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "cron-trigger:read"
            ]
          }
        ]
      },
      "put": {
        "description": "Updates a trigger.",
        "responses": {
          "204": {
            "description": "Trigger is successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "cron-trigger:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "Trigger name",
                "description": "Trigger description",
                "cron": "0 */10 * * * ?",
                "timeZoneId": "Europe/Kyiv",
                "endpointIds": [
                  "98ced78d-6875-8bd6-c064-8c65f9f40514",
                  "65efe88c-6875-4aa6-a064-7a38f9c40519"
                ],
                "endpointFilterIds": [
                  "3f1b0f2e-1c4a-4f0e-9a1b-2d5c7e8f9a01"
                ],
                "parallelism": 3,
                "delayBetweenRuleExecutionsMillis": 500,
                "uiMetadata": "{\"severity\": \"CRITICAL\"}"
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes trigger.",
        "responses": {
          "204": {
            "description": "Trigger is successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "cron-trigger:delete"
            ]
          }
        ]
      }
    },
    "/alerts": {
      "get": {
        "description": "Retrieves alerts.",
        "responses": {
          "200": {
            "description": "Alerts are successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AlertsResponse"
                },
                "example": {
                  "content": [
                    {
                      "id": "0148290c-e8e7-4050-b4c4-5628becb286e",
                      "alertType": "HIGH_TEMPERATURE",
                      "acknowledgement": "UNACKNOWLEDGED",
                      "state": "ACTIVE",
                      "severityLevel": "LOW",
                      "entityType": "ENDPOINT",
                      "entityId": "c0e92a30-5958-4dc2-b275-b383efafa87d",
                      "activateReason": "High temperature!",
                      "resolveReason": null,
                      "systemMetadata": "{\"appName\":\"c8u2bklah5mkbilgyie6\"}",
                      "entityMetadata": "{\"floor\":1}",
                      "activationMetadata": "{\"location\":\"Kyiv\"}",
                      "resolutionMetadata": "{\"location\":\"Kharkiv\"}",
                      "relationTree": "{\"IS_CONTAINED_BY\":[{\"entityType\":\"ASSET\",\"entityId\":\"building-1\"}]}",
                      "alertSettingIds": [
                        "c783e95a-e248-40c6-82c1-7fd27a96e6d7"
                      ],
                      "startedAt": "2023-10-03T08:28:10.166Z",
                      "lastActiveAt": "2023-10-03T08:28:10.166Z"
                    }
                  ],
                  "totalElements": 1
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint:read",
              "tenant:alert:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "entityType",
            "in": "query",
            "description": "Entity type.",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "ENDPOINT",
                "TENANT"
              ]
            },
            "example": "ENDPOINT"
          },
          {
            "name": "entityIds",
            "in": "query",
            "description": "Entity ids.",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "c0e92a30-5958-4dc2-b275-b383efafa87d"
          },
          {
            "name": "alertSettingId",
            "in": "query",
            "description": "Alert setting id.",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "75b05695-27ca-46eb-9481-69c199088d99"
          },
          {
            "name": "alertType",
            "in": "query",
            "description": "Alert type.",
            "required": false,
            "schema": {
              "type": "array"
            },
            "example": "HIGH_TEMPERATURE,LOW_PRESSURE"
          },
          {
            "name": "state",
            "in": "query",
            "description": "Alert state.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ACTIVE",
                "RESOLVED"
              ]
            },
            "example": "ACTIVE"
          },
          {
            "name": "acknowledgement",
            "in": "query",
            "description": "Alert acknowledgement.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "UNACKNOWLEDGED",
                "ACKNOWLEDGED"
              ]
            },
            "example": "UNACKNOWLEDGED"
          },
          {
            "name": "severityLevel",
            "in": "query",
            "description": "Alert severity level.",
            "required": false,
            "schema": {
              "type": "array",
              "enum": [
                "INFO",
                "LOW",
                "MEDIUM",
                "HIGH",
                "CRITICAL"
              ]
            },
            "example": [
              "CRITICAL",
              "HIGH"
            ]
          },
          {
            "name": "entityMetadataPath",
            "in": "query",
            "description": "Entity metadata path.",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "location.city"
          },
          {
            "name": "entityMetadataValue",
            "in": "query",
            "description": "Entity metadata value.",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "Kyiv"
          },
          {
            "name": "metadataPath",
            "in": "query",
            "description": "Metadata path.",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "location.city"
          },
          {
            "name": "metadataValue",
            "in": "query",
            "description": "Metadata value.",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "Kyiv"
          },
          {
            "name": "fromStartedAt",
            "in": "query",
            "description": "Timestamp in ISO 8601 format (UTC timezone) to return alerts from. Inclusive.",
            "required": false,
            "schema": {
              "type": "datetime"
            },
            "example": "2023-03-02T04:05:06"
          },
          {
            "name": "toStartedAt",
            "in": "query",
            "description": "Timestamp in ISO 8601 format (UTC timezone) to return alerts to. Inclusive.",
            "required": false,
            "schema": {
              "type": "datetime"
            },
            "example": "2023-03-02T04:05:06"
          },
          {
            "name": "sort",
            "in": "query",
            "description": "Field to sort by.",
            "required": false,
            "schema": {
              "type": "string",
              "default": "startedAt",
              "enum": [
                "startedAt"
              ]
            },
            "example": "startedAt"
          },
          {
            "name": "sortOrder",
            "in": "query",
            "description": "Sort direction.",
            "required": false,
            "schema": {
              "type": "string",
              "default": "desc",
              "enum": [
                "asc",
                "desc"
              ]
            },
            "example": "asc"
          }
        ]
      }
    },
    "/alerts/delete": {
      "post": {
        "description": "Delete alerts applying optional filtering.",
        "responses": {
          "204": {
            "description": "Alerts are successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DeleteRequest"
              },
              "example": {
                "entityIds": [
                  "d0508d42-37dc-48d7-bf87-4b9d423e05c9"
                ],
                "entityType": "ENDPOINT",
                "filter": {
                  "and": [
                    {
                      "key": "alertType",
                      "operator": "IN",
                      "values": [
                        "HIGH_TEMPERATURE",
                        "LOW_PRESSURE"
                      ],
                      "and": [
                        {
                          "key": "state",
                          "operator": "IN",
                          "values": [
                            "ACTIVE"
                          ]
                        }
                      ]
                    },
                    {
                      "key": "entityMetadata.location.city",
                      "operator": "IN",
                      "values": [
                        "Kyiv"
                      ]
                    }
                  ]
                }
              }
            }
          }
        }
      }
    },
    "/alerts/metadata-keys": {
      "get": {
        "description": "Retrieves alert metadata keys.",
        "responses": {
          "200": {
            "description": "Alert metadata keys are successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": [
                  "location",
                  "street"
                ]
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:alert:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "metadataKeysType",
            "in": "query",
            "description": "Metadata key type.",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "SYSTEM_METADATA",
                "ENTITY_METADATA",
                "ACTIVATION_METADATA",
                "RESOLUTION_METADATA"
              ]
            },
            "example": "ACTIVATION_METADATA"
          }
        ]
      }
    },
    "/alerts/search": {
      "post": {
        "description": "Retrieves list applying optional filtering.",
        "responses": {
          "200": {
            "description": "List is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ListResponse"
                },
                "example": {
                  "content": [
                    {
                      "id": "0148290c-e8e7-4050-b4c4-5628becb286e",
                      "alertType": "HIGH_TEMPERATURE",
                      "acknowledgement": "UNACKNOWLEDGED",
                      "state": "ACTIVE",
                      "severityLevel": "LOW",
                      "entityType": "ENDPOINT",
                      "entityId": "c0e92a30-5958-4dc2-b275-b383efafa87d",
                      "activateReason": "High temperature!",
                      "resolveReason": null,
                      "systemMetadata": "{\"appName\":\"c8u2bklah5mkbilgyie6\"}",
                      "entityMetadata": "{\"floor\":1}",
                      "activationMetadata": "{\"location\":\"Kyiv\"}",
                      "resolutionMetadata": "{\"location\":\"Kharkiv\"}",
                      "relationTree": "{\"IS_CONTAINED_BY\":[{\"entityType\":\"ASSET\",\"entityId\":\"building-1\"}]}",
                      "alertSettingIds": [
                        "c783e95a-e248-40c6-82c1-7fd27a96e6d7"
                      ],
                      "startedAt": "2023-10-03T08:28:10.166Z",
                      "lastActiveAt": "2023-10-03T08:28:10.166Z"
                    }
                  ],
                  "totalElements": 1
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint:read",
              "tenant:alert:read"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/Search"
              },
              "example": {
                "entityIds": [
                  "d0508d42-37dc-48d7-bf87-4b9d423e05c9"
                ],
                "entityType": "ENDPOINT",
                "filter": {
                  "and": [
                    {
                      "key": "alertType",
                      "operator": "IN",
                      "values": [
                        "HIGH_TEMPERATURE",
                        "LOW_PRESSURE"
                      ],
                      "and": [
                        {
                          "key": "state",
                          "operator": "IN",
                          "values": [
                            "ACTIVE"
                          ]
                        }
                      ]
                    },
                    {
                      "key": "entityMetadata.location.city",
                      "operator": "IN",
                      "values": [
                        "Kyiv"
                      ]
                    }
                  ]
                },
                "sort": {
                  "key": "startedAt",
                  "direction": "ASC"
                },
                "page": {
                  "page": 3,
                  "size": 10
                }
              }
            }
          }
        }
      }
    },
    "/alerts/types": {
      "get": {
        "description": "Retrieves all alert types.",
        "responses": {
          "200": {
            "description": "Alert types are successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": [
                  "overheat",
                  "overload",
                  "no_connection",
                  "failure"
                ]
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:alert-type:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "entityType",
            "in": "query",
            "description": "Entity type.",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "ENDPOINT",
                "TENANT"
              ]
            }
          }
        ]
      }
    },
    "/alerts/{alertId}": {
      "parameters": [
        {
          "name": "alertId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Alert ID"
        }
      ],
      "delete": {
        "description": "Deletes alert.",
        "responses": {
          "204": {
            "description": "Alert is successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint:update"
            ]
          }
        ],
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "description": "Entity ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entityType",
            "in": "query",
            "description": "Entity type.",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "ENDPOINT",
                "TENANT"
              ]
            }
          }
        ]
      }
    },
    "/alerts/{alertId}/acknowledgement": {
      "parameters": [
        {
          "name": "alertId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Alert ID"
        }
      ],
      "put": {
        "description": "Acknowledges alert.",
        "responses": {
          "204": {
            "description": "Alert is successfully transitioned."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint:update",
              "tenant:alert:update"
            ]
          }
        ],
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "description": "Entity ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entityType",
            "in": "query",
            "description": "Entity type.",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "ENDPOINT",
                "TENANT"
              ]
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AlertTransitionRequest"
              },
              "example": {
                "status": "ACKNOWLEDGED",
                "transitionReason": "Alert acknowledged"
              }
            }
          }
        }
      }
    },
    "/alerts/{alertId}/resolve": {
      "parameters": [
        {
          "name": "alertId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Alert ID"
        }
      ],
      "put": {
        "description": "Resolves alert.",
        "responses": {
          "204": {
            "description": "Alert is successfully resolved."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint:update",
              "tenant:alert:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AlertResolutionRequest"
              },
              "example": {
                "entityId": "50d5acfb-fc7d-46e2-881f-53216bfff2a9",
                "entityType": "ENDPOINT",
                "resolveReason": "The issue is resolved",
                "resolutionMetadata": {
                  "customKey": "customValue"
                }
              }
            }
          }
        }
      }
    },
    "/alerts/{alertId}/lifecycle-events": {
      "parameters": [
        {
          "name": "alertId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Alert ID"
        }
      ],
      "get": {
        "description": "Retrieves alert lifecycle events.",
        "responses": {
          "200": {
            "description": "Alerts status transition history is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AlertLifecycleEvent"
                },
                "example": {
                  "content": [
                    {
                      "id": "4c96f636-8b0d-4c7a-a995-33cc91659df7",
                      "alertId": "0148290c-e8e7-4050-b4c4-5628becb286e",
                      "eventType": "SEVERITY_LEVEL_INCREASED",
                      "timestamp": "2023-10-08T03:38:29.248Z",
                      "systemMetadata": {
                        "from": "HIGH",
                        "to": "CRITICAL",
                        "alertSettingId": "fefc3540-31c5-4b8a-9153-7301dff20e64"
                      },
                      "metadata": {
                        "customKey": "custom value"
                      }
                    }
                  ],
                  "totalElements": 1
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "endpoint:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "entityId",
            "in": "query",
            "description": "Entity ID.",
            "required": true,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entityType",
            "in": "query",
            "description": "Entity type.",
            "required": true,
            "schema": {
              "type": "string",
              "enum": [
                "ENDPOINT",
                "TENANT"
              ]
            }
          },
          {
            "name": "eventType",
            "in": "query",
            "description": "Event type.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "SEVERITY_LEVEL_INCREASED",
                "SEVERITY_LEVEL_DECREASED",
                "CREATED",
                "ACTIVE",
                "RESOLVED",
                "ACKNOWLEDGEMENT_TRANSITIONED"
              ]
            },
            "example": "SEVERITY_LEVEL_INCREASED"
          },
          {
            "name": "sort",
            "in": "query",
            "description": "Field to sort by.",
            "required": false,
            "schema": {
              "type": "string",
              "default": "timestamp",
              "enum": [
                "timestamp"
              ]
            },
            "example": "timestamp"
          },
          {
            "name": "sortOrder",
            "in": "query",
            "description": "Sort direction.",
            "required": false,
            "schema": {
              "type": "string",
              "default": "desc",
              "enum": [
                "asc",
                "desc"
              ]
            },
            "example": "asc"
          }
        ]
      }
    },
    "/traces": {
      "get": {
        "description": "Returns traces.",
        "responses": {
          "200": {
            "description": "Traces are successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/TracesResponse"
                },
                "example": {
                  "content": [
                    {
                      "id": "aa54a074-6c87-46cf-a4a1-fbec44dd4ac8",
                      "traceId": "da7c72c6-d914-4ab8-ac45-e7f6fb6a2c15",
                      "entityType": "COMMAND_INVOCATION_ACTION",
                      "entityId": "74",
                      "raisedOnEntityType": "ENDPOINT",
                      "raisedOnEntityId": "7a37e4e5-a5e4-4262-8454-49efc3d477c8",
                      "outcome": "FAILURE",
                      "stage": "ENDPOINT_ID_EXPRESSION_EVALUATION",
                      "reason": "TypeError: Cannot read property 'getChildren' of undefined",
                      "metadata": {
                        "endpointIdExpression": "return ctx.endpoin.getChildren().length"
                      }
                    },
                    {
                      "id": "ea279e04-3f0d-49f5-a3c5-fc46acfbd675",
                      "traceId": "da7c72c6-d914-4ab8-ac45-e7f6fb6a2c15",
                      "entityType": "DATA_SAMPLE_ACTION",
                      "entityId": "91",
                      "raisedOnEntityType": "ENDPOINT",
                      "raisedOnEntityId": "3663b829-50e9-4d83-8a98-55b3129c7a9a",
                      "outcome": "SUCCESS"
                    }
                  ],
                  "totalElements": 2
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:rule-execution:trace:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "traceId",
            "in": "query",
            "description": "Trace ID.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "entityType",
            "in": "query",
            "description": "Entity type.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "RULE",
                "COMMAND_INVOCATION_ACTION",
                "DATA_SAMPLE_ACTION",
                "METADATA_UPDATE_ACTION",
                "RULE_EXECUTION_ACTION",
                "WEBHOOK_ACTION",
                "RULE_ACTION",
                "TIME_SERIES_ACTION",
                "ALERT_ACTIVATION_ACTION",
                "ALERT_RESOLUTION_ACTION",
                "SEND_EMAIL_ACTION"
              ]
            }
          },
          {
            "name": "entityId",
            "in": "query",
            "description": "Entity ID.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "raisedOnEntityType",
            "in": "query",
            "description": "Entity type that the trace raised on.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "ENDPOINT",
                "ON_DEMAND"
              ]
            }
          },
          {
            "name": "raisedOnEntityId",
            "in": "query",
            "description": "Entity ID that the trace raised on.",
            "required": false,
            "schema": {
              "type": "string"
            }
          },
          {
            "name": "outcome",
            "in": "query",
            "description": "Execution outcome.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "FAILURE",
                "SUCCESS"
              ]
            }
          },
          {
            "name": "fromCreatedAt",
            "in": "query",
            "description": "Timestamp in ISO 8601 format (UTC timezone) to filter traces by creation time.",
            "required": false,
            "schema": {
              "type": "datetime"
            },
            "example": "2023-06-30T12:30:54.540000+00:00"
          },
          {
            "name": "toCreatedAt",
            "in": "query",
            "description": "Timestamp in ISO 8601 format (UTC timezone) to filter traces by creation time.",
            "required": false,
            "schema": {
              "type": "datetime"
            },
            "example": "2023-06-30T12:35:54.540000+00:00"
          },
          {
            "name": "include",
            "in": "query",
            "description": "Include. RELATED - Includes traces with the same trace ID.",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "RELATED"
              ]
            },
            "example": "RELATED"
          }
        ]
      },
      "delete": {
        "description": "Deletes traces.",
        "responses": {
          "204": {
            "description": "Traces are successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:rule-execution:trace:delete"
            ]
          }
        ],
        "parameters": [
          {
            "name": "beforeDate",
            "in": "query",
            "description": "Date and time in ISO format to delete traces before. If not provided, all traces are deleted.",
            "required": false,
            "schema": {
              "type": "datetime"
            },
            "example": "2023-06-30T12:30:54.540000+00:00"
          }
        ]
      }
    },
    "/alert-settings": {
      "post": {
        "description": "Creates a new alert setting.",
        "responses": {
          "201": {
            "description": "Alert setting is successfully created.",
            "headers": {
              "Location": {
                "description": "URI in format `{schema}://{host}/re/api/v1/alert-settings/{alertSettingId}`",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertAlertSettingRequest"
              },
              "example": {
                "name": "High temperature alert setting",
                "description": "Alert setting for high temperature",
                "ruleIds": [
                  "96fafee4-3238-44ab-93c0-28969d44abf6"
                ],
                "actions": [
                  {
                    "actionId": "22",
                    "actionType": "COMMAND_INVOCATION"
                  }
                ],
                "triggers": [
                  {
                    "triggerId": "27",
                    "triggerType": "ENDPOINT_METADATA_UPDATED"
                  }
                ]
              }
            }
          }
        }
      },
      "get": {
        "description": "Returns alert setting list.",
        "responses": {
          "200": {
            "description": "Alert settings are successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AlertSettingsResponse"
                },
                "example": {
                  "content": [
                    {
                      "id": "75b05695-27ca-46eb-9481-69c199088d99",
                      "name": "High temperature alert setting",
                      "description": "Alert setting for high temperature",
                      "state": "ENABLED",
                      "ruleIds": [
                        "96fafee4-3238-44ab-93c0-28969d44abf6"
                      ],
                      "actions": [
                        {
                          "actionId": "22",
                          "actionType": "COMMAND_INVOCATION"
                        }
                      ],
                      "triggers": [
                        {
                          "triggerId": "27",
                          "triggerType": "ENDPOINT_METADATA_UPDATED"
                        }
                      ],
                      "createdAt": "2023-06-30T12:30:54.540Z",
                      "updatedAt": "2023-06-30T12:30:54.541Z"
                    }
                  ],
                  "totalElements": 2
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule:read"
            ]
          }
        ]
      }
    },
    "/alert-settings/{alertSettingId}": {
      "parameters": [
        {
          "name": "alertSettingId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Alert setting ID"
        }
      ],
      "get": {
        "description": "Returns alert setting by ID.",
        "responses": {
          "200": {
            "description": "Alert setting is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "id": "75b05695-27ca-46eb-9481-69c199088d99",
                  "name": "High temperature alert setting",
                  "description": "Alert setting for high temperature",
                  "state": "ENABLED",
                  "ruleIds": [
                    "96fafee4-3238-44ab-93c0-28969d44abf6"
                  ],
                  "actions": [
                    {
                      "actionId": "22",
                      "actionType": "COMMAND_INVOCATION"
                    }
                  ],
                  "triggers": [
                    {
                      "triggerId": "27",
                      "triggerType": "ENDPOINT_METADATA_UPDATED"
                    }
                  ],
                  "createdAt": "2023-06-30T12:30:54.540Z",
                  "updatedAt": "2023-06-30T12:30:54.541Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule:read"
            ]
          }
        ]
      },
      "put": {
        "description": "Updates an alert setting.",
        "responses": {
          "204": {
            "description": "Alert setting is successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "High temperature alert setting",
                "description": "Alert setting for high temperature",
                "ruleIds": [
                  "96fafee4-3238-44ab-93c0-28969d44abf6"
                ],
                "actions": [
                  {
                    "actionId": "22",
                    "actionType": "COMMAND_INVOCATION"
                  }
                ],
                "triggers": [
                  {
                    "triggerId": "27",
                    "triggerType": "ENDPOINT_METADATA_UPDATED"
                  }
                ]
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes alert setting.",
        "responses": {
          "204": {
            "description": "Alert setting is successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule:update"
            ]
          }
        ]
      }
    },
    "/secrets": {
      "post": {
        "description": "Creates a new item.",
        "responses": {
          "201": {
            "description": "Item is successfully created.",
            "headers": {
              "Location": {
                "description": "URI in format `{schema}://{host}/re/api/v1/secrets/{secretId}`",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:rule-secret:create"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpsertRequest"
              },
              "example": {
                "key": "MY_SECRET",
                "value": "fxMukYtUvH2MP27WoShdQv9PxlaMIFZd"
              }
            }
          }
        }
      },
      "get": {
        "description": "Returns list.",
        "responses": {
          "200": {
            "description": "List is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "content": [
                    {
                      "key": "MY_SECRET",
                      "value": "fxMukYtUvH2MP27WoShdQv9PxlaMIFZd",
                      "createdAt": "2023-06-30T12:30:54.540Z",
                      "updatedAt": "2023-06-30T12:30:54.541Z"
                    }
                  ],
                  "totalElements": 1
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule-secret:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "key",
            "in": "query",
            "description": "Key. Supports partial match.",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "MY_SECRET"
          }
        ]
      }
    },
    "/secrets/{secretId}": {
      "parameters": [
        {
          "name": "secretId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "ID"
        }
      ],
      "get": {
        "description": "Retrieves item.",
        "responses": {
          "200": {
            "description": "Item is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "key": "MY_SECRET",
                  "value": "fxMukYtUvH2MP27WoShdQv9PxlaMIFZd",
                  "createdAt": "2023-06-30T12:30:54.540Z",
                  "updatedAt": "2023-06-30T12:30:54.541Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule-secret:read"
            ]
          }
        ]
      },
      "put": {
        "description": "Updates item.",
        "responses": {
          "204": {
            "description": "Item is successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule-secret:update"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "key": "MY_SECRET",
                "value": "fxMukYtUvH2MP27WoShdQv9PxlaMIFZd"
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes.",
        "responses": {
          "204": {
            "description": "Item is successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule-secret:delete"
            ]
          }
        ]
      }
    },
    "/snippets": {
      "post": {
        "description": "Creates a new item.",
        "responses": {
          "201": {
            "description": "Item is successfully created.",
            "headers": {
              "Location": {
                "description": "URI in format `{schema}://{host}/re/api/v1/snippets/{snippetId}`",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:rule:create"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "greeter",
                "description": "Greeting snippet that says 'Hi!'",
                "expression": "function greet() {return 'Hi!'} module.exports = {greet};"
              }
            }
          }
        }
      },
      "get": {
        "description": "Returns list.",
        "responses": {
          "200": {
            "description": "List is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "content": [
                    {
                      "id": "d80fc8a0-c51e-4d6e-adbf-092174a29d3a",
                      "name": "greeter",
                      "description": "Greeting snippet that says 'Hi!'",
                      "expression": "function greet() {return 'Hi!'} module.exports = {greet};",
                      "createdAt": "2023-06-30T12:30:54.540Z",
                      "updatedAt": "2023-06-30T12:30:54.541Z"
                    }
                  ],
                  "totalElements": 1
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:rule:create"
            ]
          }
        ]
      }
    },
    "/snippets/{snippetId}": {
      "parameters": [
        {
          "name": "snippetId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "ID",
          "example": "greeter"
        }
      ],
      "get": {
        "description": "Retrieves item.",
        "responses": {
          "200": {
            "description": "Item is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "id": "d80fc8a0-c51e-4d6e-adbf-092174a29d3a",
                  "name": "greeter",
                  "description": "Greeting snippet that says 'Hi!'",
                  "expression": "function greet() {return 'Hi!'} module.exports = {greet};",
                  "createdAt": "2023-06-30T12:30:54.540Z",
                  "updatedAt": "2023-06-30T12:30:54.541Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:rule:create"
            ]
          }
        ]
      },
      "put": {
        "description": "Updates item.",
        "responses": {
          "204": {
            "description": "Item is successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:rule:create"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "greeter",
                "description": "Greeting snippet that says 'Hi!'",
                "expression": "function greet() {return 'Hi!'} module.exports = {greet};"
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes.",
        "responses": {
          "204": {
            "description": "Item is successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:rule:create"
            ]
          }
        ]
      }
    },
    "/revisions/rules": {
      "get": {
        "description": "Retrieves rule revisions.",
        "responses": {
          "200": {
            "description": "Rule revisions are successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/RuleRevisionsResponse"
                },
                "example": {
                  "totalElements": 2,
                  "content": [
                    {
                      "id": "490457cc-6987-4baf-9f63-b3c9080825d8",
                      "ruleId": "aa6c8571-2a65-4b15-bfd8-0e40b41e30a7",
                      "ruleVersion": 1,
                      "revisionType": "UPDATED",
                      "expression": "return true;",
                      "name": "simple-rule",
                      "description": "some description",
                      "state": "DISABLED",
                      "revisionedAt": "2025-06-09T10:38:57.541Z",
                      "revisionAuthorId": "anonymous"
                    },
                    {
                      "id": "41a9611c-e2a7-41bd-b81c-817a501a90a2",
                      "ruleId": "aa6c8571-2a65-4b15-bfd8-0e40b41e30a7",
                      "ruleVersion": 0,
                      "revisionType": "CREATED",
                      "expression": "return true;",
                      "name": "simple-rule",
                      "description": "some description",
                      "state": "ENABLED",
                      "revisionedAt": "2025-06-09T10:38:57.477Z",
                      "revisionAuthorId": "anonymous"
                    }
                  ]
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "rule:read"
            ]
          }
        ],
        "parameters": [
          {
            "name": "sort",
            "in": "query",
            "description": "Field to sort by.",
            "required": false,
            "schema": {
              "type": "string",
              "default": "revisionedAt",
              "enum": [
                "revisionedAt"
              ]
            },
            "example": "revisionedAt"
          },
          {
            "name": "sortOrder",
            "in": "query",
            "description": "Sort direction.",
            "required": false,
            "schema": {
              "type": "string",
              "default": "desc",
              "enum": [
                "asc",
                "desc"
              ]
            },
            "example": "desc"
          }
        ]
      }
    },
    "/scheduled-rule-executions": {
      "get": {
        "description": "Retrieves scheduled rule executions.",
        "responses": {
          "200": {
            "description": "Scheduled rule executions are successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ScheduledRuleExecutionsResponse"
                },
                "example": {
                  "content": [
                    {
                      "id": "a1b2c3d4-e5f6-7890-abcd-ef1234567890",
                      "actionId": "b2c3d4e5-f6a7-8901-bcde-f12345678901",
                      "ruleId": "c3d4e5f6-a7b8-9012-cdef-123456789012",
                      "executeAt": "2023-06-30T12:30:54.540Z",
                      "endpointId": "d4e5f6a7-b8c9-0123-defa-234567890123",
                      "runOnEntityType": "ENDPOINT",
                      "runOnEntityId": "e5f6a7b8-c9d0-1234-efab-345678901234",
                      "createdAt": "2023-06-29T10:00:00.000Z"
                    }
                  ],
                  "totalElements": 1
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:scheduled-rule-execution:read"
            ]
          }
        ]
      },
      "delete": {
        "description": "Deletes scheduled rule executions.",
        "responses": {
          "204": {
            "description": "Scheduled rule executions are successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:scheduled-rule-execution:delete"
            ]
          }
        ],
        "parameters": [
          {
            "name": "beforeDate",
            "in": "query",
            "description": "Date and time in ISO format to delete scheduled rule executions created before. If not provided, defaults to the current time.",
            "required": false,
            "schema": {
              "type": "datetime"
            },
            "example": "2023-06-30T12:30:54.540000+00:00"
          },
          {
            "name": "executionStatus",
            "in": "query",
            "description": "Execution statuses to filter by. Only scheduled rule executions with the specified statuses will be deleted.\nAllowed values: `IN_PROGRESS`, `SUCCESS`, `FAILURE`, `SKIPPED`.\nDefaults to `SUCCESS` if not provided.\n",
            "required": false,
            "schema": {
              "type": "string[]"
            },
            "example": [
              "SUCCESS",
              "FAILURE"
            ]
          }
        ]
      }
    },
    "/scheduled-rule-executions/{scheduledRuleExecutionId}": {
      "parameters": [
        {
          "name": "scheduledRuleExecutionId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Scheduled rule execution ID."
        }
      ],
      "delete": {
        "description": "Deletes a scheduled rule execution.",
        "responses": {
          "204": {
            "description": "Scheduled rule execution is successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:scheduled-rule-execution:delete"
            ]
          }
        ]
      }
    },
    "/protobuf-schemas": {
      "post": {
        "description": "Creates a new protobuf schema.",
        "responses": {
          "201": {
            "description": "Protobuf schema is successfully created.",
            "headers": {
              "Location": {
                "description": "URI in format `{schema}://{host}/re/api/v1/protobuf-schemas/{schemaId}`",
                "schema": {
                  "type": "string"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:rule:create"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "my-schema",
                "schema": "syntax = \"proto2\"; message MyMessage { optional string foo = 1; optional int32 bar = 2; }"
              }
            }
          }
        }
      },
      "get": {
        "description": "Retrieves protobuf schemas.",
        "responses": {
          "200": {
            "description": "Protobuf schemas are successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "content": [
                    {
                      "id": "024c1cec-edde-4f29-a0f7-4e86aabd43b0",
                      "name": "my-schema",
                      "schema": "syntax = \"proto2\"; message MyMessage { optional string foo = 1; optional int32 bar = 2; }",
                      "createdAt": "2023-06-30T12:30:54.540Z",
                      "updatedAt": "2023-06-30T12:30:54.541Z"
                    }
                  ],
                  "totalElements": 1
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:rule:create"
            ]
          }
        ],
        "parameters": [
          {
            "name": "name",
            "in": "query",
            "description": "Schema name. Supports partial match.",
            "required": false,
            "schema": {
              "type": "string"
            },
            "example": "my-schema"
          }
        ]
      }
    },
    "/protobuf-schemas/{schemaId}": {
      "parameters": [
        {
          "name": "schemaId",
          "in": "path",
          "required": true,
          "schema": {
            "type": "string"
          },
          "description": "Protobuf schema ID"
        }
      ],
      "get": {
        "description": "Retrieves a protobuf schema by ID.",
        "responses": {
          "200": {
            "description": "Protobuf schema is successfully retrieved.",
            "content": {
              "application/json": {
                "schema": {
                  "type": "object"
                },
                "example": {
                  "id": "024c1cec-edde-4f29-a0f7-4e86aabd43b0",
                  "name": "my-schema",
                  "schema": "syntax = \"proto2\"; message MyMessage { optional string foo = 1; optional int32 bar = 2; }",
                  "createdAt": "2023-06-30T12:30:54.540Z",
                  "updatedAt": "2023-06-30T12:30:54.541Z"
                }
              }
            }
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:rule:create"
            ]
          }
        ]
      },
      "put": {
        "description": "Updates a protobuf schema.",
        "responses": {
          "204": {
            "description": "Protobuf schema is successfully updated."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:rule:create"
            ]
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object"
              },
              "example": {
                "name": "my-schema",
                "schema": "syntax = \"proto2\"; message MyMessage { optional string foo = 1; optional int32 bar = 2; }"
              }
            }
          }
        }
      },
      "delete": {
        "description": "Deletes a protobuf schema.",
        "responses": {
          "204": {
            "description": "Protobuf schema is successfully deleted."
          }
        },
        "security": [
          {
            "oauth_2_0": [
              "tenant:rule:create"
            ]
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "oauth_2_0": {
        "type": "oauth2",
        "description": "RE supports OAuth 2.0 for authenticating all API requests.\n",
        "flows": {
          "implicit": {
            "authorizationUrl": "https://auth.example.com/oauth/authorize",
            "scopes": {}
          }
        }
      }
    },
    "schemas": {
      "UpsertRuleRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Rule name."
          },
          "description": {
            "type": "string",
            "description": "Rule description."
          },
          "expression": {
            "type": "string",
            "description": "Rule expression."
          },
          "state": {
            "type": "string",
            "description": "Enables or disables the rule.",
            "enum": [
              "ENABLED",
              "DISABLED"
            ]
          },
          "uiMetadata": {
            "type": "string",
            "description": "UI metadata."
          },
          "espEnabled": {
            "type": "boolean",
            "description": "Enables or disables direct rule execution via ESP (Extension Service Protocol)."
          },
          "traceEnabled": {
            "type": "boolean",
            "description": "Enables or disables trace writing for this rule."
          }
        },
        "required": [
          "name",
          "expression"
        ]
      },
      "Statistics": {
        "type": "object",
        "properties": {
          "minDuration": {
            "type": "integer",
            "description": "Minimal execution duration in milliseconds.",
            "format": "int64"
          },
          "maxDuration": {
            "type": "integer",
            "description": "Maximal execution duration in milliseconds.",
            "format": "int64"
          },
          "avgDuration": {
            "type": "integer",
            "description": "Average execution duration in milliseconds.",
            "format": "int64"
          },
          "lastDuration": {
            "type": "integer",
            "description": "Duration of the last execution in milliseconds.",
            "format": "int64"
          },
          "count": {
            "type": "integer",
            "description": "Number of executions.",
            "format": "int64"
          }
        }
      },
      "RuleResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Rule ID."
          },
          "name": {
            "type": "string",
            "description": "Rule name."
          },
          "description": {
            "type": "string",
            "description": "Rule description."
          },
          "expression": {
            "type": "string",
            "description": "Rule expression."
          },
          "state": {
            "type": "string",
            "description": "Enables or disables the rule.",
            "enum": [
              "ENABLED",
              "DISABLED"
            ]
          },
          "uiMetadata": {
            "type": "string",
            "description": "UI metadata."
          },
          "espEnabled": {
            "type": "boolean",
            "description": "Whether direct rule execution via ESP (Extension Service Protocol) is enabled."
          },
          "traceEnabled": {
            "type": "boolean",
            "description": "Whether trace writing is enabled for this rule."
          },
          "statistics": {
            "$ref": "#/components/schemas/Statistics"
          },
          "version": {
            "type": "number",
            "description": "Rule version."
          },
          "createdAt": {
            "type": "string",
            "format": "rfc3339",
            "description": "Timestamp in ISO 8601 format (UTC timezone) showing when the rule was created."
          },
          "updatedAt": {
            "type": "string",
            "format": "rfc3339",
            "description": "Timestamp in ISO 8601 format (UTC timezone) showing when the rule was last updated."
          }
        },
        "required": [
          "id",
          "name",
          "expression",
          "espEnabled",
          "traceEnabled",
          "version",
          "createdAt",
          "updatedAt"
        ]
      },
      "RulesResponse": {
        "type": "object",
        "properties": {
          "totalElements": {
            "type": "integer",
            "description": "Total number of elements available for retrieval."
          },
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RuleResponse"
            }
          }
        },
        "required": [
          "totalElements"
        ]
      },
      "TraceResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Trace record ID. Unique for each trace record."
          },
          "traceId": {
            "type": "string",
            "description": "Trace ID. Common for the whole rule execution chain including attached to this rule actions and rule itself."
          },
          "entityType": {
            "type": "string",
            "description": "Entity type that produced the trace.",
            "enum": [
              "RULE",
              "COMMAND_INVOCATION_ACTION",
              "DATA_SAMPLE_ACTION",
              "METADATA_UPDATE_ACTION",
              "RULE_EXECUTION_ACTION",
              "WEBHOOK_ACTION",
              "RULE_ACTION",
              "TIME_SERIES_ACTION",
              "ALERT_ACTIVATION_ACTION",
              "ALERT_RESOLUTION_ACTION",
              "SEND_EMAIL_ACTION"
            ]
          },
          "entityId": {
            "type": "string",
            "description": "Entity ID that produced the trace."
          },
          "raisedOnEntityType": {
            "type": "string",
            "description": "Entity type that trace was raised on.",
            "enum": [
              "ENDPOINT",
              "ON_DEMAND"
            ]
          },
          "raisedOnEntityId": {
            "type": "string",
            "description": "Entity ID that trace was raised on."
          },
          "outcome": {
            "type": "string",
            "description": "Execution outcome.",
            "enum": [
              "FAILURE",
              "SUCCESS"
            ]
          },
          "stage": {
            "type": "string",
            "description": "Stage on which trace was taken in case outcome equal to FAILURE."
          },
          "reason": {
            "type": "string",
            "description": "Outcome reason."
          },
          "metadata": {
            "type": "object",
            "description": "Additional metadata. Beside the entity specific keys it may contain:\n- \"console.log_N\" with the messages logged from the expression,\n- \"httpRequestCount\" with the number of outbound HTTP requests performed with the\n\"ctx.toolbox.httpClient\" during the traced execution. The counter reflects wire level\nrequests, so a request that was retried with a refreshed platform token is counted twice.\nThe key is omitted when no requests were performed.\n"
          }
        },
        "required": [
          "id",
          "traceId",
          "entityType",
          "entityId",
          "raisedOnEntityType",
          "raisedOnEntityId",
          "outcome"
        ]
      },
      "OnDemandRuleExecutionResponse": {
        "type": "object",
        "properties": {
          "traces": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TraceResponse"
            },
            "description": "Traces."
          },
          "returnedValue": {
            "type": "string",
            "description": "Returned from rule value."
          }
        },
        "required": [
          "traces",
          "returnedValue"
        ]
      },
      "AttachedAction": {
        "type": "object",
        "properties": {
          "actionId": {
            "type": "string",
            "description": "Action ID."
          },
          "actionType": {
            "type": "string",
            "description": "Action type.",
            "enum": [
              "COMMAND_INVOCATION",
              "METADATA_UPDATE",
              "WEBHOOK",
              "RULE_EXECUTION",
              "DATA_SAMPLE",
              "TIME_SERIES",
              "ALERT_ACTIVATION",
              "ALERT_RESOLUTION",
              "SEND_EMAIL"
            ]
          }
        },
        "required": [
          "actionId",
          "actionType"
        ]
      },
      "AttachedActions": {
        "type": "object",
        "properties": {
          "positiveActions": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AttachedAction"
            }
          },
          "negativeActions": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        },
        "required": [
          "positiveActions",
          "negativeActions"
        ]
      },
      "AttachedActionsRequest": {
        "type": "object",
        "properties": {
          "positiveActions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "negativeActions": {
            "type": "array",
            "items": {
              "type": "string"
            }
          }
        },
        "required": [
          "positiveActions",
          "negativeActions"
        ]
      },
      "PatchTriggerRequest": {
        "type": "object",
        "properties": {
          "add": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Trigger IDs to add."
          },
          "remove": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Trigger IDs to remove."
          }
        },
        "required": [
          "add",
          "remove"
        ]
      },
      "UpsertCommandActionRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Action name."
          },
          "description": {
            "type": "string",
            "description": "Action description."
          },
          "endpointIdExpression": {
            "type": "string",
            "description": "Endpoint ID expression."
          },
          "commandType": {
            "type": "string",
            "description": "Command type."
          },
          "commandPayloadExpression": {
            "type": "string",
            "description": "Command payload expression."
          }
        },
        "required": [
          "name",
          "endpointIdExpression",
          "commandType"
        ]
      },
      "CommandActionResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Action ID."
          },
          "name": {
            "type": "string",
            "description": "Action name."
          },
          "description": {
            "type": "string",
            "description": "Action description."
          },
          "endpointIdExpression": {
            "type": "string",
            "description": "Endpoint ID expression."
          },
          "commandType": {
            "type": "string",
            "description": "Command type."
          },
          "commandPayloadExpression": {
            "type": "string",
            "description": "Command payload expression."
          },
          "statistics": {
            "type": "object",
            "description": "Action statistics."
          },
          "createdAt": {
            "type": "string",
            "format": "rfc3339",
            "description": "Timestamp in ISO 8601 format (UTC timezone) showing when the rule was created."
          },
          "updatedAt": {
            "type": "string",
            "format": "rfc3339",
            "description": "Timestamp in ISO 8601 format (UTC timezone) showing when the rule was last updated."
          }
        },
        "required": [
          "id",
          "name",
          "endpointIdExpression",
          "commandType",
          "createdAt",
          "updatedAt"
        ]
      },
      "CommandActionsResponse": {
        "type": "object",
        "properties": {
          "totalElements": {
            "type": "integer",
            "description": "Total number of elements available for retrieval."
          },
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/CommandActionResponse"
            }
          }
        },
        "required": [
          "totalElements"
        ]
      },
      "UpsertMetadataUpdateActionRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Action name."
          },
          "description": {
            "type": "string",
            "description": "Action description."
          },
          "endpointIdExpression": {
            "type": "string",
            "description": "Endpoint ID expression."
          },
          "metadataKeyExpression": {
            "type": "string",
            "description": "Metadata key expression to update key."
          },
          "metadataValueExpression": {
            "type": "string",
            "description": "Metadata value expression."
          }
        },
        "required": [
          "name",
          "endpointIdExpression",
          "metadataKeyExpression",
          "metadataValueExpression"
        ]
      },
      "MetadataUpdateActionResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Action ID."
          },
          "name": {
            "type": "string",
            "description": "Action name."
          },
          "description": {
            "type": "string",
            "description": "Action description."
          },
          "endpointIdExpression": {
            "type": "string",
            "description": "Endpoint ID expression."
          },
          "metadataKeyExpression": {
            "type": "string",
            "description": "Metadata key expression to update key"
          },
          "metadataValueExpression": {
            "type": "string",
            "description": "Metadata value expression."
          },
          "statistics": {
            "type": "object",
            "description": "Action statistics."
          },
          "createdAt": {
            "type": "string",
            "format": "rfc3339",
            "description": "Timestamp in ISO 8601 format (UTC timezone) showing when the action was created."
          },
          "updatedAt": {
            "type": "string",
            "format": "rfc3339",
            "description": "Timestamp in ISO 8601 format (UTC timezone) showing when the action was last updated."
          }
        },
        "required": [
          "id",
          "name",
          "endpointIdExpression",
          "metadataKeyExpression",
          "metadataValueExpression",
          "createdAt",
          "updatedAt"
        ]
      },
      "MetadataUpdateActionsResponse": {
        "type": "object",
        "properties": {
          "totalElements": {
            "type": "integer",
            "description": "Total number of elements available for retrieval."
          },
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/MetadataUpdateActionResponse"
            }
          }
        },
        "required": [
          "totalElements"
        ]
      },
      "RetryConfig": {
        "type": "object",
        "properties": {
          "maxAttempts": {
            "type": "integer",
            "description": "Maximum number of retry attempts. Must be between 1 and 5."
          },
          "timeoutMs": {
            "type": "integer",
            "description": "Initial timeout in milliseconds between retry attempts. Must be between 100 and 60000."
          },
          "backoffMultiplier": {
            "type": "number",
            "description": "Backoff multiplier for exponential retry. Must be between 2 and 10. Default is 2.0 (exponential backoff). Each retry waits backoffMultiplier times longer than the previous attempt."
          }
        }
      },
      "UpsertWebhookActionRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Action name."
          },
          "description": {
            "type": "string",
            "description": "Action description."
          },
          "webhookUrl": {
            "type": "string",
            "description": "Webhook URL. Can can be defined as both constant string or JS expression."
          },
          "headersExpression": {
            "type": "string",
            "description": "Webhook HTTP headers expression."
          },
          "webhookPayloadExpression": {
            "type": "string",
            "description": "Webhook payload expression."
          },
          "retryConfig": {
            "$ref": "#/components/schemas/RetryConfig"
          }
        },
        "required": [
          "name",
          "webhookUrl"
        ]
      },
      "WebhookActionsResponse": {
        "type": "object",
        "properties": {
          "totalElements": {
            "type": "integer",
            "description": "Total number of elements available for retrieval."
          },
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UpsertWebhookActionRequest"
            }
          }
        },
        "required": [
          "totalElements"
        ]
      },
      "UpsertRuleExecutionActionRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Action name."
          },
          "description": {
            "type": "string",
            "description": "Action description."
          },
          "ruleId": {
            "type": "string",
            "description": "The ID of the rule to execute."
          },
          "executeAtExpression": {
            "type": "string",
            "description": "Expression that returns the timestamp when the referenced rule must be executed."
          },
          "endpointIdExpression": {
            "type": "string",
            "description": "Expression that returns the endpoint ID for the rule execution."
          }
        },
        "required": [
          "name",
          "ruleId"
        ]
      },
      "RuleExecutionActionResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Action ID."
          },
          "name": {
            "type": "string",
            "description": "Action name."
          },
          "description": {
            "type": "string",
            "description": "Action description."
          },
          "ruleId": {
            "type": "string",
            "description": "The ID of the rule to execute."
          },
          "executeAtExpression": {
            "type": "string",
            "description": "Expression that returns the timestamp when the referenced rule must be executed."
          },
          "endpointIdExpression": {
            "type": "string",
            "description": "Expression that returns the endpoint ID for the rule execution."
          },
          "statistics": {
            "type": "object",
            "description": "Action statistics."
          },
          "createdAt": {
            "type": "string",
            "format": "rfc3339",
            "description": "Timestamp in ISO 8601 format (UTC timezone) showing when the action was created."
          },
          "updatedAt": {
            "type": "string",
            "format": "rfc3339",
            "description": "Timestamp in ISO 8601 format (UTC timezone) showing when the action was last updated."
          }
        },
        "required": [
          "id",
          "name",
          "ruleId",
          "createdAt",
          "updatedAt"
        ]
      },
      "RuleExecutionActionsResponse": {
        "type": "object",
        "properties": {
          "totalElements": {
            "type": "integer",
            "description": "Total number of elements available for retrieval."
          },
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RuleExecutionActionResponse"
            }
          }
        },
        "required": [
          "totalElements"
        ]
      },
      "UpsertDataSampleActionRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Action name."
          },
          "description": {
            "type": "string",
            "description": "Action description."
          },
          "endpointIdExpression": {
            "type": "string",
            "description": "The expression that returns the endpoint ID to send data samples on behalf of."
          },
          "dataSamplesExpression": {
            "type": "string",
            "description": "Expression that returns data sample(s) to send."
          }
        },
        "required": [
          "name",
          "endpointIdExpression",
          "dataSamplesExpression"
        ]
      },
      "DataSampleActionResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Action ID."
          },
          "name": {
            "type": "string",
            "description": "Action name."
          },
          "description": {
            "type": "string",
            "description": "Action description."
          },
          "endpointIdExpression": {
            "type": "string",
            "description": "The expression that returns the endpoint ID to send data samples on behalf of."
          },
          "dataSamplesExpression": {
            "type": "string",
            "description": "Expression that returns data sample(s) to send."
          },
          "statistics": {
            "type": "object",
            "description": "Action statistics."
          },
          "createdAt": {
            "type": "string",
            "format": "rfc3339",
            "description": "Timestamp in ISO 8601 format (UTC timezone) showing when the action was created."
          },
          "updatedAt": {
            "type": "string",
            "format": "rfc3339",
            "description": "Timestamp in ISO 8601 format (UTC timezone) showing when the action was last updated."
          }
        },
        "required": [
          "id",
          "name",
          "endpointIdExpression",
          "dataSamplesExpression",
          "createdAt",
          "updatedAt"
        ]
      },
      "DataSampleActionsResponse": {
        "type": "object",
        "properties": {
          "totalElements": {
            "type": "integer",
            "description": "Total number of elements available for retrieval."
          },
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DataSampleActionResponse"
            }
          }
        },
        "required": [
          "totalElements"
        ]
      },
      "UpsertTimeSeriesEventActionRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Action name."
          },
          "description": {
            "type": "string",
            "description": "Action description."
          },
          "endpointIdExpression": {
            "type": "string",
            "description": "The expression that returns the endpoint ID to send time series on behalf of."
          },
          "timeSeriesNameExpression": {
            "type": "string",
            "description": "The expression that returns the time series name."
          },
          "timeSeriesExpression": {
            "type": "string",
            "description": "Expression that returns time series data to send."
          },
          "uiMetadata": {
            "type": "string",
            "description": "UI metadata."
          }
        },
        "required": [
          "name",
          "endpointIdExpression",
          "timeSeriesNameExpression",
          "timeSeriesExpression"
        ]
      },
      "TimeSeriesEventActionResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Action ID."
          },
          "name": {
            "type": "string",
            "description": "Action name."
          },
          "description": {
            "type": "string",
            "description": "Action description."
          },
          "endpointIdExpression": {
            "type": "string",
            "description": "The expression that returns the endpoint ID to send time series on behalf of."
          },
          "timeSeriesNameExpression": {
            "type": "string",
            "description": "The expression that returns the time series name."
          },
          "timeSeriesExpression": {
            "type": "string",
            "description": "Expression that returns time series data to send."
          },
          "uiMetadata": {
            "type": "string",
            "description": "UI metadata."
          },
          "statistics": {
            "type": "object",
            "description": "Action statistics."
          },
          "createdAt": {
            "type": "string",
            "format": "rfc3339",
            "description": "Timestamp in ISO 8601 format (UTC timezone) showing when the action was created."
          },
          "updatedAt": {
            "type": "string",
            "format": "rfc3339",
            "description": "Timestamp in ISO 8601 format (UTC timezone) showing when the action was last updated."
          }
        },
        "required": [
          "id",
          "name",
          "endpointIdExpression",
          "timeSeriesNameExpression",
          "timeSeriesExpression",
          "createdAt",
          "updatedAt"
        ]
      },
      "TimeSeriesEventActionsResponse": {
        "type": "object",
        "properties": {
          "totalElements": {
            "type": "integer",
            "description": "Total number of elements available for retrieval."
          },
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/TimeSeriesEventActionResponse"
            }
          }
        },
        "required": [
          "totalElements"
        ]
      },
      "UpsertActionRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Action name."
          },
          "description": {
            "type": "string",
            "description": "Action description."
          },
          "recipientsExpression": {
            "type": "string",
            "description": "Email recipients."
          },
          "subjectExpression": {
            "type": "string",
            "description": "Email subject expression."
          },
          "textExpression": {
            "type": "string",
            "description": "Email text expression."
          },
          "attachmentExpression": {
            "type": "string",
            "description": "Email attachment expression. Allows adding an attachment to the email, for example, CSV file that will be created by this expression.\n<br>Expression should return JSON string with 3 fields:\n<br> * fileName - name of file. For example: \"temperature_report.txt\"\n<br> * type - MIME type of file. For example: \"text/plain\". Common media types can be found here https://developer.mozilla.org/en-US/docs/Web/HTTP/Guides/MIME_types/Common_types\n<br> * payload - base64 encoded file payload. For example: \"VGVtcGVyYXR1cmUgYWxlcnQgZm9yIHNlbnNvciAy\" for original file payload \"Temperature alert for sensor 2\"\n"
          },
          "contentType": {
            "type": "string",
            "description": "Email content type.",
            "enum": [
              "TEXT",
              "HTML"
            ]
          },
          "uiMetadata": {
            "type": "string",
            "description": "UI metadata."
          }
        },
        "required": [
          "name",
          "recipientsExpression",
          "subjectExpression",
          "textExpression"
        ]
      },
      "ActionResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Action ID."
          },
          "name": {
            "type": "string",
            "description": "Action name."
          },
          "description": {
            "type": "string",
            "description": "Action description."
          },
          "recipientsExpression": {
            "type": "string",
            "description": "Email recipients."
          },
          "subjectExpression": {
            "type": "string",
            "description": "Email subject expression."
          },
          "textExpression": {
            "type": "string",
            "description": "Email text expression."
          },
          "attachmentExpression": {
            "type": "string",
            "description": "Email attachment expression."
          },
          "contentType": {
            "type": "string",
            "description": "Email content type.",
            "enum": [
              "TEXT",
              "HTML"
            ]
          },
          "uiMetadata": {
            "type": "string",
            "description": "UI metadata."
          },
          "statistics": {
            "type": "object",
            "description": "Action statistics."
          },
          "createdAt": {
            "type": "string",
            "format": "rfc3339",
            "description": "Timestamp in ISO 8601 format (UTC timezone) showing when the action was created."
          },
          "updatedAt": {
            "type": "string",
            "format": "rfc3339",
            "description": "Timestamp in ISO 8601 format (UTC timezone) showing when the action was last updated."
          }
        },
        "required": [
          "id",
          "name",
          "recipientsExpression",
          "subjectExpression",
          "textExpression",
          "contentType",
          "createdAt",
          "updatedAt"
        ]
      },
      "ActionsResponse": {
        "type": "object",
        "properties": {
          "totalElements": {
            "type": "integer",
            "description": "Total number of elements available for retrieval."
          },
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ActionResponse"
            }
          }
        },
        "required": [
          "totalElements"
        ]
      },
      "ExpressionEvaluationRequest": {
        "type": "object",
        "properties": {
          "expression": {
            "type": "string",
            "description": "Expression to evaluate."
          },
          "endpointMetadata": {
            "description": "Endpoint metadata to run evaluation against."
          },
          "childrenEndpoints": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Children endpoints to run evaluation against."
          }
        },
        "required": [
          "expression"
        ]
      },
      "UpsertTriggerRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Trigger name."
          },
          "description": {
            "type": "string",
            "description": "Trigger description."
          },
          "cron": {
            "type": "string",
            "description": "Cron expression."
          },
          "timeZoneId": {
            "type": "string",
            "description": "Time zone ID."
          },
          "appName": {
            "type": "string",
            "description": "Application name of the endpoint(s) that trigger will react on."
          },
          "appVersionName": {
            "type": "string",
            "description": "Application version of the endpoint(s) that trigger will react on."
          },
          "endpointIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Endpoint IDs that trigger will react on."
          },
          "endpointFilterIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "EPR endpoint filter IDs. \nEndpoints matching these filters are resolved at trigger execution time.\n"
          },
          "parallelism": {
            "type": "number",
            "description": "Parallelism with which rule will be run for matching endpoints."
          },
          "delayBetweenRuleExecutionsMillis": {
            "type": "number",
            "description": "Delay between rule execution for each endpoint."
          },
          "uiMetadata": {
            "type": "string",
            "description": "UI metadata."
          }
        },
        "required": [
          "name",
          "cron",
          "timeZoneId"
        ]
      },
      "TriggersResponse": {
        "type": "object",
        "properties": {
          "totalElements": {
            "type": "integer",
            "description": "Total number of elements available for retrieval."
          },
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UpsertTriggerRequest"
            }
          }
        },
        "required": [
          "totalElements"
        ]
      },
      "AlertResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Alert ID."
          },
          "alertType": {
            "type": "string",
            "description": "Alert type.",
            "pattern": "^[a-zA-Z0-9_]{3,50}+$"
          },
          "acknowledgement": {
            "type": "string",
            "description": "Alert acknowledgement.",
            "enum": [
              "UNACKNOWLEDGED",
              "ACKNOWLEDGED"
            ]
          },
          "severityLevel": {
            "type": "string",
            "description": "Alert severity level.",
            "enum": [
              "INFO",
              "LOW",
              "MEDIUM",
              "HIGH",
              "CRITICAL"
            ]
          },
          "state": {
            "type": "string",
            "description": "Alert state.",
            "enum": [
              "ACTIVE",
              "RESOLVED"
            ]
          },
          "entityType": {
            "type": "string",
            "description": "Type of an entity that alert relates to.",
            "enum": [
              "ENDPOINT",
              "TENANT"
            ]
          },
          "entityId": {
            "type": "string",
            "description": "Entity ID that alert relates to."
          },
          "activateReason": {
            "type": "string",
            "description": "Alert activation reason."
          },
          "resolveReason": {
            "type": "string",
            "description": "Alert resolution reason."
          },
          "transitionReason": {
            "type": "string",
            "description": "Reason provided during the last acknowledgement transition."
          },
          "entityMetadata": {
            "type": "string",
            "description": "Entity metadata in the moment when it was last time active."
          },
          "activationMetadata": {
            "type": "string",
            "description": "Activation metadata."
          },
          "resolutionMetadata": {
            "type": "string",
            "description": "Resolution metadata."
          },
          "relationTree": {
            "type": "string",
            "description": "Snapshot of asset topology tree at alert creation time."
          },
          "alertSettingIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Alert setting IDs that raised that alert."
          },
          "startedAt": {
            "type": "string",
            "format": "rfc3339",
            "description": "Timestamp in ISO 8601 format (UTC timezone) showing when the alert started."
          },
          "lastActiveAt": {
            "type": "string",
            "format": "rfc3339",
            "description": "Timestamp in ISO 8601 format (UTC timezone) showing when the alert was last active."
          }
        },
        "required": [
          "id",
          "alertType",
          "acknowledgement",
          "severityLevel",
          "state",
          "entityType",
          "entityId",
          "activateReason",
          "alertSettingIds",
          "startedAt",
          "lastActiveAt"
        ]
      },
      "AlertsResponse": {
        "type": "object",
        "properties": {
          "totalElements": {
            "type": "integer",
            "description": "Total number of elements available for retrieval."
          },
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AlertResponse"
            }
          }
        },
        "required": [
          "totalElements"
        ]
      },
      "KeyValueFilter": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "Key.\nPossible values:\n- `acknowledgement`\n- `severityLevel`\n- `alertType`\n- `activateReason`\n- `resolveReason`\n- `state`\n- `alertSettingId`\n- `startedAt`\n- `lastActiveAt`\n- `activationMetadata.{json-path}` - e.g., `activationMetadata.location.name`\n- `resolutionMetadata.{json-path}` - e.g., `resolutionMetadata.location.name`\n- `entityMetadata.{json-path}` - e.g., `entityMetadata.location.name`\n- `systemMetadata.{json-path}` - e.g., `systemMetadata.appName`\n- `relationTree.contains` - filter by CONTAINS relation (entity IDs)\n- `relationTree.isContainedBy` - filter by IS_CONTAINED_BY relation (entity IDs)\n- `relationTree.supports` - filter by SUPPORTS relation (entity IDs)\n- `relationTree.isSupportedBy` - filter by IS_SUPPORTED_BY relation (entity IDs)\n- `relationTree.manages` - filter by MANAGES relation (entity IDs)\n- `relationTree.isManagedBy` - filter by IS_MANAGED_BY relation (entity IDs)\n- `relationTree.controls` - filter by CONTROLS relation (entity IDs)\n- `relationTree.isControlledBy` - filter by IS_CONTROLLED_BY relation (entity IDs)\n"
          },
          "values": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Values that the key will be tested against. \nSupports `null` to match records where the field is not set.\n"
          },
          "operator": {
            "type": "string",
            "description": "- IN - matches alert only if its key is equal to one of the values. Use `null` in values to match records where the field is null (e.g., `\"values\": [null]` or `\"values\": [null, \"some-value\"]`).\n- GT_EQ - matches alert if its key is greater than or equal to the value.\n- LT_EQ - matches alert if its key is less than or equal to the value.\n- IN_REGEX - matches alert only if its key matches one of the regex patterns.\n",
            "enum": [
              "IN",
              "GT_EQ",
              "LT_EQ",
              "IN_REGEX"
            ]
          },
          "and": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "And."
          },
          "or": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Or."
          }
        },
        "required": [
          "key",
          "values",
          "and",
          "or"
        ]
      },
      "Filter": {
        "type": "object",
        "properties": {
          "and": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/KeyValueFilter"
            },
            "description": "And."
          },
          "or": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Or."
          }
        },
        "required": [
          "and",
          "or"
        ]
      },
      "DeleteRequest": {
        "type": "object",
        "properties": {
          "entityIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Entity IDs that alert raised on."
          },
          "entityType": {
            "type": "string",
            "description": "Type of an entity that alert raised on.",
            "enum": [
              "ENDPOINT"
            ]
          },
          "filter": {
            "$ref": "#/components/schemas/Filter"
          }
        },
        "required": [
          "entityType"
        ]
      },
      "Sort": {
        "type": "object",
        "properties": {
          "key": {
            "type": "string",
            "description": "Sorting key."
          },
          "direction": {
            "type": "object",
            "description": "Sort direction.",
            "enum": [
              "ASC",
              "DESC"
            ]
          }
        }
      },
      "Page": {
        "type": "object",
        "properties": {
          "page": {
            "type": "integer",
            "description": "Page number."
          },
          "size": {
            "type": "integer",
            "description": "Page size."
          }
        }
      },
      "Search": {
        "type": "object",
        "properties": {
          "entityIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Entity IDs that alert raised on."
          },
          "entityType": {
            "type": "string",
            "description": "Type of an entity that alert raised on.",
            "enum": [
              "ENDPOINT",
              "TENANT"
            ]
          },
          "filter": {
            "type": "object",
            "description": "Filter."
          },
          "sort": {
            "$ref": "#/components/schemas/Sort"
          },
          "page": {
            "$ref": "#/components/schemas/Page"
          }
        },
        "required": [
          "entityType"
        ]
      },
      "ItemResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Protobuf schema ID."
          },
          "name": {
            "type": "string",
            "description": "Protobuf schema name."
          },
          "schema": {
            "type": "string",
            "description": "Protobuf schema definition in Protocol Buffers IDL format."
          },
          "createdAt": {
            "type": "string",
            "format": "rfc3339",
            "description": "Timestamp in ISO 8601 format (UTC timezone) showing when the schema was created."
          },
          "updatedAt": {
            "type": "string",
            "format": "rfc3339",
            "description": "Timestamp in ISO 8601 format (UTC timezone) showing when the schema was last updated."
          }
        },
        "required": [
          "id",
          "name",
          "schema",
          "createdAt",
          "updatedAt"
        ]
      },
      "ListResponse": {
        "type": "object",
        "properties": {
          "totalElements": {
            "type": "integer",
            "description": "Total number of elements available for retrieval."
          },
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ItemResponse"
            }
          }
        },
        "required": [
          "totalElements"
        ]
      },
      "AlertTransitionRequest": {
        "type": "object",
        "properties": {
          "status": {
            "type": "string",
            "description": "Alert status.",
            "enum": [
              "UNACKNOWLEDGED",
              "ACKNOWLEDGED"
            ]
          },
          "transitionReason": {
            "type": "string",
            "description": "Alert transition reason."
          }
        },
        "required": [
          "status"
        ]
      },
      "AlertResolutionRequest": {
        "type": "object",
        "properties": {
          "entityId": {
            "type": "string",
            "description": "Entity ID that alert raised on."
          },
          "entityType": {
            "type": "string",
            "description": "Type of an entity that alert raised on.",
            "enum": [
              "ENDPOINT",
              "TENANT"
            ]
          },
          "resolveReason": {
            "type": "string",
            "description": "Alert resolution reason."
          },
          "resolutionMetadata": {
            "type": "object",
            "description": "Resolution metadata."
          }
        },
        "required": [
          "entityId",
          "entityType"
        ]
      },
      "AlertLifecycleEvent": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Event ID."
          },
          "alertId": {
            "type": "string",
            "description": "Alert ID."
          },
          "eventType": {
            "type": "string",
            "description": "Event type.",
            "enum": [
              "SEVERITY_LEVEL_INCREASED",
              "SEVERITY_LEVEL_DECREASED",
              "CREATED",
              "ACTIVE",
              "RESOLVED",
              "ACKNOWLEDGED",
              "UNACKNOWLEDGED"
            ]
          },
          "metadata": {
            "type": "object",
            "description": "Additional custom metadata."
          },
          "systemMetadata": {
            "type": "object",
            "description": "Additional system metadata."
          },
          "timestamp": {
            "type": "string",
            "format": "rfc3339",
            "description": "Timestamp in ISO 8601 format (UTC timezone) showing when the lifecycle event happened."
          }
        },
        "required": [
          "id",
          "alertId",
          "eventType",
          "timestamp"
        ]
      },
      "TracesResponse": {
        "type": "object",
        "properties": {
          "totalElements": {
            "type": "integer",
            "description": "Total number of elements available for retrieval."
          },
          "content": {
            "type": "array",
            "items": {
              "type": "object"
            }
          }
        },
        "required": [
          "totalElements"
        ]
      },
      "AttachedTrigger": {
        "type": "object",
        "properties": {
          "triggerId": {
            "type": "string",
            "description": "Trigger ID."
          },
          "triggerType": {
            "type": "string",
            "description": "Trigger type.",
            "enum": [
              "ENDPOINT_METADATA_UPDATED",
              "ENDPOINT_TIME_SERIES_UPDATED",
              "ENDPOINT_DATA_SAMPLES_RECEIVED",
              "ALERT_LIFECYCLE_EVENT",
              "CRON",
              "RULE_EXECUTION_ACTION"
            ]
          }
        },
        "required": [
          "triggerId",
          "triggerType"
        ]
      },
      "UpsertAlertSettingRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Name."
          },
          "description": {
            "type": "string",
            "description": "Description."
          },
          "state": {
            "type": "string",
            "description": "State.",
            "enum": [
              "ENABLED",
              "DISABLED"
            ]
          },
          "uiMetadata": {
            "type": "string",
            "description": "UI metadata."
          },
          "ruleIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Rule IDs."
          },
          "actions": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Attached actions."
          },
          "triggers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AttachedTrigger"
            },
            "description": "Attached triggers."
          }
        },
        "required": [
          "name",
          "state",
          "ruleIds",
          "actions",
          "triggers"
        ]
      },
      "AlertSettingResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "ID."
          },
          "name": {
            "type": "string",
            "description": "Name."
          },
          "description": {
            "type": "string",
            "description": "Description."
          },
          "state": {
            "type": "string",
            "description": "State.",
            "enum": [
              "ENABLED",
              "DISABLED"
            ]
          },
          "uiMetadata": {
            "type": "string",
            "description": "UI metadata."
          },
          "ruleIds": {
            "type": "array",
            "items": {
              "type": "string"
            },
            "description": "Rule IDs."
          },
          "actions": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Attached actions."
          },
          "triggers": {
            "type": "array",
            "items": {
              "type": "object"
            },
            "description": "Attached triggers."
          },
          "createdAt": {
            "type": "string",
            "format": "rfc3339",
            "description": "Timestamp in ISO 8601 format (UTC timezone) showing when the record was created."
          },
          "updatedAt": {
            "type": "string",
            "format": "rfc3339",
            "description": "Timestamp in ISO 8601 format (UTC timezone) showing when the record was last updated."
          }
        },
        "required": [
          "id",
          "name",
          "state",
          "ruleIds",
          "actions",
          "triggers",
          "createdAt",
          "updatedAt"
        ]
      },
      "AlertSettingsResponse": {
        "type": "object",
        "properties": {
          "totalElements": {
            "type": "integer",
            "description": "Total number of elements available for retrieval."
          },
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AlertSettingResponse"
            }
          }
        },
        "required": [
          "totalElements"
        ]
      },
      "UpsertRequest": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "description": "Protobuf schema name. Used to reference the schema in rule expressions."
          },
          "schema": {
            "type": "string",
            "description": "Protobuf schema definition in Protocol Buffers IDL format (proto2 or proto3). Maximum size is 256 KB."
          }
        },
        "required": [
          "name",
          "schema"
        ]
      },
      "RuleRevisionResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Revision ID."
          },
          "ruleId": {
            "type": "string",
            "description": "Rule ID."
          },
          "ruleVersion": {
            "type": "number",
            "description": "Rule version."
          },
          "revisionType": {
            "type": "string",
            "description": "Revision type.",
            "enum": [
              "CREATED",
              "UPDATED",
              "DELETED"
            ]
          },
          "name": {
            "type": "string",
            "description": "Rule name."
          },
          "description": {
            "type": "string",
            "description": "Rule description."
          },
          "expression": {
            "type": "string",
            "description": "Rule expression."
          },
          "state": {
            "type": "string",
            "description": "Enables or disables the rule.",
            "enum": [
              "ENABLED",
              "DISABLED"
            ]
          },
          "revisionedAt": {
            "type": "string",
            "format": "rfc3339",
            "description": "Timestamp in ISO 8601 format (UTC timezone) showing when the revision was created."
          },
          "revisionAuthorId": {
            "type": "string",
            "description": "Revision author ID."
          }
        },
        "required": [
          "id",
          "ruleId",
          "ruleVersion",
          "name",
          "expression",
          "revisionedAt",
          "revisionAuthorId"
        ]
      },
      "RuleRevisionsResponse": {
        "type": "object",
        "properties": {
          "totalElements": {
            "type": "integer",
            "description": "Total number of elements available for retrieval."
          },
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/RuleRevisionResponse"
            }
          }
        },
        "required": [
          "totalElements"
        ]
      },
      "ScheduledRuleExecutionResponse": {
        "type": "object",
        "properties": {
          "id": {
            "type": "string",
            "description": "Scheduled execution ID."
          },
          "actionId": {
            "type": "string",
            "description": "The ID of the rule-execution action."
          },
          "ruleId": {
            "type": "string",
            "description": "The ID of the rule to execute."
          },
          "executeAt": {
            "type": "string",
            "format": "rfc3339",
            "description": "Timestamp when the rule will be executed."
          },
          "endpointId": {
            "type": "string",
            "description": "Endpoint ID for the execution context."
          },
          "runOnEntityType": {
            "type": "string",
            "description": "Entity type the rule runs on."
          },
          "runOnEntityId": {
            "type": "string",
            "description": "Entity ID the rule runs on."
          },
          "executionStatus": {
            "type": "string",
            "description": "Execution status. Null when pending.",
            "enum": [
              "IN_PROGRESS",
              "SUCCESS",
              "FAILURE",
              "SKIPPED"
            ]
          },
          "executedAt": {
            "type": "string",
            "format": "rfc3339",
            "description": "Timestamp when the scheduled execution was processed."
          },
          "createdAt": {
            "type": "string",
            "format": "rfc3339",
            "description": "Timestamp when the scheduled execution was created."
          }
        },
        "required": [
          "id",
          "actionId",
          "ruleId",
          "executeAt",
          "createdAt"
        ]
      },
      "ScheduledRuleExecutionsResponse": {
        "type": "object",
        "properties": {
          "totalElements": {
            "type": "integer",
            "description": "Total number of elements."
          },
          "content": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ScheduledRuleExecutionResponse"
            }
          }
        },
        "required": [
          "totalElements"
        ]
      },
      "ClientErrorResponse": {
        "type": "object",
        "properties": {
          "message": {
            "type": "string",
            "description": "Detailed error description."
          }
        },
        "required": [
          "message"
        ]
      },
      "RuleAction": {
        "type": "object",
        "properties": {
          "type": {
            "type": "object",
            "description": "Action type.",
            "enum": [
              "command-invocation"
            ]
          },
          "id": {
            "type": "string",
            "description": "Action ID."
          }
        },
        "required": [
          "type",
          "id"
        ]
      }
    }
  }
}