---
title: "POST /api/v1/namespaces/{namespaceKey}/segments/{segmentKey}/constraints"
method: POST
path: "/api/v1/namespaces/{namespaceKey}/segments/{segmentKey}/constraints"
tags: ["Flipt", "ConstraintsService"]
---

# POST /api/v1/namespaces/{namespaceKey}/segments/{segmentKey}/constraints

`POST /api/v1/namespaces/{namespaceKey}/segments/{segmentKey}/constraints`

## Request

- Base URL: `http://localhost:8080`
- URL: `http://localhost:8080/api/v1/namespaces/{namespaceKey}/segments/{segmentKey}/constraints`
- Auth: HTTP bearer

## Path parameters

- `namespaceKey` string, required
- `segmentKey` string, required

## Request body

- CreateConstraintRequest
  - `segmentKey` string
  - `type` 'UNKNOWN_COMPARISON_TYPE' | 'STRING_COMPARISON_TYPE' | 'NUMBER_COMPARISON_TYPE' | 'BOOLEAN_COMPARISON_TYPE' | 'DATETIME_COMPARISON_TYPE' | 'ENTITY_ID_COMPARISON_TYPE', enum, required
  - `property` string, required
  - `operator` string, required
  - `value` string
  - `namespaceKey` string
  - `description` string

## Response `200`

OK

- Constraint
  - `id` string
  - `segmentKey` string
  - `type` 'UNKNOWN_COMPARISON_TYPE' | 'STRING_COMPARISON_TYPE' | 'NUMBER_COMPARISON_TYPE' | 'BOOLEAN_COMPARISON_TYPE' | 'DATETIME_COMPARISON_TYPE' | 'ENTITY_ID_COMPARISON_TYPE', enum
  - `property` string
  - `operator` string
  - `value` string
  - `createdAt` string, date-time
  - `updatedAt` string, date-time
  - `namespaceKey` string
  - `description` string

## Changes

- **2024-08-08** `594afc3dbe2e`: 3 breaking, 6 warning, 6 info
  - request property `type` was restricted to a list of enum values
  - the `type` request property type changed from `integer` to `string`
  - the `type` response's property type changed from `integer` to `string` for status `200`
  - added the new `BOOLEAN_COMPARISON_TYPE` enum value to the `type` response property for the response status `200`
  - …11 more
- **2024-08-07** `291b2f802c58`: 8 breaking, 6 info
  - removed the enum value `BOOLEAN_COMPARISON_TYPE` of the request property `type`
  - removed the enum value `DATETIME_COMPARISON_TYPE` of the request property `type`
  - removed the enum value `ENTITY_ID_COMPARISON_TYPE` of the request property `type`
  - removed the enum value `NUMBER_COMPARISON_TYPE` of the request property `type`
  - …10 more

[Operation history](https://skmtc.dev/flipt-io/apis/flipt-api/changes/api/v1/namespaces/:namespaceKey/segments/:segmentKey/constraints/post.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)
