---
title: "Add Feature Flag"
method: POST
path: "/{projectId}/feature-flags"
tags: ["feature flags"]
---

# Add Feature Flag

`POST /{projectId}/feature-flags`

## Path parameters

- `projectId` integer, required

## Request body

- FeatureFlagSchema
  - `payload` string, nullable
  - `flagKey` string, required
  - `description` string, nullable
  - `flagType` 'single' | 'multi'
  - `isPersist` boolean, nullable
  - `isActive` boolean, nullable
  - `conditions` FeatureFlagCondition[]
    - `conditionId` integer, nullable
    - `name` string, required
    - `rolloutPercentage` integer, nullable
    - `filters` FeatureFlagConditionFilterSchema[]
      - `isEvent` false
      - `type` 'userOs' | 'userBrowser' | 'userBrowserVersion' | 'userDevice' | 'userDeviceType' | 'userCountry' | 'userCity' | 'userState' | 'userId' | 'distinct_id' | 'userAnonymousId' | 'referrer' | 'revId' | 'userOsIos' | 'userDeviceIos' | 'userCountryIos' | 'userIdIos' | 'userAnonymousIdIos' | 'revIdIos' | 'duration' | 'platform' | 'metadata' | 'issue' | 'eventsCount' | 'utmSource' | 'utmMedium' | 'utmCampaign' | 'thermalState' | 'mainThreadCPU' | 'viewComponent' | 'logEvent' | 'clickEvent' | 'memoryUsage', required
      - `value` string[]
      - `operator` union, required
        - 'is' | 'isAny' | 'on' | 'onAny' | 'isNot' | 'isUndefined' | 'notOn' | 'contains' | 'notContains' | 'startsWith' | 'endsWith' | 'regex'
        - '=' | '<' | '>' | '<=' | '>='
      - `source` string, nullable
      - `sourceOperator` union
        - 'is' | 'isAny' | 'on' | 'onAny' | 'isNot' | 'isUndefined' | 'notOn' | 'contains' | 'notContains' | 'startsWith' | 'endsWith' | 'regex'
        - '=' | '<' | '>' | '<=' | '>='
  - `variants` FeatureFlagVariant[]
    - `variantId` integer, nullable
    - `value` string, required
    - `description` string, nullable
    - `payload` string, nullable
    - `rolloutPercentage` integer, nullable

## Response `200`

Successful Response

- unknown

## Other responses

- `422` — Validation Error

---

[API](https://skmtc.net/openreplay/apis/fastapi.md) · [All operations](https://skmtc.net/openreplay/apis/fastapi/llms.txt) · [OpenAPI document](https://skmtc-service-staging.skmtc.workers.dev/v1/apis/openreplay/fastapi/versions/4686e8023dc8/schema)
