Create a feature flag

Create a feature flag with the given name, key, and variations.

Click to expand instructions for creating a migration flag

Creating a migration flag

When you create a migration flag, the variations are pre-determined based on the number of stages in the migration.

To create a migration flag, omit the variations and defaults information. Instead, provide a purpose of migration, and migrationSettings. If you create a migration flag with six stages, contextKind is required. Otherwise, it should be omitted.

Here’s an example:

1{
2 "key": "flag-key-123",
3 "purpose": "migration",
4 "migrationSettings": {
5 "stageCount": 6,
6 "contextKind": "account"
7 }
8}

To learn more, read Migration Flags.

Path parameters

projectKeystringRequired
The project key

Headers

AuthorizationstringRequired

Query parameters

clonestringOptional

The key of the feature flag to be cloned. The key identifies the flag in your code. For example, setting clone=flagKey copies the full targeting configuration for all environments, including on/off state, from the original flag to the new flag.

Request

This endpoint expects an object.
namestringRequired

A human-friendly name for the feature flag

keystringRequired
A unique key used to reference the flag in your code
descriptionstringOptional
Description of the feature flag. Defaults to an empty string.
clientSideAvailabilityobjectOptional

Which type of client-side SDKs the feature flag is available to

variationslist of objectsOptional

An array of possible variations for the flag. The variation values must be unique. If omitted, two boolean variations of true and false will be used.

temporarybooleanOptional

Whether the flag is a temporary flag. Defaults to true.

tagslist of stringsOptional
Tags for the feature flag. Defaults to an empty array.
customPropertiesmap from strings to objectsOptional
Metadata attached to the feature flag, in the form of the property key associated with a name and array of values for the metadata to associate with this flag. Typically used to store data related to an integration.
defaultsobjectOptional
The indices, from the array of variations, for the variations to serve by default when targeting is on and when targeting is off. These variations will be used for this flag in new environments. If omitted, the first and last variation will be used.
purposeenumOptional
Purpose of the flag
Allowed values:
migrationSettingsobjectOptional

Settings relevant to flags where purpose is migration

maintainerIdstringOptional
The ID of the member who maintains this feature flag
maintainerTeamKeystringOptional
The key of the team that maintains this feature flag
initialPrerequisiteslist of objectsOptional
Initial set of prerequisite flags for all environments
isFlagOnbooleanOptional

Whether to automatically turn the flag on across all environments at creation. Defaults to false.

includeInSnippetbooleanOptionalDeprecated

Deprecated, use clientSideAvailability. Whether this flag should be made available to the client-side JavaScript SDK. Defaults to false.

Response

Global flag response
namestring

A human-friendly name for the feature flag

kindenum
Kind of feature flag
Allowed values:
keystring
A unique key used to reference the flag in your code
_versioninteger
Version of the feature flag
creationDatelong
Timestamp of flag creation date
variationslist of objects
An array of possible variations for the flag
temporaryboolean
Whether the flag is a temporary flag
tagslist of strings
Tags for the feature flag
experimentsobject
Experimentation data for the feature flag
customPropertiesmap from strings to objects
Metadata attached to the feature flag, in the form of the property key associated with a name and array of values for the metadata to associate with this flag. Typically used to store data related to an integration.
archivedboolean
Boolean indicating if the feature flag is archived
descriptionstringOptional
Description of the feature flag
clientSideAvailabilityobjectOptional

Which type of client-side SDKs the feature flag is available to

maintainerIdstringOptional
Associated maintainerId for the feature flag
_maintainerobjectOptional
Associated maintainer member info for the feature flag
maintainerTeamKeystringOptional
The key of the associated team that maintains this feature flag
_maintainerTeamobjectOptional
Associated maintainer team info for the feature flag
archivedDatelongOptional
If archived is true, date of archive
deprecatedbooleanOptional
Boolean indicating if the feature flag is deprecated
deprecatedDatelongOptional
If deprecated is true, date of deprecation
defaultsobjectOptional
The indices, from the array of variations, for the variations to serve by default when targeting is on and when targeting is off. These variations will be used for this flag in new environments. If omitted, the first and last variation will be used.
_purposestringOptional
migrationSettingsobjectOptional

Migration-related settings for the flag

environmentsmap from strings to objectsOptional

Details on the environments for this flag. Only returned if the request is filtered by environment, using the filterEnv query parameter.

includeInSnippetbooleanOptionalDeprecated

Deprecated, use clientSideAvailability. Whether this flag should be made available to the client-side JavaScript SDK

goalIdslist of stringsOptionalDeprecated

Deprecated, use experiments instead

Errors