---
title: "Returns a list of Secrets rules"
method: GET
path: "/api/v2/static-analysis/secrets/rules"
tags: ["Security Monitoring"]
---

# Returns a list of Secrets rules

`GET /api/v2/static-analysis/secrets/rules`

## Request

- Base URL: `https://api.datadoghq.com`
- URL: `https://api.datadoghq.com/api/v2/static-analysis/secrets/rules`
- Auth: one of:
  - API key in header `DD-API-KEY` and API key in header `DD-APPLICATION-KEY`
  - OAuth 2
    - Authorization code: `/oauth2/v1/authorize`
    - Token URL: `/oauth2/v1/token` scopes: `code_analysis_read`

Returns a list of Secrets rules with ID, Pattern, Description, Priority, and SDS ID.

## Response `200`

OK

- SecretRuleArray: A collection of secret detection rules returned by the list endpoint.
  - `data` SecretRuleData[], required: The list of secret detection rules.
    - `attributes` SecretRuleDataAttributes: The attributes of a secret detection rule, including its pattern, priority, and validation configuration.
      - `default_included_keywords` string[]: A list of keywords that are included by default when scanning for secrets matching this rule.
      - `description` string: A detailed explanation of what type of secret this rule detects.
      - `license` string: The license under which this secret rule is distributed.
      - `match_validation` SecretRuleDataAttributesMatchValidation: Configuration for validating whether a detected secret is active by making an HTTP request and inspecting the response.
        - `endpoint` string: The URL endpoint to call when validating a detected secret.
        - `hosts` string[]: The list of hostnames to include when performing secret match validation.
        - `http_method` string: The HTTP method (e.g., GET, POST) to use when making the validation request.
        - `invalid_http_status_code` SecretRuleDataAttributesMatchValidationInvalidHttpStatusCodeItems[]: The HTTP status code ranges that indicate the detected secret is invalid or inactive.
          - `end` integer: The inclusive upper bound of the HTTP status code range.
          - `start` integer: The inclusive lower bound of the HTTP status code range.
        - `request_headers` object: A map of HTTP header names to values to include in the validation request.
        - `timeout_seconds` integer: The maximum number of seconds to wait for a response during validation before timing out.
        - `type` string: The type of match validation to perform (e.g., http).
        - `valid_http_status_code` SecretRuleDataAttributesMatchValidationValidHttpStatusCodeItems[]: The HTTP status code ranges that indicate the detected secret is valid and active.
          - `end` integer: The inclusive upper bound of the HTTP status code range.
          - `start` integer: The inclusive lower bound of the HTTP status code range.
      - `name` string: The unique name of the secret detection rule.
      - `pattern` string: The regular expression pattern used to identify potential secrets in source code or configuration.
      - `priority` string: The priority level of this rule, used to rank findings when multiple rules match.
      - `sds_id` string: The identifier of the corresponding Sensitive Data Scanner rule, if one exists.
      - `validators` string[]: A list of validator identifiers used to further confirm a detected secret is genuine.
    - `id` string: The unique identifier of the secret rule resource.
    - `type` 'secret_rule', required: Secret rule resource type.

## Other responses

- `429`: Too many requests

---

[API](https://skmtc.dev/datadog/apis/datadog-api-v2-collection.md) - [All operations](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/llms.txt) - [OpenAPI document](https://skmtc.dev/datadog/apis/datadog-api-v2-collection/revisions/da68bf029e4c?raw)
