The ToggleSmartly API allows you to retrieve feature flag values for your applications. All API requests require authentication via API keys, which you can generate from your dashboard.
https://togglesmartly.com/api
All API requests require an API key. Include your API key in the request body when making API calls.
Note: API keys are scoped to specific Organization, Application, and Environment combinations.
Retrieve feature flag values for one or more feature flags. You can optionally filter by environment keys.
/api/v1/feature-flags/get-values
Full URL: https://togglesmartly.com/api/v1/feature-flags/get-values
The request body must be JSON and include the following fields:
| Field | Type | Required | Description |
|---|---|---|---|
api_key |
string | Yes | Your API key (generated from the dashboard) |
feature_flag_keys[] |
array of strings | Yes | Array of feature flag keys you want to retrieve |
env[] |
array of strings | No | Optional array of environment keys to filter results. If omitted, returns flags from all environments. |
{
"api_key": "akey-12345678-1234-1234-1234-123456789012-abc123xyz789",
"feature_flag_keys": [
"enable_new_feature",
"show_banner",
"max_items_per_page"
],
"env": ["production", "staging"]
}
The API returns a JSON object with the following structure:
| Field | Type | Description |
|---|---|---|
status |
integer | HTTP status code (200, 400, 401, 404, 429, 500) |
message |
string | Human-readable message describing the result |
data |
array | Array of feature flag value objects |
Each item in the data array contains:
| Field | Type | Description |
|---|---|---|
featureFlagKey |
string | The feature flag key |
env |
string | The environment key (e.g., "production", "staging") |
value |
string | The feature flag value (falls back to default value if flag value is null) |
200 OK
{
"status": 200,
"message": "Feature flags retrieved successfully.",
"data": [
{
"featureFlagKey": "enable_new_feature",
"env": "production",
"value": "true"
},
{
"featureFlagKey": "enable_new_feature",
"env": "staging",
"value": "false"
},
{
"featureFlagKey": "show_banner",
"env": "production",
"value": "Welcome to our new site!"
},
{
"featureFlagKey": "max_items_per_page",
"env": "production",
"value": "25"
}
]
}
400 Bad Request - Invalid request format
{
"status": 400,
"message": "Invalid request. Please check your input.",
"data": []
}
401 Unauthorized - Invalid or expired API key
{
"status": 401,
"message": "Invalid or expired API key.",
"data": []
}
404 Not Found - No feature flags found or application not found
{
"status": 404,
"message": "No feature flags found matching the provided criteria.",
"data": []
}
429 Too Many Requests - Rate limit exceeded
{
"status": 429,
"message": "Rate limit exceeded. Please try again later.",
"data": []
}
500 Internal Server Error - Server error
{
"status": 500,
"message": "An internal server error occurred while retrieving feature flags.",
"data": []
}
To ensure fair usage and prevent abuse, API requests are rate-limited per API key.
When the rate limit is exceeded, you'll receive a 429 Too Many Requests response.
Here are examples of how to call the API in different programming languages.
curl -X POST https://togglesmartly.com/api/v1/feature-flags/get-values \
-H "Content-Type: application/json" \
-d '{
"api_key": "akey-12345678-1234-1234-1234-123456789012-abc123xyz789",
"feature_flag_keys": ["enable_new_feature", "show_banner"],
"env": ["production"]
}'
const response = await fetch('https://togglesmartly.com/api/v1/feature-flags/get-values', {
method: 'POST',
headers: {
'Content-Type': 'application/json',
},
body: JSON.stringify({
api_key: 'akey-12345678-1234-1234-1234-123456789012-abc123xyz789',
feature_flag_keys: ['enable_new_feature', 'show_banner'],
env: ['production']
})
});
const data = await response.json();
console.log(data);
import requests
url = 'https://togglesmartly.com/api/v1/feature-flags/get-values'
payload = {
'api_key': 'akey-12345678-1234-1234-1234-123456789012-abc123xyz789',
'feature_flag_keys': ['enable_new_feature', 'show_banner'],
'env': ['production']
}
response = requests.post(url, json=payload)
data = response.json()
print(data)
using System.Net.Http;
using System.Text;
using System.Text.Json;
var client = new HttpClient();
var request = new HttpRequestMessage(HttpMethod.Post,
"https://togglesmartly.com/api/v1/feature-flags/get-values");
var payload = new
{
api_key = "akey-12345678-1234-1234-1234-123456789012-abc123xyz789",
feature_flag_keys = new[] { "enable_new_feature", "show_banner" },
env = new[] { "production" }
};
request.Content = new StringContent(
JsonSerializer.Serialize(payload),
Encoding.UTF8,
"application/json"
);
var response = await client.SendAsync(request);
var responseBody = await response.Content.ReadAsStringAsync();
var data = JsonSerializer.Deserialize<dynamic>(responseBody);
$url = 'https://togglesmartly.com/api/v1/feature-flags/get-values';
$payload = [
'api_key' => 'akey-12345678-1234-1234-1234-123456789012-abc123xyz789',
'feature_flag_keys' => ['enable_new_feature', 'show_banner'],
'env' => ['production']
];
$ch = curl_init($url);
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_POST, true);
curl_setopt($ch, CURLOPT_POSTFIELDS, json_encode($payload));
curl_setopt($ch, CURLOPT_HTTPHEADER, [
'Content-Type: application/json'
]);
$response = curl_exec($ch);
$data = json_decode($response, true);
curl_close($ch);
Start using our API today. Sign up for free and generate your first API key to begin managing feature flags programmatically.
Get started - It is free
© 2025 ToggleSmartly. All rights reserved. ToggleSmartly is a product of Jamal Technologies.