Skip to main content

Create Rule

POST 

/api/v1/rules

Create a new hunt rule via RuleCreationService.

The rule is written as SQL, as a where_clause on source, or as a structured condition, which the engine compiles to the SQL and stores with it. A named source must be a registered source. The service applies CEL->SQL transpilation, validates column references, and optionally estimates query cost. A rule whose SQL the hunt runner could not compile is refused with 422. A _json path the source's recent rows never carried comes back as a warning. The cost preview counts only the orgs the hunts running the rule read, cut to the orgs its author may read.

A production+team write is routed to a review branch instead of the branch the runner git-syncs, and the X-DFE-Review-Required header says so.

Request​

Responses​

Successful Response