v1
latestOpenAPI 3.0.32026-07-22238629559.2 KBPoliciesV2Service
Apply a detection policy
Strictly applies a candidate detection policy bundle for one product: the submitted bundle replaces the current state, and exceptions absent from it are deleted. Requires the current state_version in the If-Match header; responds 428 when the header is missing and 409 with the current state_version when it is stale. The apply is atomic for the product's bundle.
put/api/policies/v2/deployments/{deploymentId}/detection-policy/{product}
Path parameters
deploymentIdinteger required
The unique numerical identifier for the deployment.
Example:1234
productstring required
The product the bundle applies to. One of: code, secrets.
Example:code
Request body
Example request
{
"bundle": {
"deployment_slug": "my-org",
"product": "code",
"rulesets": [
"p/owasp-top-10",
"p/cwe-top-25"
],
"rules": [
"python.lang.security.audit.dangerous-system-call"
],
"disabled": [
"python.lang.security.audit.dangerous-eval"
],
"exceptions": [
{
"exception_type": "exclude",
"project": "my-org/legacy-svc",
"project_tag_name": "segment",
"rule": "python.lang.security.audit.dangerous-system-call",
"rule_type": "rule"
}
]
}
}Response
OK
Example response
{
"bundle": {
"deployment_slug": "my-org",
"product": "code",
"rulesets": [
"p/owasp-top-10",
"p/cwe-top-25"
],
"rules": [
"python.lang.security.audit.dangerous-system-call"
],
"disabled": [
"python.lang.security.audit.dangerous-eval"
],
"exceptions": [
{
"exception_type": "exclude",
"project": "my-org/legacy-svc",
"project_tag_name": "segment",
"rule": "python.lang.security.audit.dangerous-system-call",
"rule_type": "rule"
}
]
},
"state_version": "e5f6a7b8"
}