> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.getunleash.io/api/create-feature/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.getunleash.io/_mcp/server. # Add a new feature flag POST https://app.unleash-instance.example.com/api/admin/projects/{projectId}/features Content-Type: application/json Create a new feature flag in a specified project. Reference: https://docs.getunleash.io/api/create-feature ## Authentication - `Authorization` header (required) — API key needed to access this API - `Authorization` header (bearer token, required) — API key needed to access this API, in Bearer token format ## Request ### Path parameters - `projectId` (string, required) ### Body (application/json) This endpoint expects a createFeatureSchema. - `name` (string, required) — Unique feature name - `type` (enum, optional) — The feature flag's [type](https://docs.getunleash.io/concepts/feature-flags#feature-flag-types). One of experiment, kill-switch, release, operational, permission, or sunset - Allowed values: `experiment`, `kill-switch`, `release`, `operational`, `permission`, `sunset` - `description` (string, optional, nullable) — Detailed description of the feature - `impressionData` (boolean, optional) — `true` if the impression data collection is enabled for the feature, otherwise `false`. - `tags` (list of tagSchema, optional) — Tags to add to the feature. ## Response ### 200 featureSchema - `name` (string, required) — Unique feature name - `type` (string, optional) — Type of the flag e.g. experiment, kill-switch, release, operational, permission - `description` (string, optional, nullable) — Detailed description of the feature - `archived` (boolean, optional) — `true` if the feature is archived - `project` (string, optional) — Name of the project the feature belongs to - `enabled` (boolean, optional) — `true` if the feature is enabled, otherwise `false`. - `stale` (boolean, optional) — `true` if the feature is stale based on the age and feature type, otherwise `false`. - `favorite` (boolean, optional) — `true` if the feature was favorited, otherwise `false`. - `impressionData` (boolean, optional) — `true` if the impression data collection is enabled for the feature, otherwise `false`. - `createdAt` (string, optional, nullable) — The date the feature was created - `createdBy` (FeatureSchemaCreatedBy, optional) — User who created the feature flag - `archivedAt` (string, optional, nullable) — The date the feature was archived - `environments` (list of featureEnvironmentSchema, optional) — The list of environments where the feature can be used - `tags` (list of tagSchema, optional, nullable) — The list of feature tags - `children` (list of string, optional) — The list of child feature names. This is an experimental field and may change. - `lifecycle` (FeatureSchemaLifecycle, optional) — Current lifecycle stage of the feature - `dependencies` (list of FeatureSchemaDependenciesItems, optional) — The list of parent dependencies. This is an experimental field and may change. - `collaborators` (FeatureSchemaCollaborators, optional) — Information related to users who have made changes to this feature flage. - `links` (list of FeatureSchemaLinksItems, optional) — The list of links. This is an experimental field and may change. ## Errors ### 401 Unauthorized Error Authorization information is missing or invalid. Provide a valid API token as the `authorization` header, e.g. `authorization:*.*.my-admin-token`. - `id` (string, optional) — The ID of the error instance - `name` (string, optional) — The name of the error kind - `message` (string, optional) — A description of what went wrong. ### 403 Forbidden Error The provided user credentials are valid, but the user does not have the necessary permissions to perform this operation - `id` (string, optional) — The ID of the error instance - `name` (string, optional) — The name of the error kind - `message` (string, optional) — A description of what went wrong. ### 404 Not Found Error The requested resource was not found. - `id` (string, optional) — The ID of the error instance - `name` (string, optional) — The name of the error kind - `message` (string, optional) — A description of what went wrong. ### 415 Unsupported Media Type Error The operation does not support request payloads of the provided type. Please ensure that you're using one of the listed payload types and that you have specified the right content type in the "content-type" header. - `id` (string, optional) — The ID of the error instance - `name` (string, optional) — The name of the error kind - `message` (string, optional) — A description of what went wrong. ## Types ### tagSchema Representation of a [tag](https://docs.getunleash.io/concepts/feature-flags#tags) - `value` (string, required) — The value of the tag. - `type` (string, required) — The [type](https://docs.getunleash.io/concepts/feature-flags#tags) of the tag - `color` (string, optional, nullable) — The hexadecimal color code for the tag type. ### FeatureSchemaCreatedBy User who created the feature flag - `id` (integer, required) — The user id - `name` (string, required) — Name of the user - `imageUrl` (string, required) — URL used for the user profile image ### featureEnvironmentSchema A detailed description of the feature environment - `name` (string, required) — The name of the environment - `enabled` (boolean, required) — `true` if the feature is enabled for the environment, otherwise `false`. - `featureName` (string, optional) — The name of the feature - `environment` (string, optional) — The name of the environment - `type` (string, optional) — The type of the environment - `sortOrder` (double, optional) — The sort order of the feature environment in the feature environments list - `variantCount` (double, optional) — The number of defined variants - `strategies` (list of featureStrategySchema, optional) — A list of activation strategies for the feature environment - `variants` (list of variantSchema, optional) — A list of variants for the feature environment - `changeRequestIds` (list of double, optional) — Experimental. A list of change request identifiers for actionable change requests that are not Cancelled, Rejected or Approved. - `milestoneName` (string, optional) — Experimental: The name of the currently active release plan milestone - `milestoneOrder` (double, optional) — Experimental: The zero-indexed order of currently active milestone in the list of all release plan milestones - `totalMilestones` (double, optional) — Experimental: The total number of milestones in the feature environment release plan - `lastSeenAt` (string, optional, nullable) — The date when metrics where last collected for the feature environment - `hasStrategies` (boolean, optional) — Whether the feature has any strategies defined. - `hasEnabledStrategies` (boolean, optional) — Whether the feature has any enabled strategies defined. - `releasePlans` (list of releasePlanSchema, optional) — Release plans for this feature environment - `safeguards` (list of featureEnvironmentSafeguardSchema, optional) — Safeguards for this feature environment - `yes` (integer, optional) — How many times the feature evaluated to true (enabled) - `no` (integer, optional) — How many times the feature evaluated to false (disabled) ### FeatureSchemaLifecycle Current lifecycle stage of the feature - `stage` (enum, required) — The name of the current lifecycle stage - Allowed values: `initial`, `pre-live`, `live`, `completed`, `archived` - `enteredStageAt` (string, required) — When the feature entered this stage - `status` (string, optional, nullable) — The name of the detailed status of a given stage. E.g. completed stage can be kept or discarded. ### FeatureSchemaDependenciesItems - `feature` (string, required) — The name of the parent feature - `enabled` (boolean, optional) — Whether the parent feature is enabled or not - `variants` (list of string, optional) — The list of variants the parent feature should resolve to. Only valid when feature is enabled. ### FeatureSchemaCollaborators Information related to users who have made changes to this feature flage. - `users` (list of FeatureSchemaCollaboratorsUsersItems, required) — Users who have made any changes to this feature flags. The list is sorted in reverse chronological order (most recent changes first) ### FeatureSchemaLinksItems - `id` (string, required) — The id of the link - `url` (string, required) — The URL the feature is linked to - `title` (string, optional, nullable) — The description of the link - `feature` (string, optional) — The name of the feature this link belongs to ### featureStrategySchema A single activation strategy configuration schema for a feature - `name` (string, required) — The name or type of strategy - `id` (string, optional) — A uuid for the feature strategy - `title` (string, optional, nullable) — A descriptive title for the strategy - `disabled` (boolean, optional, nullable) — A toggle to disable the strategy. defaults to false. Disabled strategies are not evaluated or returned to the SDKs - `featureName` (string, optional) — The name or feature the strategy is attached to - `sortOrder` (double, optional) — The order of the strategy in the list - `segments` (list of double, optional) — A list of segment ids attached to the strategy - `constraints` (list of constraintSchema, optional) — A list of the constraints attached to the strategy. See https://docs.getunleash.io/concepts/activation-strategies#constraints - `variants` (list of strategyVariantSchema, optional) — Strategy level variants - `parameters` (map from string to string, optional) — A list of parameters for a strategy ### variantSchema A variant allows for further separation of users into segments. See [our excellent documentation](https://docs.getunleash.io/concepts/feature-flag-variants#what-are-variants) for a more detailed description - `name` (string, required) — The variants name. Is unique for this feature flag - `weight` (double, required) — The weight is the likelihood of any one user getting this variant. It is a number between 0 and 1000. See the section on [variant weights](https://docs.getunleash.io/concepts/feature-flag-variants#variant-weight) for more information - `weightType` (enum, optional) — Set to fix if this variant must have exactly the weight allocated to it. If the type is variable, the weight will adjust so that the total weight of all variants adds up to 1000 - Allowed values: `variable`, `fix` - `stickiness` (string, optional) — [Stickiness](https://docs.getunleash.io/concepts/feature-flag-variants#variant-stickiness) is how Unleash guarantees that the same user gets the same variant every time - `payload` (VariantSchemaPayload, optional) — Extra data configured for this variant - `overrides` (list of overrideSchema, optional) — Overrides assigning specific variants to specific users. The weighting system automatically assigns users to specific groups for you, but any overrides in this list will take precedence. ### releasePlanSchema Schema representing the creation of a release plan. - `id` (string, required) — The release plan/template's ID. Release template IDs are ulids. - `discriminator` (enum, required) — A field to distinguish between release plans and release templates. - Allowed values: `plan` - `name` (string, required) — The name of the release template. - `featureName` (string, required) — The name of the feature that uses this release plan. - `environment` (string, required) — The environment that this release plan is for. - `createdByUserId` (double, required) — Release template: The ID of the user who created this template. - `createdAt` (string, required) — The date and time that the release template was created. - `milestones` (list of releasePlanMilestoneSchema, required) — A list of the milestones in this release template. - `releasePlanTemplateId` (string, required) — The ID of the release plan template that this release plan is based on. - `description` (string, optional, nullable) — A description of the release template. - `activeMilestoneId` (string, optional, nullable) — The ID of the currently active milestone in this release plan. - `safeguards` (list of releasePlanSafeguardSchema, optional) — An array of safeguards configured for this release plan. ### featureEnvironmentSafeguardSchema A safeguard configuration for a feature environment. - `id` (string, required) — The unique ULID identifier for this safeguard - `action` (FeatureEnvironmentSafeguardSchemaAction, required) — Disable a feature in an environment when triggered. - `triggerCondition` (safeguardTriggerConditionSchema, required) — The condition that triggers the safeguard. - `impactMetric` (FeatureEnvironmentSafeguardSchemaImpactMetric, required) — The metric configuration used to evaluate the safeguard condition. ### FeatureSchemaCollaboratorsUsersItems A simple representation of a user. - `id` (integer, required) — The user's id - `name` (string, required) — The user's name, username, or email (prioritized in that order). If none of those are present, this property will be set to the string `unknown` - `imageUrl` (string, required) — The URL to the user's profile image ### constraintSchema A strategy constraint. For more information, refer to [the strategy constraint reference documentation](https://docs.getunleash.io/concepts/activation-strategies#constraints) - `contextName` (string, required) — The name of the context field that this constraint should apply to. - `operator` (enum, required) — The operator to use when evaluating this constraint. For more information about the various operators, refer to [the strategy constraint operator documentation](https://docs.getunleash.io/concepts/activation-strategies#constraint-operators). - Allowed values: `NOT_IN`, `IN`, `STR_ENDS_WITH`, `STR_STARTS_WITH`, `STR_CONTAINS`, `NUM_EQ`, `NUM_GT`, `NUM_GTE`, `NUM_LT`, `NUM_LTE`, `DATE_AFTER`, `DATE_BEFORE`, `SEMVER_EQ`, `SEMVER_GT`, `SEMVER_LT`, `SEMVER_GTE`, `SEMVER_LTE`, `REGEX` - `caseInsensitive` (boolean, optional, default: false) — Whether the operator should be case sensitive or not. Defaults to `false` (being case sensitive). - `inverted` (boolean, optional, default: false) — Whether the result should be negated or not. If `true`, will turn a `true` result into a `false` result and vice versa. - `values` (list of string, optional) — The context values that should be used for constraint evaluation. Use this property instead of `value` for properties that accept multiple values. - `value` (string, optional) — The context value that should be used for constraint evaluation. Use this property instead of `values` for properties that only accept single values. ### strategyVariantSchema This is an experimental property. It may change or be removed as we work on it. Please don't depend on it yet. A strategy variant allows you to attach any data to strategies instead of only returning `true`/`false`. Strategy variants take precedence over feature variants. - `name` (string, required) — The variant name. Must be unique for this feature flag - `weight` (integer, required) — The weight is the likelihood of any one user getting this variant. It is an integer between 0 and 1000. See the section on [variant weights](https://docs.getunleash.io/concepts/feature-flag-variants#variant-weight) for more information - `weightType` (enum, required) — Set to `fix` if this variant must have exactly the weight allocated to it. If the type is `variable`, the weight will adjust so that the total weight of all variants adds up to 1000. Refer to the [variant weight documentation](https://docs.getunleash.io/concepts/feature-flag-variants#variant-weight). - Allowed values: `variable`, `fix` - `stickiness` (string, required) — The [stickiness](https://docs.getunleash.io/concepts/feature-flag-variants#variant-stickiness) to use for distribution of this variant. Stickiness is how Unleash guarantees that the same user gets the same variant every time - `payload` (StrategyVariantSchemaPayload, optional) — Extra data configured for this variant ### VariantSchemaPayload Extra data configured for this variant - `type` (enum, required) — The type of the value. Commonly used types are string, number, json and csv. - Allowed values: `json`, `csv`, `string`, `number` - `value` (string, required) — The actual value of payload ### overrideSchema An override for deciding which variant should be assigned to a user based on the context name - `contextName` (string, required) — The name of the context field used to determine overrides - `values` (list of string, required) — Which values that should be overriden ### releasePlanMilestoneSchema Schema representing the creation of a release plan milestone. - `id` (string, required) — The milestone's ID. Milestone IDs are ulids. - `name` (string, required) — The name of the milestone. - `sortOrder` (integer, required) — The order of the milestone in the release plan. - `releasePlanDefinitionId` (string, required) — The ID of the release plan/template that this milestone belongs to. - `startedAt` (string, optional, nullable) — The date and time when the milestone was started. - `transitionCondition` (ReleasePlanMilestoneSchemaTransitionCondition, optional, nullable) — The condition configuration for the transition. - `progressionExecutedAt` (string, optional, nullable) — The date and time when the milestone progression was executed. - `pausedAt` (string, optional, nullable) — The date and time when the milestone was paused. - `strategies` (list of releasePlanMilestoneStrategySchema, optional) — A list of strategies that are attached to this milestone. ### releasePlanSafeguardSchema A safeguard configuration for a release plan. - `id` (string, required) — The unique ULID identifier for this safeguard - `action` (ReleasePlanSafeguardSchemaAction, required) — The action to take when the safeguard is triggered. - `triggerCondition` (safeguardTriggerConditionSchema, required) — The condition that triggers the safeguard. - `impactMetric` (ReleasePlanSafeguardSchemaImpactMetric, required) — The metric configuration used to evaluate the safeguard condition. ### FeatureEnvironmentSafeguardSchemaAction Disable a feature in an environment when triggered. - `type` (string, required) — The type of action to perform. - `featureName` (string, required) — The feature flag name this safeguard applies to. - `environment` (string, required) — The environment this safeguard applies to. - `project` (string, required) — The project this safeguard applies to. ### safeguardTriggerConditionSchema The condition that triggers the safeguard. - `operator` (enum, required) — The comparison operator for the threshold check. - Allowed values: `>`, `<` - `threshold` (double, required) — The threshold value to compare against. ### FeatureEnvironmentSafeguardSchemaImpactMetric The metric configuration used to evaluate the safeguard condition. - `id` (string, required) — The unique identifier for this impact metric - `metricName` (string, required) — The Prometheus metric series to query. It includes both unleash prefix and metric type and display name - `timeRange` (enum, required) — The time range for the metric data. - Allowed values: `hour`, `day`, `week`, `month` - `aggregationMode` (enum, required) — The aggregation mode for the metric data. - Allowed values: `rps`, `count`, `avg`, `sum`, `p95`, `p99`, `p50` - `labelSelectors` (map from string to list of string, required) — The selected labels and their values for filtering the metric data. - `source` (enum, optional) — The Prometheus data source for this metric. Internal is the Unleash-managed Prometheus, external is a customer-provided Prometheus instance. Defaults to internal if not specified. - Allowed values: `internal`, `external` ### StrategyVariantSchemaPayload Extra data configured for this variant - `type` (enum, required) — The type of the value. Commonly used types are string, number, json and csv. - Allowed values: `json`, `csv`, `string`, `number` - `value` (string, required) — The actual value of payload ### ReleasePlanMilestoneSchemaTransitionCondition The condition configuration for the transition. ### releasePlanMilestoneStrategySchema Schema representing the creation of a release plan milestone strategy. - `id` (string, required) — The milestone strategy's ID. Milestone strategy IDs are ulids. - `milestoneId` (string, required) — The ID of the milestone that this strategy belongs to. - `sortOrder` (double, required) — The order of the strategy in the list - `name` (string, required) — The name of the strategy type - `strategyName` (string, required, deprecated) — The name of the strategy type - `title` (string, optional, nullable) — A descriptive title for the strategy - `parameters` (map from string to string, optional) — An object containing the parameters for the strategy - `constraints` (list of constraintSchema, optional) — A list of the constraints attached to the strategy. See https://docs.getunleash.io/concepts/activation-strategies#constraints - `variants` (list of createStrategyVariantSchema, optional) — Strategy level variants - `segments` (list of double, optional) — Ids of segments to use for this strategy - `disabled` (boolean, optional, nullable) — A toggle to disable the strategy. defaults to false. Disabled strategies are not evaluated or returned to the SDKs ### ReleasePlanSafeguardSchemaAction The action to take when the safeguard is triggered. - `type` (string, required) — The type of action to perform. - `id` (string, required) — The ID of the release plan this safeguard applies to. ### ReleasePlanSafeguardSchemaImpactMetric The metric configuration used to evaluate the safeguard condition. - `id` (string, required) — The unique identifier for this impact metric - `metricName` (string, required) — The Prometheus metric series to query. It includes both unleash prefix and metric type and display name - `timeRange` (enum, required) — The time range for the metric data. - Allowed values: `hour`, `day`, `week`, `month` - `aggregationMode` (enum, required) — The aggregation mode for the metric data. - Allowed values: `rps`, `count`, `avg`, `sum`, `p95`, `p99`, `p50` - `labelSelectors` (map from string to list of string, required) — The selected labels and their values for filtering the metric data. - `source` (enum, optional) — The Prometheus data source for this metric. Internal is the Unleash-managed Prometheus, external is a customer-provided Prometheus instance. Defaults to internal if not specified. - Allowed values: `internal`, `external` ### createStrategyVariantSchema This is an experimental property. It may change or be removed as we work on it. Please don't depend on it yet. A strategy variant allows you to attach any data to strategies instead of only returning `true`/`false`. Strategy variants take precedence over feature variants. - `name` (string, required) — The variant name. Must be unique for this feature flag - `weight` (integer, required) — The weight is the likelihood of any one user getting this variant. It is an integer between 0 and 1000. See the section on [variant weights](https://docs.getunleash.io/concepts/feature-flag-variants#variant-weight) for more information - `weightType` (enum, required) — Set to `fix` if this variant must have exactly the weight allocated to it. If the type is `variable`, the weight will adjust so that the total weight of all variants adds up to 1000. Refer to the [variant weight documentation](https://docs.getunleash.io/concepts/feature-flag-variants#variant-weight). - Allowed values: `variable`, `fix` - `stickiness` (string, required) — The [stickiness](https://docs.getunleash.io/concepts/feature-flag-variants#variant-stickiness) to use for distribution of this variant. Stickiness is how Unleash guarantees that the same user gets the same variant every time - `payload` (CreateStrategyVariantSchemaPayload, optional) — Extra data configured for this variant ### CreateStrategyVariantSchemaPayload Extra data configured for this variant - `type` (enum, required) — The type of the value. Commonly used types are string, number, json and csv. - Allowed values: `json`, `csv`, `string`, `number` - `value` (string, required) — The actual value of payload ## Examples **Request** ```json { "name": "disable-comments" } ``` **Response** ```json { "name": "disable-comments", "type": "kill-switch", "description": "Controls disabling of the comments section in case of an incident", "archived": true, "project": "dx-squad", "enabled": true, "stale": false, "favorite": true, "impressionData": false, "createdAt": "2023-01-28T15:21:39.975Z", "createdBy": { "id": 123, "name": "User", "imageUrl": "https://example.com/242x200.png" }, "archivedAt": "2023-01-29T15:21:39.975Z", "environments": [ { "name": "my-dev-env", "enabled": true, "featureName": "disable-comments", "environment": "development", "type": "development", "sortOrder": 3, "variantCount": 1.1, "strategies": [ { "name": "flexibleRollout", "id": "6b5157cb-343a-41e7-bfa3-7b4ec3044840", "title": "Gradual Rollout 25-Prod", "disabled": false, "featureName": "myAwesomeFeature", "sortOrder": 9999, "segments": [ 1, 2 ], "constraints": [ { "contextName": "appName", "operator": "IN", "caseInsensitive": false, "inverted": false, "values": [ "my-app", "my-other-app" ], "value": "my-app" } ], "variants": [ { "name": "blue_group", "weight": 1, "weightType": "fix", "stickiness": "custom.context.field", "payload": { "type": "json", "value": "{\"color\": \"red\"}" } } ], "parameters": {} } ], "variants": [ { "name": "blue_group", "weight": 1.1, "weightType": "variable", "stickiness": "custom.context.field", "payload": { "type": "json", "value": "{\"color\": \"red\"}" }, "overrides": [ { "contextName": "userId", "values": [ "red", "blue" ] } ] } ], "changeRequestIds": [ 1.1 ], "milestoneName": "Phase One", "milestoneOrder": 0, "totalMilestones": 0, "lastSeenAt": "2023-01-28T16:21:39.975Z", "hasStrategies": true, "hasEnabledStrategies": true, "releasePlans": [ { "id": "01JB9GGTGQYEQ9D40R17T3YVW2", "discriminator": "plan", "name": "My release plan", "featureName": "my-feature", "environment": "production", "createdByUserId": 53, "createdAt": "2022-01-01T00:00:00Z", "milestones": [ { "id": "01JB9GGTGQYEQ9D40R17T3YVW1", "name": "My milestone", "sortOrder": 1, "releasePlanDefinitionId": "01JB9GGTGQYEQ9D40R17T3YVW2", "startedAt": "2024-01-01T00:00:00.000Z", "transitionCondition": {}, "progressionExecutedAt": "2024-01-01T00:00:00.000Z", "pausedAt": "2024-01-01T00:00:00.000Z", "strategies": [ { "id": "01JB9GGTGQYEQ9D40R17T3YVW3", "milestoneId": "01JB9GGTGQYEQ9D40R17T3YVW1", "sortOrder": 9999, "name": "flexibleRollout", "strategyName": "flexibleRollout", "title": "Gradual Rollout 25-Prod", "parameters": { "groupId": "some_new", "rollout": "25", "stickiness": "sessionId" }, "constraints": [ { "contextName": "appName", "operator": "IN", "caseInsensitive": false, "inverted": false, "values": [ "1", "2" ] } ], "variants": [ { "name": "blue_group", "weight": 1, "weightType": "fix", "stickiness": "custom.context.field", "payload": { "type": "json", "value": "{\"color\": \"red\"}" } } ], "segments": [ 1, 2 ], "disabled": false } ] } ], "releasePlanTemplateId": "01JB9GGTGQYEQ9D40R17T3YVW2", "description": "This is my release plan", "activeMilestoneId": "01JB9GGTGQYEQ9D40R17T3YVW1", "safeguards": [ { "id": "01JB9GGTGQYEQ9D40R17T3YVW1", "action": { "type": "pauseReleasePlanProgressions", "id": "01JB9GGTGQYEQ9D40R17T3YVW2" }, "triggerCondition": { "operator": ">", "threshold": 100 }, "impactMetric": { "id": "01JB9GGTGQYEQ9D40R17T3YVW1", "metricName": "unleash_counter_feature_toggle_usage_total", "timeRange": "day", "aggregationMode": "rps", "labelSelectors": { "environment": [ "development" ], "project": [ "default" ] }, "source": "internal" } } ] } ], "safeguards": [ { "id": "01JB9GGTGQYEQ9D40R17T3YVW1", "action": { "type": "disableFeatureEnvironment", "featureName": "string", "environment": "string", "project": "string" }, "triggerCondition": { "operator": ">", "threshold": 100 }, "impactMetric": { "id": "01JB9GGTGQYEQ9D40R17T3YVW1", "metricName": "unleash_counter_feature_toggle_usage_total", "timeRange": "day", "aggregationMode": "rps", "labelSelectors": { "environment": [ "development" ], "project": [ "default" ] }, "source": "internal" } } ], "yes": 974, "no": 50 } ], "tags": [ { "value": "a-tag-value", "type": "simple", "color": "#FFFFFF" } ], "children": [ "some-feature" ], "lifecycle": { "stage": "initial", "enteredStageAt": "2023-01-28T15:21:39.975Z", "status": "kept" }, "dependencies": [ { "feature": "some-feature", "enabled": true, "variants": [ "some-feature-blue-variant" ] } ], "collaborators": { "users": [ { "id": 123, "name": "User", "imageUrl": "https://example.com/242x200.png" } ] }, "links": [ { "id": "01JTJNCJ5XVP2KPJFA03YRBZCA", "url": "https://github.com/search?q=cleanupReminder&type=code", "title": "Github cleanup", "feature": "disable-comments" } ] } ``` **SDK Code** ```python import requests url = "https://app.unleash-instance.example.com/api/admin/projects/projectId/features" payload = { "name": "disable-comments" } headers = { "Authorization": "", "Content-Type": "application/json" } response = requests.post(url, json=payload, headers=headers) print(response.json()) ``` ```javascript const url = 'https://app.unleash-instance.example.com/api/admin/projects/projectId/features'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{"name":"disable-comments"}' }; try { const response = await fetch(url, options); const data = await response.json(); console.log(data); } catch (error) { console.error(error); } ``` ```go package main import ( "fmt" "strings" "net/http" "io" ) func main() { url := "https://app.unleash-instance.example.com/api/admin/projects/projectId/features" payload := strings.NewReader("{\n \"name\": \"disable-comments\"\n}") req, _ := http.NewRequest("POST", url, payload) req.Header.Add("Authorization", "") req.Header.Add("Content-Type", "application/json") res, _ := http.DefaultClient.Do(req) defer res.Body.Close() body, _ := io.ReadAll(res.Body) fmt.Println(res) fmt.Println(string(body)) } ``` ```ruby require 'uri' require 'net/http' url = URI("https://app.unleash-instance.example.com/api/admin/projects/projectId/features") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Post.new(url) request["Authorization"] = '' request["Content-Type"] = 'application/json' request.body = "{\n \"name\": \"disable-comments\"\n}" response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.post("https://app.unleash-instance.example.com/api/admin/projects/projectId/features") .header("Authorization", "") .header("Content-Type", "application/json") .body("{\n \"name\": \"disable-comments\"\n}") .asString(); ``` ```php request('POST', 'https://app.unleash-instance.example.com/api/admin/projects/projectId/features', [ 'body' => '{ "name": "disable-comments" }', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://app.unleash-instance.example.com/api/admin/projects/projectId/features"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{\n \"name\": \"disable-comments\"\n}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = ["name": "disable-comments"] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://app.unleash-instance.example.com/api/admin/projects/projectId/features")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "POST" request.allHTTPHeaderFields = headers request.httpBody = postData as Data let session = URLSession.shared let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in if (error != nil) { print(error as Any) } else { let httpResponse = response as? HTTPURLResponse print(httpResponse) } }) dataTask.resume() ```