---
updatedAt: 2026-10-28T15:16:17.000Z
agentTools:
  projectIndex: https://docs.cast.ai/llms.txt
---

# /v1/security/runtime/rules/{id}

# OpenAPI definition

```json
{
  "openapi": "3.0.1",
  "servers": [
    {
      "url": "https://api.cast.ai/",
      "description": "US endpoint"
    },
    {
      "url": "https://api.eu.cast.ai/",
      "description": "EU endpoint"
    },
    {
      "url": "https://api.india.cast.ai/",
      "description": "India endpoint"
    }
  ],
  "info": {
    "title": "CAST.AI API documentation",
    "version": "1.0.0",
    "description": "### Feature maturity indicators (may appear on resources, operations and request/response fields)\n - **(BETA)** - new or experimental features, subject to change\n - **(Deprecated)** - outdated or replaced features (a reason and removal date will be provided in the description)\n"
  },
  "tags": [
    {
      "name": "RuntimeSecurityAPI"
    }
  ],
  "security": [
    {
      "BearerAuth": []
    },
    {
      "ApiKeyAuth": []
    }
  ],
  "paths": {
    "/v1/security/runtime/rules/{id}": {
      "put": {
        "operationId": "RuntimeSecurityAPI_EditRule",
        "parameters": [
          {
            "in": "path",
            "name": "id",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/RuntimeSecurityAPI_EditRule_request"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/runtime.v1.Rule"
                }
              }
            },
            "description": ""
          }
        },
        "tags": [
          "RuntimeSecurityAPI"
        ],
        "x-codegen-request-body-name": "body"
      }
    }
  },
  "components": {
    "securitySchemes": {
      "BearerAuth": {
        "type": "http",
        "scheme": "bearer",
        "bearerFormat": "JWT"
      },
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key"
      }
    },
    "schemas": {
      "runtime.v1.ListHeader": {
        "properties": {
          "id": {
            "type": "string"
          },
          "name": {
            "type": "string"
          }
        },
        "type": "object"
      },
      "runtime.v1.Rule": {
        "properties": {
          "id": {
            "description": "id is the unique identifier of a rule.\n\nIt is a UUID v4.",
            "type": "string"
          },
          "enabled": {
            "description": "enabled indicates whether the rule is enabled or not.",
            "type": "boolean"
          },
          "name": {
            "description": "name is the name of the rule.",
            "type": "string"
          },
          "type": {
            "description": "type is the type of the rule.",
            "type": "string"
          },
          "category": {
            "description": "category is the category of the rule.",
            "type": "string"
          },
          "anomaliesCount": {
            "description": "anomalies_count shows how many anomalies are detected\nvia this rule.\n\nIt is a read_only field.",
            "format": "int32",
            "type": "integer"
          },
          "severity": {
            "$ref": "#/components/schemas/runtime.v1.Severity"
          },
          "isBuiltIn": {
            "description": "is_built_in shows whether the rule is a built-in one (defined by Cast AI)\nor defined by the user.\n\nIt is a read_only field.",
            "type": "boolean"
          },
          "resourceSelector": {
            "description": "resource_selector is an expression that is used to\ncalculate the resources this rule is enforced on.",
            "type": "string"
          },
          "ruleText": {
            "description": "rule_text is the actual rule.\nThis is what will be evaluated by the engine\nto determine whether a rule is violated or not.",
            "type": "string"
          },
          "ruleEngineType": {
            "$ref": "#/components/schemas/runtime.v1.RuleEngineType"
          },
          "labels": {
            "additionalProperties": {
              "type": "string"
            },
            "description": "labels are a set of arbitrary key-value pairs\nwhich can be set by the user.",
            "type": "object"
          },
          "usedCustomLists": {
            "items": {
              "$ref": "#/components/schemas/runtime.v1.ListHeader"
            },
            "title": "used_custom_lists contains all custom list used within the rule text",
            "type": "array"
          }
        },
        "type": "object"
      },
      "runtime.v1.RuleEngineType": {
        "default": "RULE_ENGINE_TYPE_UNKNOWN",
        "enum": [
          "RULE_ENGINE_TYPE_UNKNOWN",
          "RULE_ENGINE_TYPE_CEL",
          "RULE_ENGINE_TYPE_GO"
        ],
        "type": "string"
      },
      "runtime.v1.Severity": {
        "default": "SEVERITY_UNKNOWN",
        "enum": [
          "SEVERITY_UNKNOWN",
          "SEVERITY_NONE",
          "SEVERITY_LOW",
          "SEVERITY_MEDIUM",
          "SEVERITY_HIGH",
          "SEVERITY_CRITICAL"
        ],
        "type": "string"
      },
      "RuntimeSecurityAPI_EditRule_request": {
        "properties": {
          "enabled": {
            "type": "boolean"
          },
          "severity": {
            "$ref": "#/components/schemas/runtime.v1.Severity"
          },
          "resourceSelector": {
            "type": "string"
          },
          "ruleText": {
            "type": "string"
          },
          "labels": {
            "additionalProperties": {
              "type": "string"
            },
            "type": "object"
          }
        },
        "required": [
          "enabled",
          "severity"
        ],
        "type": "object"
      }
    }
  }
}
```