For AI agents: A markdown version of this page is available at https://docs.datadoghq.com/api/latest/security-monitoring/ruleset-get-multiple.md. A documentation index is available at /llms.txt.

Ruleset get multiple

Note: This endpoint may be subject to changes.

POST https://api.ap1.datadoghq.com/api/v2/static-analysis/rulesetshttps://api.ap2.datadoghq.com/api/v2/static-analysis/rulesetshttps://api.datadoghq.eu/api/v2/static-analysis/rulesetshttps://api.ddog-gov.com/api/v2/static-analysis/rulesetshttps://api.us2.ddog-gov.com/api/v2/static-analysis/rulesetshttps://api.uk1.datadoghq.com/api/v2/static-analysis/rulesetshttps://api.datadoghq.com/api/v2/static-analysis/rulesetshttps://api.us3.datadoghq.com/api/v2/static-analysis/rulesetshttps://api.us5.datadoghq.com/api/v2/static-analysis/rulesets

Overview

Get rules for multiple rulesets in batch.

OAuth apps require the code_analysis_read authorization scope to access this endpoint.

Request

Body Data (required)

Expand All

Field

Type

Description

_authentication_token

string

CSRF token for security, sent by browser-based clients. Ignored by the API when absent.

data

object

The primary data object in the get-multiple-rulesets request, containing request attributes and resource type.

attributes

object

The request attributes for fetching multiple rulesets, specifying which rulesets to retrieve and what data to include.

include_testing_rules

boolean

When true, rules that are available in testing mode are included in the response.

include_tests

boolean

When true, test cases associated with each rule are included in the response.

rulesets

[string]

The list of ruleset names to retrieve.

id

string

An optional identifier for the get-multiple-rulesets request resource.

type [required]

enum

Get multiple rulesets request resource type. Allowed enum values: get_multiple_rulesets_request

default: get_multiple_rulesets_request

{
  "_authentication_token": "string",
  "data": {
    "attributes": {
      "include_testing_rules": false,
      "include_tests": false,
      "rulesets": []
    },
    "id": "string",
    "type": "get_multiple_rulesets_request"
  }
}

Response

OK

The response payload for the get-multiple-rulesets endpoint, containing the requested rulesets and their rules.

Expand All

Field

Type

Description

data [required]

object

The primary data object in the get-multiple-rulesets response, containing the response attributes and resource type.

attributes [required]

object

The attributes of the get-multiple-rulesets response, containing the list of requested rulesets.

rulesets [required]

[object]

The list of rulesets returned in response to the batch request.

description [required]

string

A detailed description of the ruleset's purpose and the types of issues it targets.

id [required]

string

The unique identifier of the ruleset, which is the same as its name.

name [required]

string

The unique name of the ruleset.

rules [required]

[object]

The list of static analysis rules included in this ruleset.

arguments [required]

[object]

The list of configurable arguments accepted by this rule.

description

string

A human-readable explanation of the argument's purpose and accepted values.

name

string

The name of the rule argument.

category [required]

string

The category classifying the type of issue this rule detects (e.g., security, style, performance).

checksum [required]

string

A checksum of the rule definition used to detect changes.

code [required]

string

The rule implementation code used by the static analysis engine.

created_at [required]

date-time

The date and time when the rule was created.

created_by [required]

string

The identifier of the user or system that created the rule.

cve

string

The CVE identifier associated with the vulnerability this rule detects, if applicable.

cwe

string

The CWE identifier associated with the weakness category this rule detects, if applicable.

description [required]

string

A detailed explanation of what the rule detects and why it matters.

documentation_url

string

A URL pointing to additional documentation for this rule.

entity_checked

string

The code entity type (e.g., function, class, variable) that this rule inspects.

id [required]

string

The unique identifier of the rule, which is the same as its name.

is_published [required]

boolean

Indicates whether the rule is publicly published and available to all users.

is_testing [required]

boolean

Indicates whether the rule is in testing mode and not yet promoted to production.

language [required]

string

The programming language this rule applies to.

last_updated_at [required]

date-time

The date and time when the rule was last modified.

last_updated_by [required]

string

The identifier of the user or system that last updated the rule.

name [required]

string

The unique name identifying this rule within its ruleset.

regex

string

A regular expression pattern used by the rule for pattern-based detection.

severity [required]

string

The severity level of findings produced by this rule (e.g., ERROR, WARNING, NOTICE).

short_description [required]

string

A brief summary of what the rule detects, suitable for display in listings.

should_use_ai_fix [required]

boolean

Indicates whether an AI-generated fix suggestion should be offered for findings from this rule.

tests [required]

[object]

The list of test cases used to validate the rule's behavior.

annotation_count

int64

The expected number of annotations (findings) the rule should produce when run against the test code.

code

string

The source code snippet used as input for the rule test.

filename

string

The filename associated with the test code snippet.

tree_sitter_query

string

The Tree-sitter query expression used by the rule to match code patterns in the AST.

type [required]

string

