> ## Documentation Index
> Fetch the complete documentation index at: https://docs.flipt.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Constraint

<RequestExample>
  ```bash cURL theme={null}
  curl --request POST \
    --url https://try.flipt.io/api/v1/namespaces/default/segments/{segmentKey}/constraints \
    --header 'Content-Type: application/json' \
    --header 'Accept: application/json' \
    --data '{
    "operator": "<operator>",
    "property": "<property>",
    "type": "<type>"
  }'
  ```
</RequestExample>


## OpenAPI

````yaml POST /api/v1/namespaces/{namespaceKey}/segments/{segmentKey}/constraints
openapi: 3.0.3
info:
  title: api
  version: 1.47.0
servers:
  - url: http://localhost:8080
security:
  - bearerAuth: []
tags:
  - name: AuthenticationMethodKubernetesService
  - name: AuthenticationMethodOIDCService
  - name: AuthenticationMethodTokenService
  - name: AuthenticationService
  - name: EvaluationService
  - name: Flipt
  - name: OFREPService
paths:
  /api/v1/namespaces/{namespaceKey}/segments/{segmentKey}/constraints:
    post:
      tags:
        - Flipt
        - ConstraintsService
      operationId: createConstraint
      parameters:
        - name: namespaceKey
          in: path
          required: true
          schema:
            type: string
        - name: segmentKey
          in: path
          required: true
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateConstraintRequest'
        required: true
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Constraint'
components:
  schemas:
    CreateConstraintRequest:
      required:
        - type
        - property
        - operator
      type: object
      properties:
        segmentKey:
          type: string
        type:
          enum:
            - UNKNOWN_COMPARISON_TYPE
            - STRING_COMPARISON_TYPE
            - NUMBER_COMPARISON_TYPE
            - BOOLEAN_COMPARISON_TYPE
            - DATETIME_COMPARISON_TYPE
            - ENTITY_ID_COMPARISON_TYPE
          type: string
          format: enum
        property:
          type: string
        operator:
          type: string
        value:
          type: string
        namespaceKey:
          type: string
        description:
          type: string
    Constraint:
      type: object
      properties:
        id:
          type: string
        segmentKey:
          type: string
        type:
          enum:
            - UNKNOWN_COMPARISON_TYPE
            - STRING_COMPARISON_TYPE
            - NUMBER_COMPARISON_TYPE
            - BOOLEAN_COMPARISON_TYPE
            - DATETIME_COMPARISON_TYPE
            - ENTITY_ID_COMPARISON_TYPE
          type: string
          format: enum
        property:
          type: string
        operator:
          type: string
        value:
          type: string
        createdAt:
          type: string
          format: date-time
        updatedAt:
          type: string
          format: date-time
        namespaceKey:
          type: string
        description:
          type: string
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer

````