---
updatedAt: 2026-09-28T19:56:22.000Z
agentTools:
  projectIndex: https://docs.nebulock.io/llms.txt
---

# Validate Rule Public Api

Validate rule content without persisting a rule.

Use this to check a SQL payload before calling `POST /rules`. Send `content` as
an object with the fields for the rule's type.
The alias `rule_content` is accepted in place of `content`.

`validation_errors`, `validation_warnings` and `field_validations` are written to be
read and acted on. `debug` carries what sits behind them — the engine payload, the
statement that was checked, a ClickHouse backtrace — for reporting a problem rather
than for display; an entry there always has a readable error beside it.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Rules API",
    "description": "Public Rules API. Authenticate with API key credentials (`X-API-Key-ID` and `X-API-Key-Secret` headers on each request) when calling through the internal proxy.",
    "version": "0.0.1"
  },
  "paths": {
    "/public/v1/rules/validate": {
      "post": {
        "tags": [
          "public"
        ],
        "summary": "Validate Rule Public Api",
        "description": "Validate rule content without persisting a rule.\n\nUse this to check a SQL payload before calling `POST /rules`. Send `content` as\nan object with the fields for the rule's type.\nThe alias `rule_content` is accepted in place of `content`.\n\n`validation_errors`, `validation_warnings` and `field_validations` are written to be\nread and acted on. `debug` carries what sits behind them — the engine payload, the\nstatement that was checked, a ClickHouse backtrace — for reporting a problem rather\nthan for display; an entry there always has a readable error beside it.",
        "operationId": "validate_rule_public_api_public_v1_rules_validate_post",
        "parameters": [
          {
            "name": "X-API-Key-ID",
            "in": "header",
            "required": true,
            "schema": {
              "type": "string",
              "description": "Your API Key ID",
              "title": "X-API-Key-ID"
            },
            "description": "Your API Key ID"
          },
          {
            "name": "X-API-Key-Secret",
            "in": "header",
            "required": false,
            "schema": {
              "type": "string",
              "description": "Your API Key Secret",
              "title": "X-API-Key-Secret"
            },
            "description": "Your API Key Secret"
          }
        ],
        "requestBody": {
          "required": true,
          "content": {
            "application/json": {
              "schema": {
                "properties": {
                  "rule_type": {
                    "type": "string",
                    "enum": [
                      "scheduled_sql",
                      "signal_combination",
                      "atomic_sql",
                      "machine_learning"
                    ],
                    "title": "RuleType",
                    "description": "Supported rule types (signal generators).\n\nNOTE: signal-api's Postgres ``ruletype`` enum still carries labels this does not\nname (``SIGMA``, ``SQL``, ``STREAMING_SQL``, ``CORRELATION``). They are left in\nplace deliberately — dropping a label needs a full type rebuild — and excluded from\nalembic comparison.\n\nA stored row carrying one does not load, which is intended: no code path can\nexecute it. But it must not stop the rows around it loading either, and that does\nnot come for free — SQLAlchemy's ``Enum`` raises from its *result* processor, which\nfails the whole ``SELECT`` rather than the one row. signal-api reads this column\nthrough ``TolerantRuleTypeEnum`` (``signal_api.models.database``) for that reason.\nAnything else that maps this enum onto a stored column needs the same care."
                  },
                  "content": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "additionalProperties": true,
                        "type": "object"
                      }
                    ],
                    "title": "Content",
                    "description": "Rule content payload: an object with the fields for the rule type."
                  },
                  "title": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "title": "Title",
                    "description": "Optional title used for validation context only"
                  },
                  "description": {
                    "anyOf": [
                      {
                        "type": "string"
                      },
                      {
                        "type": "null"
                      }
                    ],
                    "title": "Description",
                    "description": "Optional description used for validation context only"
                  }
                },
                "additionalProperties": false,
                "type": "object",
                "required": [
                  "rule_type",
                  "content"
                ],
                "title": "RulePublicValidationRequest",
                "description": "Request model for public rule validation without create-time requirements."
              },
              "examples": {
                "scheduled_sql": {
                  "summary": "Validate scheduled SQL",
                  "value": {
                    "rule_type": "scheduled_sql",
                    "content": {
                      "query": "SELECT username, count(*) AS cnt FROM events GROUP BY username HAVING cnt >= 10",
                      "schedule": "*/15 * * * *",
                      "description": "Detect usernames with unusually high event volume in a 15-minute window.",
                      "entities": [
                        {
                          "entity_type": "user",
                          "entity_id": "username"
                        }
                      ],
                      "throttle": {
                        "period": "1h",
                        "entity": "username"
                      }
                    }
                  }
                },
                "atomic_sql": {
                  "summary": "Validate atomic SQL",
                  "value": {
                    "rule_type": "atomic_sql",
                    "content": {
                      "sql_query": "(ifNull(`process.file.path`, '') ILIKE '%/security') AND (ifNull(`process.command_line`, '') ILIKE '%dump-keychain%')",
                      "entities": [
                        {
                          "entity_type": "endpoint",
                          "entity_id": "endpoint.uid"
                        },
                        {
                          "entity_type": "user",
                          "entity_id": "actor.user.name"
                        }
                      ],
                      "level": "low"
                    }
                  }
                },
                "signal_combination": {
                  "summary": "Validate signal combination SQL",
                  "value": {
                    "rule_type": "signal_combination",
                    "content": {
                      "query": "SELECT entity_id, count(*) AS signal_count FROM signals WHERE created_at >= now64(3) - INTERVAL 1 DAY GROUP BY entity_id HAVING signal_count >= 2",
                      "schedule": "0 5 * * *",
                      "description": "Correlate when an entity generates at least two signals within one day."
                    }
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "Successful Response",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "data": {
                      "properties": {
                        "is_valid": {
                          "type": "boolean",
                          "title": "Is Valid",
                          "description": "Overall validation status"
                        },
                        "is_valid_sigma": {
                          "type": "boolean",
                          "title": "Is Valid Sigma",
                          "description": "DEPRECATED, always true",
                          "default": true
                        },
                        "sigma_error_message": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "title": "Sigma Error Message",
                          "description": "DEPRECATED, always null"
                        },
                        "sigma_warnings": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array",
                          "title": "Sigma Warnings",
                          "description": "DEPRECATED, always empty"
                        },
                        "is_valid_ncs": {
                          "type": "boolean",
                          "title": "Is Valid Ncs",
                          "description": "DEPRECATED, always true",
                          "default": true
                        },
                        "ncs_error_message": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "title": "Ncs Error Message",
                          "description": "DEPRECATED, always null"
                        },
                        "ncs_invalid_detection_fields": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array",
                          "title": "Ncs Invalid Detection Fields",
                          "description": "All invalid detection fields (sum of no_mapping and type_mismatch)"
                        },
                        "ncs_no_mapping_fields": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array",
                          "title": "Ncs No Mapping Fields",
                          "description": "Fields missing a mapping in NCS"
                        },
                        "ncs_type_mismatch_fields": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array",
                          "title": "Ncs Type Mismatch Fields",
                          "description": "Mapped fields with modifier/value type issues"
                        },
                        "ncs_valid_detection_fields": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array",
                          "title": "Ncs Valid Detection Fields",
                          "description": "NCS valid detection fields"
                        },
                        "ncs_description": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "title": "Ncs Description",
                          "description": "NCS validation description"
                        },
                        "ncs_recommendation": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "title": "Ncs Recommendation",
                          "description": "NCS validation recommendation"
                        },
                        "is_valid_sql": {
                          "type": "boolean",
                          "title": "Is Valid Sql",
                          "description": "Whether the rule's SQL passed validation",
                          "default": true
                        },
                        "sql_error_message": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "title": "Sql Error Message",
                          "description": "SQL validation error message"
                        },
                        "change_summary": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "title": "Change Summary",
                          "description": "hunt-api's summary of this revision; None when unavailable"
                        },
                        "validation_errors": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array",
                          "title": "Validation Errors",
                          "description": "All validation errors"
                        },
                        "validation_warnings": {
                          "items": {
                            "type": "string"
                          },
                          "type": "array",
                          "title": "Validation Warnings",
                          "description": "All validation warnings"
                        },
                        "field_validations": {
                          "additionalProperties": {
                            "additionalProperties": true,
                            "type": "object"
                          },
                          "type": "object",
                          "title": "Field Validations",
                          "description": "Field-specific validation results"
                        },
                        "debug": {
                          "items": {
                            "additionalProperties": true,
                            "type": "object"
                          },
                          "type": "array",
                          "title": "Debug",
                          "description": "Diagnostic detail for reported errors (upstream payloads, stack traces)"
                        },
                        "has_valid_retrohunt": {
                          "type": "boolean",
                          "title": "Has Valid Retrohunt",
                          "description": "Whether the rule has a valid retro hunt",
                          "default": true
                        },
                        "retrohunt_error_message": {
                          "anyOf": [
                            {
                              "type": "string"
                            },
                            {
                              "type": "null"
                            }
                          ],
                          "title": "Retrohunt Error Message",
                          "description": "Retro hunt validation error message"
                        },
                        "validated_at": {
                          "type": "string",
                          "format": "date-time",
                          "title": "Validated At",
                          "description": "When validation was performed"
                        },
                        "validation_version": {
                          "type": "string",
                          "title": "Validation Version",
                          "description": "Version of validation logic used",
                          "default": "1.0"
                        }
                      },
                      "additionalProperties": false,
                      "type": "object",
                      "required": [
                        "is_valid"
                      ],
                      "title": "ValidationResult",
                      "description": "Validation result"
                    }
                  },
                  "type": "object",
                  "required": [
                    "data"
                  ],
                  "title": "RulePublicValidationResponse",
                  "description": "Response model for public rule validation API responses"
                }
              }
            }
          },
          "422": {
            "description": "Validation Error",
            "content": {
              "application/json": {
                "schema": {
                  "properties": {
                    "detail": {
                      "items": {
                        "properties": {
                          "loc": {
                            "items": {
                              "anyOf": [
                                {
                                  "type": "string"
                                },
                                {
                                  "type": "integer"
                                }
                              ]
                            },
                            "type": "array",
                            "title": "Location"
                          },
                          "msg": {
                            "type": "string",
                            "title": "Message"
                          },
                          "type": {
                            "type": "string",
                            "title": "Error Type"
                          },
                          "input": {
                            "title": "Input"
                          },
                          "ctx": {
                            "type": "object",
                            "title": "Context"
                          }
                        },
                        "type": "object",
                        "required": [
                          "loc",
                          "msg",
                          "type"
                        ],
                        "title": "ValidationError"
                      },
                      "type": "array",
                      "title": "Detail"
                    }
                  },
                  "type": "object",
                  "title": "HTTPValidationError"
                }
              }
            }
          }
        },
        "security": [
          {
            "ApiKeyAuth": []
          },
          {
            "ApiKeySecretAuth": []
          }
        ]
      }
    }
  },
  "components": {
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key-ID",
        "description": "Your API Key ID"
      },
      "ApiKeySecretAuth": {
        "type": "apiKey",
        "in": "header",
        "name": "X-API-Key-Secret",
        "description": "Your API Key Secret"
      }
    }
  },
  "security": [
    {
      "ApiKeyAuth": []
    },
    {
      "ApiKeySecretAuth": []
    }
  ],
  "servers": [
    {
      "url": "https://api.nebulock.io"
    }
  ],
  "x-readme": {}
}
```