The rule type indicating the detection mechanism used (e.g., tree_sitter, regex).

short_description [required]

string

A brief summary of the ruleset, suitable for display in listings.

id [required]

string

The unique identifier of the get-multiple-rulesets response resource, echoed from the request.

type [required]

enum

Get multiple rulesets response resource type. Allowed enum values: get_multiple_rulesets_response

default: get_multiple_rulesets_response

{
  "data": {
    "attributes": {
      "rulesets": [
        {
          "description": "",
          "id": "",
          "name": "",
          "rules": [
            {
              "arguments": [
                {
                  "description": "string",
                  "name": "string"
                }
              ],
              "category": "",
              "checksum": "",
              "code": "",
              "created_at": "",
              "created_by": "",
              "cve": "string",
              "cwe": "string",
              "description": "",
              "documentation_url": "string",
              "entity_checked": "string",
              "id": "",
              "is_published": false,
              "is_testing": false,
              "language": "",
              "last_updated_at": "",
              "last_updated_by": "",
              "name": "",
              "regex": "string",
              "severity": "",
              "short_description": "",
              "should_use_ai_fix": false,
              "tests": [
                {
                  "annotation_count": "integer",
                  "code": "string",
                  "filename": "string"
                }
              ],
              "tree_sitter_query": "string",
              "type": ""
            }
          ],
          "short_description": ""
        }
      ]
    },
    "id": "",
    "type": "get_multiple_rulesets_response"
  }
}

Too many requests

API error response.

Expand All

Field

Type

Description

errors [required]

[string]

A list of errors.

{
  "errors": [
    "Bad Request"
  ]
}

Code Example

                  ## default
# 

# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

