Create Rule
POST/api/v1/rules-v2
Create a detection rule from one detection form.
The rule stores that detection and nothing about a source or a hunt. A hunt
names the rules it runs and the table they read. A full user_sql query
is reduced to its WHERE, and a match is compiled to one. A filter that
does not transpile, or a detection the hunt runner would refuse, is 422 and
nothing is written.
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
- 201
- 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): give a WHERE fragment, a CEL filter, a full user_sql query, or a match, one of them, and a WHERE fragment is not a full SQL statement. Or the detection was refused -- the WHERE fragment or the SQL does not parse, calls a function that reads outside the row (url, s3, a dictionary) or sends it to another service (the ai* functions), reads another table, the CEL filter does not transpile, or the match does not compile (code invalid_sql, the errors in sql_errors). Or the rule matches every event (code rule_matches_everything, the detection WHERE in context).
Problem details (RFC 9457)