Get Flag Definitions
Get Flag Definitions
Get definitions for all enabled feature flags in a project, used by server-side SDKs that poll for flags during local evaluation
GET
/
flags
/
definitions
Get Feature Flag Definitions
curl --request GET \
--url https://{regionAndDomain}.com/flags/definitions \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://{regionAndDomain}.com/flags/definitions"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://{regionAndDomain}.com/flags/definitions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{regionAndDomain}.com/flags/definitions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{regionAndDomain}.com/flags/definitions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{regionAndDomain}.com/flags/definitions")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{regionAndDomain}.com/flags/definitions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"flags": [
{
"id": "flag_abc123",
"name": "New Checkout Flow",
"key": "new_checkout_flow",
"status": "enabled",
"project_id": 12345,
"workspace_id": 67890,
"ruleset": {
"variants": [
{
"key": "treatment",
"value": true,
"is_control": false,
"split": 0.5,
"is_sticky": true
}
],
"rollout": [
{
"rollout_percentage": 0.8,
"cohort_hash": "cohort_abc123",
"runtime_evaluation_rule": {
"platform": "web"
},
"runtime_evaluation_definition": {
"platform": "web"
},
"variant_splits": {
"control": 0.5,
"treatment": 0.5
},
"variant_override": {
"key": "treatment"
}
}
],
"test": {
"users": {
"qa_user_1": "treatment",
"qa_user_2": "control"
}
}
},
"context": "device_id",
"experiment_id": "exp_123",
"is_experiment_active": true
}
]
}{
"error": "<string>",
"status": "error"
}{
"error": "<string>",
"status": "error"
}This endpoint returns the flag definitions for all enabled feature flags within a Mixpanel project.
This endpoint returns a set of the flag definitions that are currently provisioned within a Mixpanel project and are enabled. This is used in local evaluation by Mixpanel service side SDK’s such as the Python SDK. Local evaluation polls for flag definitions according to provided configuration and assignment to a variant is implemented directly by the SDK without making a network request.
This endpoint is rate limited to 500 requests per minute per IP address.
Query Parameters
Was this page helpful?
Get Feature Flag Definitions
curl --request GET \
--url https://{regionAndDomain}.com/flags/definitions \
--header 'Authorization: Basic <encoded-value>'import requests
url = "https://{regionAndDomain}.com/flags/definitions"
headers = {"Authorization": "Basic <encoded-value>"}
response = requests.get(url, headers=headers)
print(response.text)const options = {method: 'GET', headers: {Authorization: 'Basic <encoded-value>'}};
fetch('https://{regionAndDomain}.com/flags/definitions', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://{regionAndDomain}.com/flags/definitions",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: Basic <encoded-value>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://{regionAndDomain}.com/flags/definitions"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("Authorization", "Basic <encoded-value>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://{regionAndDomain}.com/flags/definitions")
.header("Authorization", "Basic <encoded-value>")
.asString();require 'uri'
require 'net/http'
url = URI("https://{regionAndDomain}.com/flags/definitions")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Basic <encoded-value>'
response = http.request(request)
puts response.read_body{
"flags": [
{
"id": "flag_abc123",
"name": "New Checkout Flow",
"key": "new_checkout_flow",
"status": "enabled",
"project_id": 12345,
"workspace_id": 67890,
"ruleset": {
"variants": [
{
"key": "treatment",
"value": true,
"is_control": false,
"split": 0.5,
"is_sticky": true
}
],
"rollout": [
{
"rollout_percentage": 0.8,
"cohort_hash": "cohort_abc123",
"runtime_evaluation_rule": {
"platform": "web"
},
"runtime_evaluation_definition": {
"platform": "web"
},
"variant_splits": {
"control": 0.5,
"treatment": 0.5
},
"variant_override": {
"key": "treatment"
}
}
],
"test": {
"users": {
"qa_user_1": "treatment",
"qa_user_2": "control"
}
}
},
"context": "device_id",
"experiment_id": "exp_123",
"is_experiment_active": true
}
]
}{
"error": "<string>",
"status": "error"
}{
"error": "<string>",
"status": "error"
}