---
title: List all rules
description: Datadog, the leading service for cloud-scale monitoring.
breadcrumbs: Docs > API Reference > Scorecards
---

{% callout %}
# Important note for users on the following Datadog sites: app.ddog-gov.com, us2.ddog-gov.com

{% alert level="danger" %}
This product is not supported for your selected [Datadog site](https://docs.datadoghq.com/getting_started/site.md). ({% placeholder "user-datadog-site-name" /%}).
{% /alert %}

{% /callout %}

# List all rules{% #list-all-rules %}

{% tab title="v2" %}

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

### Overview

Fetch all rules.

OAuth apps require the `apm_service_catalog_read` authorization [scope](https://docs.datadoghq.com/api/latest/scopes.md#scorecards) to access this endpoint.



### Arguments

#### Query Strings

| Name                      | Type    | Description                                                                    |
| ------------------------- | ------- | ------------------------------------------------------------------------------ |
| page[size]                | integer | Size for a given page. The maximum allowed value is 100.                       |
| page[offset]              | integer | Specific offset to use as the beginning of the returned page.                  |
| include                   | string  | Include related scorecard details in the response.                             |
| filter[rule][id]          | string  | Filter the rules on a rule ID.                                                 |
| filter[rule][enabled]     | boolean | Filter for enabled rules only.                                                 |
| filter[rule][custom]      | boolean | Filter for custom rules only.                                                  |
| filter[rule][name]        | string  | Filter rules on the rule name.                                                 |
| filter[rule][description] | string  | Filter rules on the rule description.                                          |
| fields[rule]              | string  | Return only specific fields in the response for rule attributes.               |
| fields[scorecard]         | string  | Return only specific fields in the included response for scorecard attributes. |

### Response

{% tab title="200" %}
OK
{% tab title="Model" %}
Scorecard rules response.

| Parent field  | Field          | Type      | Description                                                        |
| ------------- | -------------- | --------- | ------------------------------------------------------------------ |
|               | data           | [object]  | Array of rule details.                                             |
| data          | attributes     | object    | Details of a rule.                                                 |
| attributes    | category       | string    | **DEPRECATED**: The scorecard name to which this rule must belong. |
| attributes    | created_at     | date-time | Creation time of the rule outcome.                                 |
| attributes    | custom         | boolean   | Defines if the rule is a custom rule.                              |
| attributes    | description    | string    | Explanation of the rule.                                           |
| attributes    | enabled        | boolean   | If enabled, the rule is calculated as part of the score.           |
| attributes    | level          | int32     | The maturity level of the rule (1, 2, or 3).                       |
| attributes    | modified_at    | date-time | Time of the last rule outcome modification.                        |
| attributes    | name           | string    | Name of the rule.                                                  |
| attributes    | owner          | string    | Owner of the rule.                                                 |
| attributes    | scope_query    | string    | A query to filter which entities this rule applies to.             |
| attributes    | scorecard_name | string    | The scorecard name to which this rule must belong.                 |
| data          | id             | string    | The unique ID for a scorecard rule.                                |
| data          | relationships  | object    | Scorecard create rule response relationship.                       |
| relationships | scorecard      | object    | Relationship data for a rule.                                      |
| scorecard     | data           | object    | Rule relationship data.                                            |
| data          | id             | string    | The unique ID for a scorecard.                                     |
| data          | type           | enum      | The JSON:API type for scorecard. Allowed enum values: `scorecard`  |
| data          | type           | enum      | The JSON:API type for scorecard rules. Allowed enum values: `rule` |
|               | links          | object    | Links attributes.                                                  |
| links         | next           | string    | Link for the next set of rules.                                    |

{% /tab %}

{% tab title="Example" %}

```json
{
  "data": [
    {
      "attributes": {
        "category": "string",
        "created_at": "2019-09-19T10:00:00.000Z",
        "custom": false,
        "description": "string",
        "enabled": true,
        "level": 2,
        "modified_at": "2019-09-19T10:00:00.000Z",
        "name": "Team Defined",
        "owner": "string",
        "scope_query": "kind:service",
        "scorecard_name": "Deployments automated via Deployment Trains"
      },
      "id": "q8MQxk8TCqrHnWkx",
      "relationships": {
        "scorecard": {
          "data": {
            "id": "q8MQxk8TCqrHnWkp",
            "type": "scorecard"
          }
        }
      },
      "type": "rule"
    }
  ],
  "links": {
    "next": "/api/v2/scorecard/rules?page%5Blimit%5D=2\u0026page%5Boffset%5D=2\u0026page%5Bsize%5D=2"
  }
}
```

{% /tab %}

{% /tab %}

{% tab title="400" %}
Bad Request
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

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

{% /tab %}

{% /tab %}

{% tab title="403" %}
Forbidden
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

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

{% /tab %}

{% /tab %}

{% tab title="429" %}
Too many requests
{% tab title="Model" %}
API error response.

| Field                    | Type     | Description       |
| ------------------------ | -------- | ----------------- |
| errors [*required*] | [string] | A list of errors. |

{% /tab %}

{% tab title="Example" %}

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

{% /tab %}

{% /tab %}

### Code Example

##### 
                  \# Curl command curl -X GET "https://api.datadoghq.com/api/v2/scorecard/rules" \
-H "Accept: application/json" \
-H "DD-API-KEY: ${DD_API_KEY}" \
-H "DD-APPLICATION-KEY: ${DD_APP_KEY}" 
                
##### 

```python
"""
List all rules returns "OK" response
"""

from datadog_api_client import ApiClient, Configuration
from datadog_api_client.v2.api.scorecards_api import ScorecardsApi

configuration = Configuration()
with ApiClient(configuration) as api_client:
    api_instance = ScorecardsApi(api_client)
    response = api_instance.list_scorecard_rules()

    print(response)
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=python) and then save the example to `example.py` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" python3 "example.py"
##### 

```ruby
# List all rules returns "OK" response

require "datadog_api_client"
api_instance = DatadogAPIClient::V2::ScorecardsAPI.new
p api_instance.list_scorecard_rules()
```

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=ruby) and then save the example to `example.rb` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" rb "example.rb"
##### 

```go
// List all rules 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() {
	ctx := datadog.NewDefaultContext(context.Background())
	configuration := datadog.NewConfiguration()
	apiClient := datadog.NewAPIClient(configuration)
	api := datadogV2.NewScorecardsApi(apiClient)
	resp, r, err := api.ListScorecardRules(ctx, *datadogV2.NewListScorecardRulesOptionalParameters())

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

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

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=go) and then save the example to `main.go` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" go run "main.go"
##### 

```java
// List all rules returns "OK" response

import com.datadog.api.client.ApiClient;
import com.datadog.api.client.ApiException;
import com.datadog.api.client.v2.api.ScorecardsApi;
import com.datadog.api.client.v2.model.ListRulesResponse;

public class Example {
  public static void main(String[] args) {
    ApiClient defaultClient = ApiClient.getDefaultApiClient();
    ScorecardsApi apiInstance = new ScorecardsApi(defaultClient);

    try {
      ListRulesResponse result = apiInstance.listScorecardRules();
      System.out.println(result);
    } catch (ApiException e) {
      System.err.println("Exception when calling ScorecardsApi#listScorecardRules");
      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://docs.datadoghq.com/api/latest.md?code-lang=java) and then save the example to `Example.java` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" java "Example.java"
##### 

```rust
// List all rules returns "OK" response
use datadog_api_client::datadog;
use datadog_api_client::datadogV2::api_scorecards::ListScorecardRulesOptionalParams;
use datadog_api_client::datadogV2::api_scorecards::ScorecardsAPI;

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

#### Instructions

First [install the library and its dependencies](https://docs.datadoghq.com/api/latest.md?code-lang=rust) and then save the example to `src/main.rs` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" cargo run
##### 

```typescript
/**
 * List all rules returns "OK" response
 */

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

const configuration = client.createConfiguration();
const apiInstance = new v2.ScorecardsApi(configuration);

apiInstance
  .listScorecardRules()
  .then((data: v2.ListRulesResponse) => {
    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://docs.datadoghq.com/api/latest.md?code-lang=typescript) and then save the example to `example.ts` and run following commands:
    DD_SITE="datadoghq.com" DD_API_KEY="<DD_API_KEY>" DD_APP_KEY="<DD_APP_KEY>" tsc "example.ts"
{% /tab %}
