v1

latestOpenAPI 3.0.32026-07-22238629559.2 KB
PoliciesV2Service

Get a detection policy

Returns the detection policy bundle for one product (code or secrets), including its exceptions, plus the state_version required to apply changes. Returns 404 with code PRODUCT_NOT_ENABLED when the requested product is not enabled for the deployment.

get/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 to read the detection policy for. One of: code, secrets.

Example:code

Response

OK

state_versionstring

A content-only fingerprint of the bundle. It changes only when the bundle's content changes. Send it as the If-Match header on PUT.

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": "a1b2c3d4"
}