# Curl command
curl -X POST "https://api.ap1.datadoghq.com"https://api.ap2.datadoghq.com"https://api.datadoghq.eu"https://api.ddog-gov.com"https://api.us2.ddog-gov.com"https://api.uk1.datadoghq.com"https://api.datadoghq.com"https://api.us3.datadoghq.com"https://api.us5.datadoghq.com/api/v2/static-analysis/rulesets" \ -H "Accept: application/json" \ -H "Content-Type: application/json" \ -H "Authorization: Bearer ${DD_BEARER_TOKEN}" \ -d @- << EOF { "data": { "type": "get_multiple_rulesets_request" } } EOF
"""
Ruleset get multiple returns "OK" response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.security_monitoring_api import SecurityMonitoringApi
from datadog_api_client.v2.model.get_multiple_rulesets_request import GetMultipleRulesetsRequest
from datadog_api_client.v2.model.get_multiple_rulesets_request_data import GetMultipleRulesetsRequestData
from datadog_api_client.v2.model.get_multiple_rulesets_request_data_attributes import (
    GetMultipleRulesetsRequestDataAttributes,
)
from datadog_api_client.v2.model.get_multiple_rulesets_request_data_type import GetMultipleRulesetsRequestDataType

body = GetMultipleRulesetsRequest(
    data=GetMultipleRulesetsRequestData(
        attributes=GetMultipleRulesetsRequestDataAttributes(
            rulesets=[],
        ),
        type=GetMultipleRulesetsRequestDataType.GET_MULTIPLE_RULESETS_REQUEST,
    ),
)

configuration = Configuration()
configuration.access_token = environ["DD_BEARER_TOKEN"]
configuration.unstable_operations["list_multiple_rulesets"] = True
with ApiClient(configuration) as api_client:
    api_instance = SecurityMonitoringApi(api_client)
    response = api_instance.list_multiple_rulesets(body=body)

    print(response)

Instructions

First install the library and its dependencies and then save the example to example.py and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"
# Ruleset get multiple returns "OK" response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.access_token = ENV["DD_BEARER_TOKEN"]
  config.unstable_operations["v2.list_multiple_rulesets".to_sym] = true
end
api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new

body = DatadogAPIClient::V2::GetMultipleRulesetsRequest.new({
  data: DatadogAPIClient::V2::GetMultipleRulesetsRequestData.new({
    attributes: DatadogAPIClient::V2::GetMultipleRulesetsRequestDataAttributes.new({
      rulesets: [],
    }),
    type: DatadogAPIClient::V2::GetMultipleRulesetsRequestDataType::GET_MULTIPLE_RULESETS_REQUEST,
  }),
})
p api_instance.list_multiple_rulesets(body)

Instructions

First install the library and its dependencies and then save the example to example.rb and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"
// Ruleset get multiple returns "OK" response

package main

import (
	"context"
	"encoding/json"
	"fmt"
	"os"

	"github.com/DataDog/datadog-api-client-go/v2/api/datadog"
	"github.com/DataDog/datadog-api-client-go/v2/api/datadogV2"
)

func main() {
	body := datadogV2.GetMultipleRulesetsRequest{
		Data: &datadogV2.GetMultipleRulesetsRequestData{
			Attributes: &datadogV2.GetMultipleRulesetsRequestDataAttributes{
				Rulesets: []string{},
			},
			Type: datadogV2.GETMULTIPLERULESETSREQUESTDATATYPE_GET_MULTIPLE_RULESETS_REQUEST,
		},
	}
	ctx := datadog.NewDefaultContext(context.Background())
	ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
	configuration := datadog.NewConfiguration()
	configuration.SetUnstableOperationEnabled("v2.ListMultipleRulesets", true)
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewSecurityMonitoringApi(apiClient)
	resp, r, err := api.ListMultipleRulesets(ctx, body)

	if err != nil {
		fmt.Fprintf(os.Stderr, "Error when calling `SecurityMonitoringApi.ListMultipleRulesets`: %v\n", err)
		fmt.Fprintf(os.Stderr, "Full HTTP response: %v\n", r)
	}

	responseContent, _ := json.MarshalIndent(resp, "", "  ")
	fmt.Fprintf(os.Stdout, "Response from `SecurityMonitoringApi.ListMultipleRulesets`:\n%s\n", responseContent)
}

Instructions

First install the library and its dependencies and then save the example to main.go and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"
// Ruleset get multiple returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.SecurityMonitoringApi;
import com.datadog.api.client.v2.model.GetMultipleRulesetsRequest;
import com.datadog.api.client.v2.model.GetMultipleRulesetsRequestData;
import com.datadog.api.client.v2.model.GetMultipleRulesetsRequestDataAttributes;
import com.datadog.api.client.v2.model.GetMultipleRulesetsRequestDataType;
import com.datadog.api.client.v2.model.GetMultipleRulesetsResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    defaultClient.setAccessToken(System.getenv("DD_BEARER_TOKEN"));
    defaultClient.setUnstableOperationEnabled("v2.listMultipleRulesets", true);
    SecurityMonitoringApi apiInstance = new SecurityMonitoringApi(defaultClient);

    GetMultipleRulesetsRequest body =
        new GetMultipleRulesetsRequest()
            .data(
                new GetMultipleRulesetsRequestData()
                    .attributes(new GetMultipleRulesetsRequestDataAttributes())
                    .type(GetMultipleRulesetsRequestDataType.GET_MULTIPLE_RULESETS_REQUEST));

    try {
      GetMultipleRulesetsResponse result = apiInstance.listMultipleRulesets(body);
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling SecurityMonitoringApi#listMultipleRulesets");
      System.err.println("Status code: " + e.getCode());
      System.err.println("Reason: " + e.getResponseBody());
      System.err.println("Response headers: " + e.getResponseHeaders());
      e.printStackTrace();
    }
  }
}

Instructions

First install the library and its dependencies and then save the example to Example.java and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"
// Ruleset get multiple returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI;
use datadog_api_client::datadogV2::model::GetMultipleRulesetsRequest;
use datadog_api_client::datadogV2::model::GetMultipleRulesetsRequestData;
use datadog_api_client::datadogV2::model::GetMultipleRulesetsRequestDataAttributes;
use datadog_api_client::datadogV2::model::GetMultipleRulesetsRequestDataType;

#[tokio::main]
async fn main() {
    let body = GetMultipleRulesetsRequest::new().data(
        GetMultipleRulesetsRequestData::new(
            GetMultipleRulesetsRequestDataType::GET_MULTIPLE_RULESETS_REQUEST,
        )
        .attributes(GetMultipleRulesetsRequestDataAttributes::new().rulesets(vec![])),
    );
    let mut configuration = datadog::Configuration::new();
    configuration.set_unstable_operation_enabled("v2.ListMultipleRulesets", true);
    let api = SecurityMonitoringAPI::with_config(configuration);
    let resp = api.list_multiple_rulesets(body).await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}

Instructions

First install the library and its dependencies and then save the example to src/main.rs and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
/**
 * Ruleset get multiple returns "OK" response
 */

import { client, v2 } from "@datadog/datadog-api-client";

const configuration = client.createConfiguration({
  authMethods: {
    AuthZ: {
      accessToken: process.env.DD_BEARER_TOKEN as string,
    },
  },
});
configuration.unstableOperations["v2.listMultipleRulesets"] = true;
const apiInstance = new v2.SecurityMonitoringApi(configuration);

const params: v2.SecurityMonitoringApiListMultipleRulesetsRequest = {
  body: {
    data: {
      attributes: {
        rulesets: [],
      },
      type: "get_multiple_rulesets_request",
    },
  },
};

apiInstance
  .listMultipleRulesets(params)
  .then((data: v2.GetMultipleRulesetsResponse) => {
    console.log(
      "API called successfully. Returned data: " + JSON.stringify(data)
    );
  })
  .catch((error: any) => console.error(error));

Instructions

First install the library and its dependencies and then save the example to example.ts and run following commands:

    
DD_SITE="datadoghq.comus3.datadoghq.comus5.datadoghq.comdatadoghq.euap1.datadoghq.comap2.datadoghq.comuk1.datadoghq.comddog-gov.comus2.ddog-gov.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"