> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.getunleash.io/api/get-frontend-api-features-with-post/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.getunleash.io/_mcp/server. # 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 ## 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 ### Body (application/json) This endpoint expects a frontendApiFeaturesPostSchema. - `context` (FrontendApiFeaturesPostSchemaContext, optional) — The Unleash context. ## Response ### 200 frontendApiFeaturesSchema - `toggles` (list of frontendApiFeatureSchema, required) — The actual features returned to the Frontend SDK ## 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. ### 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. ## Types ### FrontendApiFeaturesPostSchemaContext The Unleash context. - `appName` (string, optional) — The name of the application. - `currentTime` (string, optional) — 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. - `properties` (map from string to string, optional) — Additional Unleash context properties - `remoteAddress` (string, optional) — The app's IP address - `sessionId` (string, optional) — An identifier for the current session - `userId` (string, optional) — An identifier for the current user - `environment` (string, optional, deprecated) — The environment the app is running in. ### frontendApiFeatureSchema Frontend API feature - `name` (string, required) — Unique feature name. - `enabled` (boolean, required) — Always set to `true`. - `impressionData` (boolean, required) — `true` if the impression data collection is enabled for the feature, otherwise `false`. - `variant` (FrontendApiFeatureSchemaVariant, optional) — Variant details ### FrontendApiFeatureSchemaVariant Variant details - `name` (string, required) — The variants name. Is unique for this feature flag - `enabled` (boolean, required) — Whether the variant is enabled or not. - `payload` (FrontendApiFeatureSchemaVariantPayload, optional) — Extra data configured for this variant - `feature_enabled` (boolean, optional) — Whether the feature is enabled or not. - `featureEnabled` (boolean, optional, deprecated) — Use `feature_enabled` instead. ### FrontendApiFeatureSchemaVariantPayload Extra data configured for this variant - `type` (enum, required) — The format of the payload. - Allowed values: `json`, `csv`, `string`, `number` - `value` (string, required) — The payload value stringified. ## Examples **Request** ```json {} ``` **Response** ```json { "toggles": [ { "name": "disable-comments", "enabled": true, "impressionData": false, "variant": { "name": "blue_group", "enabled": true, "payload": { "type": "json", "value": "{\"color\": \"red\"}" }, "feature_enabled": true, "featureEnabled": true } } ] } ``` **SDK Code** ```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() ```