# Get a feature GET https://app.unleash-instance.example.com/api/admin/projects/{projectId}/features/{featureName} This endpoint returns the information about the requested feature if the feature belongs to the specified project. Reference: https://docs.getunleash.io/api/get-feature ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Get a feature version: endpoint_features.getFeature paths: /api/admin/projects/{projectId}/features/{featureName}: get: operationId: get-feature summary: Get a feature description: >- This endpoint returns the information about the requested feature if the feature belongs to the specified project. tags: - - subpackage_features parameters: - name: projectId in: path required: true schema: type: string - name: featureName in: path required: true schema: type: string - name: Authorization in: header description: Header authentication of the form `undefined ` required: true schema: type: string responses: '200': description: featureSchema content: application/json: schema: $ref: '#/components/schemas/featureSchema' '401': description: >- Authorization information is missing or invalid. Provide a valid API token as the `authorization` header, e.g. `authorization:*.*.my-admin-token`. content: {} '403': description: >- The provided user credentials are valid, but the user does not have the necessary permissions to perform this operation content: {} '404': description: The requested resource was not found. content: {} components: schemas: FeatureSchemaCreatedBy: type: object properties: id: type: integer description: The user id name: type: string description: Name of the user imageUrl: type: string description: URL used for the user profile image required: - id - name - imageUrl ConstraintSchemaOperator: type: string enum: - value: NOT_IN - value: IN - value: STR_ENDS_WITH - value: STR_STARTS_WITH - value: STR_CONTAINS - value: NUM_EQ - value: NUM_GT - value: NUM_GTE - value: NUM_LT - value: NUM_LTE - value: DATE_AFTER - value: DATE_BEFORE - value: SEMVER_EQ - value: SEMVER_GT - value: SEMVER_LT constraintSchema: type: object properties: contextName: type: string description: The name of the context field that this constraint should apply to. operator: $ref: '#/components/schemas/ConstraintSchemaOperator' description: >- 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). caseInsensitive: type: boolean default: false description: >- Whether the operator should be case sensitive or not. Defaults to `false` (being case sensitive). inverted: type: boolean default: false description: >- Whether the result should be negated or not. If `true`, will turn a `true` result into a `false` result and vice versa. values: type: array items: type: string description: >- The context values that should be used for constraint evaluation. Use this property instead of `value` for properties that accept multiple values. value: type: string description: >- The context value that should be used for constraint evaluation. Use this property instead of `values` for properties that only accept single values. required: - contextName - operator StrategyVariantSchemaWeightType: type: string enum: - value: variable - value: fix StrategyVariantSchemaPayloadType: type: string enum: - value: json - value: csv - value: string - value: number StrategyVariantSchemaPayload: type: object properties: type: $ref: '#/components/schemas/StrategyVariantSchemaPayloadType' description: >- The type of the value. Commonly used types are string, number, json and csv. value: type: string description: The actual value of payload required: - type - value strategyVariantSchema: type: object properties: name: type: string description: The variant name. Must be unique for this feature flag weight: type: integer description: >- 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: $ref: '#/components/schemas/StrategyVariantSchemaWeightType' description: >- 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). stickiness: type: string description: >- 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: $ref: '#/components/schemas/StrategyVariantSchemaPayload' description: Extra data configured for this variant required: - name - weight - weightType - stickiness parametersSchema: type: object additionalProperties: type: string featureStrategySchema: type: object properties: id: type: string description: A uuid for the feature strategy name: type: string description: The name or type of strategy title: type: - string - 'null' description: A descriptive title for the strategy disabled: type: - boolean - 'null' description: >- A toggle to disable the strategy. defaults to false. Disabled strategies are not evaluated or returned to the SDKs featureName: type: string description: The name or feature the strategy is attached to sortOrder: type: number format: double description: The order of the strategy in the list segments: type: array items: type: number format: double description: A list of segment ids attached to the strategy constraints: type: array items: $ref: '#/components/schemas/constraintSchema' description: >- A list of the constraints attached to the strategy. See https://docs.getunleash.io/concepts/activation-strategies#constraints variants: type: array items: $ref: '#/components/schemas/strategyVariantSchema' description: Strategy level variants parameters: $ref: '#/components/schemas/parametersSchema' required: - name VariantSchemaWeightType: type: string enum: - value: variable - value: fix VariantSchemaPayloadType: type: string enum: - value: json - value: csv - value: string - value: number VariantSchemaPayload: type: object properties: type: $ref: '#/components/schemas/VariantSchemaPayloadType' description: >- The type of the value. Commonly used types are string, number, json and csv. value: type: string description: The actual value of payload required: - type - value overrideSchema: type: object properties: contextName: type: string description: The name of the context field used to determine overrides values: type: array items: type: string description: Which values that should be overriden required: - contextName - values variantSchema: type: object properties: name: type: string description: The variants name. Is unique for this feature flag weight: type: number format: double description: >- 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: $ref: '#/components/schemas/VariantSchemaWeightType' description: >- 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 stickiness: type: string description: >- [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: $ref: '#/components/schemas/VariantSchemaPayload' description: Extra data configured for this variant overrides: type: array items: $ref: '#/components/schemas/overrideSchema' description: >- 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. required: - name - weight ReleasePlanSchemaDiscriminator: type: string enum: - value: plan ReleasePlanMilestoneSchemaTransitionCondition: type: object properties: intervalMinutes: type: integer description: The interval in minutes before transitioning required: - intervalMinutes CreateStrategyVariantSchemaWeightType: type: string enum: - value: variable - value: fix CreateStrategyVariantSchemaPayloadType: type: string enum: - value: json - value: csv - value: string - value: number CreateStrategyVariantSchemaPayload: type: object properties: type: $ref: '#/components/schemas/CreateStrategyVariantSchemaPayloadType' description: >- The type of the value. Commonly used types are string, number, json and csv. value: type: string description: The actual value of payload required: - type - value createStrategyVariantSchema: type: object properties: name: type: string description: The variant name. Must be unique for this feature flag weight: type: integer description: >- 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: $ref: '#/components/schemas/CreateStrategyVariantSchemaWeightType' description: >- 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). stickiness: type: string description: >- 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: $ref: '#/components/schemas/CreateStrategyVariantSchemaPayload' description: Extra data configured for this variant required: - name - weight - weightType - stickiness releasePlanMilestoneStrategySchema: type: object properties: id: type: string description: The milestone strategy's ID. Milestone strategy IDs are ulids. milestoneId: type: string description: The ID of the milestone that this strategy belongs to. sortOrder: type: number format: double description: The order of the strategy in the list title: type: - string - 'null' description: A descriptive title for the strategy strategyName: type: string description: The name of the strategy type parameters: $ref: '#/components/schemas/parametersSchema' description: An object containing the parameters for the strategy constraints: type: array items: $ref: '#/components/schemas/constraintSchema' description: >- A list of the constraints attached to the strategy. See https://docs.getunleash.io/concepts/activation-strategies#constraints variants: type: array items: $ref: '#/components/schemas/createStrategyVariantSchema' description: Strategy level variants segments: type: array items: type: number format: double description: Ids of segments to use for this strategy required: - id - milestoneId - sortOrder - strategyName releasePlanMilestoneSchema: type: object properties: id: type: string description: The milestone's ID. Milestone IDs are ulids. name: type: string description: The name of the milestone. sortOrder: type: integer description: The order of the milestone in the release plan. releasePlanDefinitionId: type: string description: The ID of the release plan/template that this milestone belongs to. startedAt: type: - string - 'null' format: date-time description: The date and time when the milestone was started. transitionCondition: oneOf: - $ref: >- #/components/schemas/ReleasePlanMilestoneSchemaTransitionCondition - type: 'null' description: The condition configuration for the transition progressionExecutedAt: type: - string - 'null' format: date-time description: The date and time when the milestone progression was executed. pausedAt: type: - string - 'null' format: date-time description: The date and time when the milestone was paused. strategies: type: array items: $ref: '#/components/schemas/releasePlanMilestoneStrategySchema' description: A list of strategies that are attached to this milestone. required: - id - name - sortOrder - releasePlanDefinitionId SafeguardSchemaAction: type: object properties: type: type: string description: The type of action to perform. id: type: string description: The ID of the release plan this safeguard applies to. required: - type - id SafeguardTriggerConditionSchemaOperator: type: string enum: - value: '>' - value: < safeguardTriggerConditionSchema: type: object properties: operator: $ref: '#/components/schemas/SafeguardTriggerConditionSchemaOperator' description: The comparison operator for the threshold check. threshold: type: number format: double description: The threshold value to compare against. required: - operator - threshold SafeguardSchemaImpactMetricTimeRange: type: string enum: - value: hour - value: day - value: week - value: month SafeguardSchemaImpactMetricAggregationMode: type: string enum: - value: rps - value: count - value: avg - value: sum - value: p95 - value: p99 - value: p50 SafeguardSchemaImpactMetric: type: object properties: id: type: string description: The unique identifier for this impact metric metricName: type: string description: >- The Prometheus metric series to query. It includes both unleash prefix and metric type and display name timeRange: $ref: '#/components/schemas/SafeguardSchemaImpactMetricTimeRange' description: The time range for the metric data. aggregationMode: $ref: '#/components/schemas/SafeguardSchemaImpactMetricAggregationMode' description: The aggregation mode for the metric data. labelSelectors: type: object additionalProperties: type: array items: type: string description: The selected labels and their values for filtering the metric data. required: - id - metricName - timeRange - aggregationMode - labelSelectors safeguardSchema: type: object properties: id: type: string description: The unique ULID identifier for this safeguard action: $ref: '#/components/schemas/SafeguardSchemaAction' description: The action to take when the safeguard is triggered. triggerCondition: $ref: '#/components/schemas/safeguardTriggerConditionSchema' description: The condition that triggers the safeguard. impactMetric: $ref: '#/components/schemas/SafeguardSchemaImpactMetric' description: The metric configuration used to evaluate the safeguard condition. required: - id - action - triggerCondition - impactMetric releasePlanSchema: type: object properties: id: type: string description: The release plan/template's ID. Release template IDs are ulids. discriminator: $ref: '#/components/schemas/ReleasePlanSchemaDiscriminator' description: A field to distinguish between release plans and release templates. name: type: string description: The name of the release template. description: type: - string - 'null' description: A description of the release template. featureName: type: string description: The name of the feature that uses this release plan. environment: type: string description: The environment that this release plan is for. createdByUserId: type: number format: double description: 'Release template: The ID of the user who created this template.' createdAt: type: string format: date-time description: The date and time that the release template was created. activeMilestoneId: type: - string - 'null' description: The ID of the currently active milestone in this release plan. milestones: type: array items: $ref: '#/components/schemas/releasePlanMilestoneSchema' description: A list of the milestones in this release template. releasePlanTemplateId: type: string description: >- The ID of the release plan template that this release plan is based on. safeguards: type: array items: $ref: '#/components/schemas/safeguardSchema' description: An array of safeguards configured for this release plan. required: - id - discriminator - name - featureName - environment - createdByUserId - createdAt - milestones - releasePlanTemplateId featureEnvironmentSchema: type: object properties: name: type: string description: The name of the environment featureName: type: string description: The name of the feature environment: type: string description: The name of the environment type: type: string description: The type of the environment enabled: type: boolean description: >- `true` if the feature is enabled for the environment, otherwise `false`. sortOrder: type: number format: double description: >- The sort order of the feature environment in the feature environments list variantCount: type: number format: double description: The number of defined variants strategies: type: array items: $ref: '#/components/schemas/featureStrategySchema' description: A list of activation strategies for the feature environment variants: type: array items: $ref: '#/components/schemas/variantSchema' description: A list of variants for the feature environment changeRequestIds: type: array items: type: number format: double description: >- Experimental. A list of change request identifiers for actionable change requests that are not Cancelled, Rejected or Approved. milestoneName: type: string description: >- Experimental: The name of the currently active release plan milestone milestoneOrder: type: number format: double description: >- Experimental: The zero-indexed order of currently active milestone in the list of all release plan milestones totalMilestones: type: number format: double description: >- Experimental: The total number of milestones in the feature environment release plan lastSeenAt: type: - string - 'null' format: date-time description: >- The date when metrics where last collected for the feature environment hasStrategies: type: boolean description: Whether the feature has any strategies defined. hasEnabledStrategies: type: boolean description: Whether the feature has any enabled strategies defined. releasePlans: type: array items: $ref: '#/components/schemas/releasePlanSchema' description: >- Release plans for this feature environment (only available when milestoneProgression feature flag is enabled) 'yes': type: integer description: How many times the feature evaluated to true (enabled) 'no': type: integer description: How many times the feature evaluated to false (disabled) required: - name - enabled FeatureSchemaStrategiesItems: type: object properties: {} tagSchema: type: object properties: value: type: string description: The value of the tag. type: type: string description: >- The [type](https://docs.getunleash.io/concepts/feature-flags#tags) of the tag color: type: - string - 'null' description: The hexadecimal color code for the tag type. required: - value - type FeatureSchemaLifecycleStage: type: string enum: - value: initial - value: pre-live - value: live - value: completed - value: archived FeatureSchemaLifecycle: type: object properties: stage: $ref: '#/components/schemas/FeatureSchemaLifecycleStage' description: The name of the current lifecycle stage status: type: - string - 'null' description: >- The name of the detailed status of a given stage. E.g. completed stage can be kept or discarded. enteredStageAt: type: string format: date-time description: When the feature entered this stage required: - stage - enteredStageAt FeatureSchemaDependenciesItems: type: object properties: feature: type: string description: The name of the parent feature enabled: type: boolean description: Whether the parent feature is enabled or not variants: type: array items: type: string description: >- The list of variants the parent feature should resolve to. Only valid when feature is enabled. required: - feature FeatureSchemaCollaboratorsUsersItems: type: object properties: id: type: integer description: The user's id name: type: string description: >- 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: type: string description: The URL to the user's profile image required: - id - name - imageUrl FeatureSchemaCollaborators: type: object properties: users: type: array items: $ref: '#/components/schemas/FeatureSchemaCollaboratorsUsersItems' description: >- Users who have made any changes to this feature flags. The list is sorted in reverse chronological order (most recent changes first) required: - users FeatureSchemaLinksItems: type: object properties: id: type: string description: The id of the link url: type: string description: The URL the feature is linked to title: type: - string - 'null' description: The description of the link feature: type: string description: The name of the feature this link belongs to required: - id - url featureSchema: type: object properties: name: type: string description: Unique feature name type: type: string description: >- Type of the flag e.g. experiment, kill-switch, release, operational, permission description: type: - string - 'null' description: Detailed description of the feature archived: type: boolean description: '`true` if the feature is archived' project: type: string description: Name of the project the feature belongs to enabled: type: boolean description: '`true` if the feature is enabled, otherwise `false`.' stale: type: boolean description: >- `true` if the feature is stale based on the age and feature type, otherwise `false`. favorite: type: boolean description: '`true` if the feature was favorited, otherwise `false`.' impressionData: type: boolean description: >- `true` if the impression data collection is enabled for the feature, otherwise `false`. createdAt: type: - string - 'null' format: date-time description: The date the feature was created createdBy: $ref: '#/components/schemas/FeatureSchemaCreatedBy' description: User who created the feature flag archivedAt: type: - string - 'null' format: date-time description: The date the feature was archived lastSeenAt: type: - string - 'null' format: date-time description: >- The date when metrics where last collected for the feature. This field was deprecated in v5, use the one in featureEnvironmentSchema environments: type: array items: $ref: '#/components/schemas/featureEnvironmentSchema' description: The list of environments where the feature can be used variants: type: array items: $ref: '#/components/schemas/variantSchema' description: The list of feature variants strategies: type: array items: $ref: '#/components/schemas/FeatureSchemaStrategiesItems' description: >- This was deprecated in v5 and will be removed in a future major version tags: type: - array - 'null' items: $ref: '#/components/schemas/tagSchema' description: The list of feature tags children: type: array items: type: string description: >- The list of child feature names. This is an experimental field and may change. lifecycle: $ref: '#/components/schemas/FeatureSchemaLifecycle' description: Current lifecycle stage of the feature dependencies: type: array items: $ref: '#/components/schemas/FeatureSchemaDependenciesItems' description: >- The list of parent dependencies. This is an experimental field and may change. collaborators: $ref: '#/components/schemas/FeatureSchemaCollaborators' description: >- Information related to users who have made changes to this feature flage. links: type: array items: $ref: '#/components/schemas/FeatureSchemaLinksItems' description: The list of links. This is an experimental field and may change. required: - name ``` ## SDK Code Examples ```python import requests url = "https://app.unleash-instance.example.com/api/admin/projects/projectId/features/featureName" headers = {"Authorization": ""} response = requests.get(url, headers=headers) print(response.json()) ``` ```javascript const url = 'https://app.unleash-instance.example.com/api/admin/projects/projectId/features/featureName'; const options = {method: 'GET', headers: {Authorization: ''}}; 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" "net/http" "io" ) func main() { url := "https://app.unleash-instance.example.com/api/admin/projects/projectId/features/featureName" req, _ := http.NewRequest("GET", url, nil) req.Header.Add("Authorization", "") 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/featureName") http = Net::HTTP.new(url.host, url.port) http.use_ssl = true request = Net::HTTP::Get.new(url) request["Authorization"] = '' response = http.request(request) puts response.read_body ``` ```java import com.mashape.unirest.http.HttpResponse; import com.mashape.unirest.http.Unirest; HttpResponse response = Unirest.get("https://app.unleash-instance.example.com/api/admin/projects/projectId/features/featureName") .header("Authorization", "") .asString(); ``` ```php request('GET', 'https://app.unleash-instance.example.com/api/admin/projects/projectId/features/featureName', [ 'headers' => [ 'Authorization' => '', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://app.unleash-instance.example.com/api/admin/projects/projectId/features/featureName"); var request = new RestRequest(Method.GET); request.AddHeader("Authorization", ""); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = ["Authorization": ""] let request = NSMutableURLRequest(url: NSURL(string: "https://app.unleash-instance.example.com/api/admin/projects/projectId/features/featureName")! as URL, cachePolicy: .useProtocolCachePolicy, timeoutInterval: 10.0) request.httpMethod = "GET" request.allHTTPHeaderFields = headers 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() ```