Update Rule
PUT/api/v1/rules/:name
Replace a detection rule (re-runs creation pipeline, preserves created_at).
The replacement is written as SQL, a where_clause or a condition, as on
create, and a rule replaced with SQL or a WHERE no longer carries a condition. With
no source in the body the stored one stands, read as the registered source its
table names when it names none. A source the body sets or changes must be registered,
and SQL on a registered source must read its table. A stored source no longer
registered is not checked, so the rule stays editable.
A replacement the hunt runner could not compile is refused with 422 and the
stored rule is left as it was. 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
- 200
- 401
- 403
- 422
- default
Successful Response
No valid session: the credentials are missing, invalid or expired, or the account behind them is disabled or blocked
Refused: the session lacks the action this route checks, or its account must replace an issued password first. A SCIM route answers a refused action in the RFC 7644 error envelope
Refused, nothing written. The body failed validation (code validation_error). Or the hunt runner could not compile the rule -- its SQL does not parse as one SELECT, names no <db>.<table> source, names a source that is not a table name (letters, digits, '_' and '-'), has no WHERE to detect with, or calls a function that reads outside the row (url, s3, a dictionary) or sends it to another service (the ai* functions), or carries a CEL filter that does not transpile. A source that is not a registered source is refused, and so is a where_clause that is empty, carries a {...} placeholder or a time bound, or holds more than a row filter (code invalid_sql, the errors in sql_errors). Or a search left no filter once the time bounds the hunt window owns were taken out (code rule_empty_filter, the bounds taken out in dropped_bounds). Or the rule matches every event in its source (code rule_matches_everything, the source and detection WHERE in context).
Problem details (RFC 9457)