---
title: Obtener la lista de reglas de notificación de vulnerabilidad
description: Devuelve la lista de reglas de notificación para vulnerabilidades de seguridad.
breadcrumbs: Documentación > API > Obtener la lista de reglas de notificación de vulnerabilidad
---

> For the complete documentation index, see [llms.txt](https://dnd37xeb23o8n.cloudfront.net/jen.gilbert/astro-base/llms.txt).

# Obtener la lista de reglas de notificación de vulnerabilidad

## v2 (latest)

| Datadog site      | API endpoint                                                                         |
| ----------------- | ------------------------------------------------------------------------------------ |
| app.datadoghq.com | GET https://api.datadoghq.com/api/v2/security/vulnerabilities/notification_rules     |
| us3.datadoghq.com | GET https://api.us3.datadoghq.com/api/v2/security/vulnerabilities/notification_rules |
| us5.datadoghq.com | GET https://api.us5.datadoghq.com/api/v2/security/vulnerabilities/notification_rules |
| app.datadoghq.eu  | GET https://api.datadoghq.eu/api/v2/security/vulnerabilities/notification_rules      |
| ap1.datadoghq.com | GET https://api.ap1.datadoghq.com/api/v2/security/vulnerabilities/notification_rules |
| ap2.datadoghq.com | GET https://api.ap2.datadoghq.com/api/v2/security/vulnerabilities/notification_rules |
| uk1.datadoghq.com | GET https://api.uk1.datadoghq.com/api/v2/security/vulnerabilities/notification_rules |
| app.ddog-gov.com  | GET https://api.ddog-gov.com/api/v2/security/vulnerabilities/notification_rules      |
| us2.ddog-gov.com  | GET https://api.us2.ddog-gov.com/api/v2/security/vulnerabilities/notification_rules  |

### Overview

Devuelve la lista de reglas de notificación para vulnerabilidades de seguridad.

This endpoint requires the `security_monitoring_notification_profiles_read` permission.

### Response

{% tabs %}
{% tab label="200" %}
The list of notification rules.

{% tabs %}
{% tab label="Model" %}
The list of notification rules.

| Parent field | Field                       | Type     | Description                                                                                                                                                                                                                                                                                                                                                                                                                            |
| ------------ | --------------------------- | -------- | -------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------------- |
|              | data                        | [object] |                                                                                                                                                                                                                                                                                                                                                                                                                                        |
| data         | attributes [*required*]     | object   | Attributes of the notification rule.                                                                                                                                                                                                                                                                                                                                                                                                   |
| attributes   | created_at [*required*]     | int64    | Date as Unix timestamp in milliseconds.                                                                                                                                                                                                                                                                                                                                                                                                |
| attributes   | created_by [*required*]     | object   | User creating or modifying a rule.                                                                                                                                                                                                                                                                                                                                                                                                     |
| created_by   | handle                      | string   | The user handle.                                                                                                                                                                                                                                                                                                                                                                                                                       |
| created_by   | name                        | string   | The user name.                                                                                                                                                                                                                                                                                                                                                                                                                         |
| attributes   | enabled [*required*]        | boolean  | Field used to enable or disable the rule.                                                                                                                                                                                                                                                                                                                                                                                              |
| attributes   | modified_at [*required*]    | int64    | Date as Unix timestamp in milliseconds.                                                                                                                                                                                                                                                                                                                                                                                                |
| attributes   | modified_by [*required*]    | object   | User creating or modifying a rule.                                                                                                                                                                                                                                                                                                                                                                                                     |
| modified_by  | handle                      | string   | The user handle.                                                                                                                                                                                                                                                                                                                                                                                                                       |
| modified_by  | name                        | string   | The user name.                                                                                                                                                                                                                                                                                                                                                                                                                         |
| attributes   | name [*required*]           | string   | Name of the notification rule.                                                                                                                                                                                                                                                                                                                                                                                                         |
| attributes   | selectors [*required*]      | object   | Selectors are used to filter security issues for which notifications should be generated. Users can specify rule severities, rule types, a query to filter security issues on tags and attributes, and the trigger source. Only the trigger_source field is required.                                                                                                                                                                  |
| selectors    | query                       | string   | The query is composed of one or several key:value pairs, which can be used to filter security issues on tags and attributes.                                                                                                                                                                                                                                                                                                           |
| selectors    | rule_types                  | [string] | Security rule types used as filters in security rules.                                                                                                                                                                                                                                                                                                                                                                                 |
| selectors    | severities                  | [string] | The security rules severities to consider.                                                                                                                                                                                                                                                                                                                                                                                             |
| selectors    | trigger_source [*required*] | enum     | The type of security issues on which the rule applies. Notification rules based on security signals need to use the trigger source "security_signals", while notification rules based on security vulnerabilities need to use the trigger source "security_findings". Allowed enum values: `security_findings`, `security_signals`.                                                                                                    |
| attributes   | targets [*required*]        | [string] | List of recipients to notify when a notification rule is triggered. Many different target types are supported, such as email addresses, Slack channels, and PagerDuty services. The appropriate integrations need to be properly configured to send notifications to the specified targets.                                                                                                                                            |
| attributes   | time_aggregation            | int64    | Time aggregation period (in seconds) is used to aggregate the results of the notification rule evaluation. Results are aggregated over a selected time frame using a rolling window, which updates with each new evaluation. Notifications are only sent for new issues discovered during the window. Time aggregation is only available for vulnerability-based notification rules. When omitted or set to 0, no aggregation is done. |
| attributes   | version [*required*]        | int64    | Version of the notification rule. It is updated when the rule is modified.                                                                                                                                                                                                                                                                                                                                                             |
| data         | id [*required*]             | string   | The ID of a notification rule.                                                                                                                                                                                                                                                                                                                                                                                                         |
| data         | type [*required*]           | enum     | The rule type associated to notification rules. Allowed enum values: `notification_rules`.                                                                                                                                                                                                                                                                                                                                             |
{% /tab %}

{% tab label="Example" %}
```json
{
  "data": [
    {
      "attributes": {
        "created_at": 1722439510282,
        "created_by": {
          "handle": "john.doe@domain.com",
          "name": "John Doe"
        },
        "enabled": true,
        "modified_at": 1722439510282,
        "modified_by": {
          "handle": "john.doe@domain.com",
          "name": "John Doe"
        },
        "name": "Rule 1",
        "selectors": {
          "query": "(source:production_service OR env:prod)",
          "rule_types": [
            "misconfiguration",
            "attack_path"
          ],
          "severities": [
            "critical"
          ],
          "trigger_source": "security_findings"
        },
        "targets": [
          "@john.doe@email.com"
        ],
        "time_aggregation": 86400,
        "version": 1
      },
      "id": "aaa-bbb-ccc",
      "type": "notification_rules"
    }
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="403" %}
Forbidden

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}

{% tab label="429" %}
Too many requests

{% tabs %}
{% tab label="Model" %}
API error response.

| Field               | Type     | Description       |
| ------------------- | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |
{% /tab %}

{% tab label="Example" %}
```json
{
  "errors": [
    "Bad Request"
  ]
}
```
{% /tab %}
{% /tabs %}
{% /tab %}
{% /tabs %}

### Code Example

{% tabs %}
{% tab label="Curl" %}
```bash
# Set your Datadog site and credentials
export DD_SITE="datadoghq.com" # Or us3.datadoghq.com, us5.datadoghq.com, datadoghq.eu, ap1.datadoghq.com, ap2.datadoghq.com, uk1.datadoghq.com, ddog-gov.com, us2.ddog-gov.com
# Use a Personal Access Token or Service Access Token
export DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>"

curl -X GET "https://api.${DD_SITE}/api/v2/security/vulnerabilities/notification_rules" \
-H "Accept: application/json" \
-H "Authorization: Bearer ${DD_BEARER_TOKEN}"
```
{% /tab %}

{% tab label="Go" %}
```go
// Get the list of vulnerability notification rules returns "The list of notification rules." 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() {
	ctx := datadog.NewDefaultContext(context.Background())
	ctx = context.WithValue(ctx, datadog.ContextAccessToken, os.Getenv("DD_BEARER_TOKEN"))
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewSecurityMonitoringApi(apiClient)
	resp, r, err := api.GetVulnerabilityNotificationRules(ctx)

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

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

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=go) and then save the example to `main.go` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" go run "main.go"
```
{% /tab %}

{% tab label="Java" %}
```java
// Get the list of vulnerability notification rules returns "The list of notification rules."
// 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.NotificationRulesListResponse;

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

    try {
      NotificationRulesListResponse result = apiInstance.getVulnerabilityNotificationRules();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println(
          "Exception when calling SecurityMonitoringApi#getVulnerabilityNotificationRules");
      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](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=java) and then save the example to `Example.java` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" java "Example.java"
