# Retrieve enabled feature flags for the provided context, using POST. POST https://app.unleash-instance.example.com/api/frontend Content-Type: application/json This endpoint returns the list of feature flags that the frontend API evaluates to enabled for the given context, using POST. Context values are provided as a `context` property in the request body. If the Frontend API is disabled 404 is returned. Reference: https://docs.getunleash.io/api/get-frontend-api-features-with-post ## OpenAPI Specification ```yaml openapi: 3.1.1 info: title: Retrieve enabled feature flags for the provided context, using POST. version: endpoint_frontendApi.getFrontendApiFeaturesWithPost paths: /api/frontend: post: operationId: get-frontend-api-features-with-post summary: Retrieve enabled feature flags for the provided context, using POST. description: >- This endpoint returns the list of feature flags that the frontend API evaluates to enabled for the given context, using POST. Context values are provided as a `context` property in the request body. If the Frontend API is disabled 404 is returned. tags: - - subpackage_frontendApi parameters: - name: Authorization in: header description: Header authentication of the form `undefined ` required: true schema: type: string responses: '200': description: frontendApiFeaturesSchema content: application/json: schema: $ref: '#/components/schemas/frontendApiFeaturesSchema' '401': description: >- Authorization information is missing or invalid. Provide a valid API token as the `authorization` header, e.g. `authorization:*.*.my-admin-token`. content: {} '404': description: The requested resource was not found. content: {} requestBody: description: frontendApiFeaturesPostSchema content: application/json: schema: $ref: '#/components/schemas/frontendApiFeaturesPostSchema' components: schemas: FrontendApiFeaturesPostSchemaContext: type: object properties: appName: type: string description: The name of the application. currentTime: type: string format: date-time description: >- A DateTime (or similar) data class instance or a string in an RFC3339-compatible format. Defaults to the current time if not set by the user. environment: type: string description: The environment the app is running in. properties: type: object additionalProperties: type: string description: Additional Unleash context properties remoteAddress: type: string description: The app's IP address sessionId: type: string description: An identifier for the current session userId: type: string description: An identifier for the current user frontendApiFeaturesPostSchema: type: object properties: context: $ref: '#/components/schemas/FrontendApiFeaturesPostSchemaContext' description: The Unleash context. FrontendApiFeatureSchemaVariantPayloadType: type: string enum: - value: json - value: csv - value: string - value: number FrontendApiFeatureSchemaVariantPayload: type: object properties: type: $ref: '#/components/schemas/FrontendApiFeatureSchemaVariantPayloadType' description: The format of the payload. value: type: string description: The payload value stringified. required: - type - value FrontendApiFeatureSchemaVariant: type: object properties: name: type: string description: The variants name. Is unique for this feature flag enabled: type: boolean description: Whether the variant is enabled or not. payload: $ref: '#/components/schemas/FrontendApiFeatureSchemaVariantPayload' description: Extra data configured for this variant feature_enabled: type: boolean description: Whether the feature is enabled or not. featureEnabled: type: boolean description: Use `feature_enabled` instead. required: - name - enabled frontendApiFeatureSchema: type: object properties: name: type: string description: Unique feature name. enabled: type: boolean description: Always set to `true`. impressionData: type: boolean description: >- `true` if the impression data collection is enabled for the feature, otherwise `false`. variant: $ref: '#/components/schemas/FrontendApiFeatureSchemaVariant' description: Variant details required: - name - enabled - impressionData frontendApiFeaturesSchema: type: object properties: toggles: type: array items: $ref: '#/components/schemas/frontendApiFeatureSchema' description: The actual features returned to the Frontend SDK required: - toggles ``` ## SDK Code Examples ```python import requests url = "https://app.unleash-instance.example.com/api/frontend" payload = {} 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/frontend'; const options = { method: 'POST', headers: {Authorization: '', 'Content-Type': 'application/json'}, body: '{}' }; 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/frontend" payload := strings.NewReader("{}") 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/frontend") 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 = "{}" 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/frontend") .header("Authorization", "") .header("Content-Type", "application/json") .body("{}") .asString(); ``` ```php request('POST', 'https://app.unleash-instance.example.com/api/frontend', [ 'body' => '{}', 'headers' => [ 'Authorization' => '', 'Content-Type' => 'application/json', ], ]); echo $response->getBody(); ``` ```csharp using RestSharp; var client = new RestClient("https://app.unleash-instance.example.com/api/frontend"); var request = new RestRequest(Method.POST); request.AddHeader("Authorization", ""); request.AddHeader("Content-Type", "application/json"); request.AddParameter("application/json", "{}", ParameterType.RequestBody); IRestResponse response = client.Execute(request); ``` ```swift import Foundation let headers = [ "Authorization": "", "Content-Type": "application/json" ] let parameters = [] as [String : Any] let postData = JSONSerialization.data(withJSONObject: parameters, options: []) let request = NSMutableURLRequest(url: NSURL(string: "https://app.unleash-instance.example.com/api/frontend")! 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() ```