---
title: "PUT /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{id}"
method: PUT
path: "/api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{id}"
tags: ["Flipt", "RulesService"]
---

# PUT /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{id}

`PUT /api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{id}`

## Request

- Base URL: `http://localhost:8080`
- URL: `http://localhost:8080/api/v1/namespaces/{namespaceKey}/flags/{flagKey}/rules/{id}`
- Auth: HTTP bearer

## Path parameters

- `namespaceKey` string, required
- `flagKey` string, required
- `id` string, required

## Request body

- UpdateRuleRequest
  - `id` string
  - `flagKey` string
  - `segmentKey` string
  - `namespaceKey` string
  - `segmentKeys` string[]
  - `segmentOperator` 'OR_SEGMENT_OPERATOR' | 'AND_SEGMENT_OPERATOR', enum

## Response `200`

OK

- Rule
  - `id` string
  - `flagKey` string
  - `segmentKey` string
  - `distributions` Distribution[]
    - `id` string
    - `ruleId` string
    - `variantId` string
    - `rollout` number, float
    - `createdAt` string, date-time
    - `updatedAt` string, date-time
  - `rank` integer
  - `createdAt` string, date-time
  - `updatedAt` string, date-time
  - `namespaceKey` string
  - `segmentKeys` string[]
  - `segmentOperator` 'OR_SEGMENT_OPERATOR' | 'AND_SEGMENT_OPERATOR', enum

## Changes

- **2024-08-08** `594afc3dbe2e`: 3 breaking, 2 warning, 2 info
  - request property `segmentOperator` was restricted to a list of enum values
  - the `segmentOperator` request property type changed from `integer` to `string`
  - the `segmentOperator` response's property type changed from `integer` to `string` for status `200`
  - added the new `AND_SEGMENT_OPERATOR` enum value to the `segmentOperator` response property for the response status `200`
  - …3 more
- **2024-08-07** `291b2f802c58`: 4 breaking, 2 info
  - removed the enum value `AND_SEGMENT_OPERATOR` of the request property `segmentOperator`
  - removed the enum value `OR_SEGMENT_OPERATOR` of the request property `segmentOperator`
  - the `segmentOperator` request property type changed from `string` to `integer`
  - the `segmentOperator` response's property type changed from `string` to `integer` for status `200`
  - …2 more

[Operation history](https://skmtc.dev/flipt-io/apis/flipt-api/changes/api/v1/namespaces/:namespaceKey/flags/:flagKey/rules/:id/put.md)

---

[API](https://skmtc.dev/flipt-io/apis/flipt-api.md) - [All operations](https://skmtc.dev/flipt-io/apis/flipt-api/llms.txt) - [OpenAPI document](https://skmtc.dev/flipt-io/apis/flipt-api/revisions/6fe4caf26f13?raw)