```
{% /tab %}

{% tab label="Python" %}
```python
"""
Get the list of vulnerability notification rules returns "The list of notification rules." response
"""

from os import environ
from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.security_monitoring_api import SecurityMonitoringApi

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

    print(response)
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=python) and then save the example to `example.py` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" python3 "example.py"
```
{% /tab %}

{% tab label="Ruby" %}
```ruby
# Get the list of vulnerability notification rules returns "The list of notification rules." response

require "datadog_api_client"
DatadogAPIClient.configure do |config|
  config.access_token = ENV["DD_BEARER_TOKEN"]
end
api_instance = DatadogAPIClient::V2::SecurityMonitoringAPI.new
p api_instance.get_vulnerability_notification_rules()
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=ruby) and then save the example to `example.rb` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" rb "example.rb"
```
{% /tab %}

{% tab label="Rust" %}
```rust
// Get the list of vulnerability notification rules returns "The list of
// notification rules." response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_security_monitoring::SecurityMonitoringAPI;

#[tokio::main]
async fn main() {
    let configuration = datadog::Configuration::new();
    let api = SecurityMonitoringAPI::with_config(configuration);
    let resp = api.get_vulnerability_notification_rules().await;
    if let Ok(value) = resp {
        println!("{:#?}", value);
    } else {
        println!("{:#?}", resp.unwrap_err());
    }
}
```

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=rust) and then save the example to `src/main.rs` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
```
{% /tab %}

{% tab label="TypeScript" %}
```typescript
/**
 * Get the list of vulnerability notification rules returns "The list of notification rules." response
 */

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

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

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

#### Instructions

First [install the library and its dependencies](https://dnd37xeb23o8n.cloudfront.net/api/latest.md?code-lang=typescript) and then save the example to `example.ts` and run following commands:

```bash
DD_SITE="datadoghq.com" DD_BEARER_TOKEN="<PERSONAL_ACCESS_TOKEN OR SERVICE_ACCESS_TOKEN>" tsc "example.ts"
```
{% /tab %}
{% /tabs %}
