---
type: api
title: Retrieves the ruleset by ID.
description: Retrieves a list of resources that are associated to the specified ruleset.
url: https://www.elastic.co/docs/api/doc/cloud/operation/operation-get-traffic-filter-ruleset
resource: https://www.elastic.co/docs/api/doc/cloud/operation/operation-get-traffic-filter-ruleset
products:
  - Elastic Cloud Hosted
---

# Retrieves the ruleset by ID.

Authentication: none

- Server: `https://api.elastic-cloud.com/api/v1`

## Paths

- `GET` `/deployments/traffic-filter/rulesets/{ruleset_id}`

#### Path parameters

- `ruleset_id` (string) — required
  The mandatory ruleset ID.

## Description

Retrieves a list of resources that are associated to the specified ruleset.

## Query string parameters

- `include_associations` (boolean · default: false) — optional
  Retrieves a list of resources that are associated to the specified ruleset.

## Responses

#### `200`

The container for a set of traffic filter rules.

`application/json`

- `id` (string)
  The ruleset ID
- `name` (string)
  Name of the ruleset
- `description` (string)
  Description of the ruleset
- `type` (enum)
  Type of the ruleset
  Values: `ip`, `azure_private_endpoint`, `gcp_private_service_connect_endpoint`, `vpce`, `egress_firewall`, `remote_cluster`
- `include_by_default` (boolean)
  Should the ruleset be automatically included in the new deployments
- `region` (string)
  The ruleset can be attached only to deployments in the specific region
- `rules` (object[])
  List of rules
  - `id` (string)
    The rule ID
  - `remote_cluster_org_id` (string)
    The remote cluster organization ID
  - `remote_cluster_id` (string)
    The remote cluster ID
  - `description` (string)
    Description of the rule
  - `source` (string)
    Allowed traffic filter source: IP address, CIDR mask, or VPC endpoint ID
  - `azure_endpoint_name` (string)
    Name of the Azure Private Endpoint to allow connections from
  - `azure_endpoint_guid` (string)
    Resource GUID of the Azure Private Endpoint to allow connections from
  - `egress_rule` (object)
    The rule detail for a traffic filter egress rule.
    - `target` (string)
      Allowed traffic filter egress target: IP address or CIDR mask
    - `ports` (integer[] · format: int32)
      A list of target ports for an egress rule
    - `protocol` (enum)
      The target protocol for an egress rule
      Values: `all`, `tcp`, `udp`
- `associations` (object[])
  List of associations. Returned only when include_associations query parameter is true
  - `entity_type` (string)
    Type of the traffic filter ruleset association, such as 'deployment', 'cluster'
  - `id` (string)
    ID of the entity, such as the deployment ID or Elasticsearch cluster ID.
- `total_associations` (integer · format: int32)
  Total number of associations. This includes associations the user does not have permission to view.Returned only when include_associations query parameter is true
#### `404`

The traffic filter ruleset specified by {ruleset_id} cannot be found. (code: `traffic_filter.not_found`)

`application/json`

- `errors` (object[])
  A list of errors that occurred in the failing request
  - `code` (string)
    A structured code representing the error type that occurred
  - `message` (string)
    A human readable message describing the error that occurred
  - `fields` (string[])
    If the error can be tied to a specific field or fields in the user request, this lists those fields
##### Response headers

- `x-cloud-error-codes` (enum)
  The error codes associated with the response

#### `500`

Error reading the traffic filter ruleset. (code: `traffic_filter.request_execution_failed`)

`application/json`

- `errors` (object[])
  A list of errors that occurred in the failing request
  - `code` (string)
    A structured code representing the error type that occurred
  - `message` (string)
    A human readable message describing the error that occurred
  - `fields` (string[])
    If the error can be tied to a specific field or fields in the user request, this lists those fields
##### Response headers

- `x-cloud-error-codes` (enum)
  The error codes associated with the response

## Code examples

#### curl

```curl
curl -X GET "https://api.elastic-cloud.com/api/v1/deployments/traffic-filter/rulesets/${RULESET_ID}"
```

## Response examples

#### 200

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "id": "string",
  "name": "string",
  "description": "string",
  "type": "ip",
  "include_by_default": false,
  "region": "string",
  "rules": [
    {
      "id": "string",
      "remote_cluster_org_id": "string",
      "remote_cluster_id": "string",
      "description": "string",
      "source": "string",
      "azure_endpoint_name": "string",
      "azure_endpoint_guid": "string",
      "egress_rule": {
        "target": "string",
        "ports": [
          0
        ],
        "protocol": "all"
      }
    }
  ],
  "associations": [
    {
      "entity_type": "string",
      "id": "string"
    }
  ],
  "total_associations": 0
}
```

#### 404

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "errors": [
    {
      "code": "string",
      "message": "string",
      "fields": [
        "string"
      ]
    }
  ]
}
```

#### 500

`application/json`

Generated from the API spec. Values are representative. Unions use the first variant; deeply nested or large bodies may omit fields.

```json
{
  "errors": [
    {
      "code": "string",
      "message": "string",
      "fields": [
        "string"
      ]
    }
  ]
}
```

