Create a feature flag with the given name, key, and variations.
<details>
<summary>Click to expand instructions for <strong>creating a migration flag</strong></summary>
### 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:
```json
{
"key": "flag-key-123",
"purpose": "migration",
"migrationSettings": {
"stageCount": 6,
"contextKind": "account"
}
}
```
To learn more, read [Migration Flags](https://launchdarkly.com/docs/home/flags/migration).
</details>
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
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
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
_linksmap from strings to objects
The location and content type of related resources
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.
migrationSettingsobjectOptional
Migration-related settings for the flag
staleobjectOptional
Information about a flag's stale states
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