---
type: api
title: Updates a ruleset
description: Updates the ruleset with the definition.
url: https://www.elastic.co/docs/api/doc/cloud/operation/operation-update-traffic-filter-ruleset
resource: https://www.elastic.co/docs/api/doc/cloud/operation/operation-update-traffic-filter-ruleset
products:
  - Elastic Cloud Hosted
---

# Updates a ruleset

Authentication: none

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

## Paths

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

#### Path parameters

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

## Description

Updates the ruleset with the definition.

## Request body

The specification for traffic filter ruleset.

`application/json`

- `name` (string) — required
  Name of the ruleset
- `description` (string) — optional
  Description of the ruleset
- `type` (string) — required
  Type of the ruleset
- `include_by_default` (boolean) — required
  Should the ruleset be automatically included in the new deployments
- `region` (string) — required
  The ruleset can be attached only to deployments in the specific region
- `rules` (object[]) — required
  List of rules
  - `id` (string) — optional
    The rule ID
  - `remote_cluster_org_id` (string) — optional
    The remote cluster organization ID
  - `remote_cluster_id` (string) — optional
    The remote cluster ID
  - `description` (string) — optional
    Description of the rule
  - `source` (string) — optional
    Allowed traffic filter source: IP address, CIDR mask, or VPC endpoint ID
  - `azure_endpoint_name` (string) — optional
    Name of the Azure Private Endpoint to allow connections from
  - `azure_endpoint_guid` (string) — optional
    Resource GUID of the Azure Private Endpoint to allow connections from
  - `egress_rule` (object) — optional
    The rule detail for a traffic filter egress rule.
    - `target` (string) — required
      Allowed traffic filter egress target: IP address or CIDR mask
    - `ports` (integer[] · format: int32) — optional
      A list of target ports for an egress rule
    - `protocol` (enum) — required
      The target protocol for an egress rule
      Values: `all`, `tcp`, `udp`

## Responses

#### `200`

The ruleset definition was valid and the update has started.

`application/json`

- `id` (string)
  The new ruleset ID
#### `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 PUT "https://api.elastic-cloud.com/api/v1/deployments/traffic-filter/rulesets/${RULESET_ID}" \
  -H "Content-Type: application/json" \
  -d '{
    "name": "string",
    "type": "string",
    "include_by_default": false,
    "region": "string",
    "rules": [
      {}
    ]
  }'
```

## 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"
}
```

#### 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"
      ]
    }
  ]
}
```

