Check Feature Flag
GET
/api/v1/features/{flag}
const url = 'https://indepai.app/api/v1/features/example';const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
try { const response = await fetch(url, options); const data = await response.json(); console.log(data);} catch (error) { console.error(error);}curl --request GET \ --url https://indepai.app/api/v1/features/example \ --header 'Authorization: Bearer <token>'Check if a specific feature flag is enabled for the current user
Authorizations
Section titled “Authorizations”Parameters
Section titled “Parameters”Path Parameters
Section titled “Path Parameters”flag
required
Feature flag key
string
Responses
Section titled “Responses”Feature flag status
Media typeapplication/json
object
success
required
boolean
data
required
object
key
required
Feature flag key
string
enabled
required
Whether the feature is enabled for this user
boolean
reason
required
Reason for the flag value
string
variant
Variant value (for multivariate flags)
string
meta
required
object
timestamp
required
Timestamp in ISO 8601 format
string format: date-time
Example
{ "success": true, "data": { "enabled": true, "reason": "default" }, "meta": { "timestamp": "2024-01-15T10:30:00Z" }}Unauthorized
Media typeapplication/json
object
success
required
Always false for error responses
boolean
error
required
Error type
string
code
Machine-readable error code
string
details
Detailed validation errors
Array<object>
object
path
required
Path to the invalid field
string
message
required
Error message
string
Example
{ "success": false, "error": "Validation error", "code": "VALIDATION_ERROR", "details": [ { "path": "currentAge", "message": "Must be between 18 and 100" } ]}Feature flag not found
Media typeapplication/json
object
success
required
Always false for error responses
boolean
error
required
Error type
string
code
Machine-readable error code
string
details
Detailed validation errors
Array<object>
object
path
required
Path to the invalid field
string
message
required
Error message
string
Example
{ "success": false, "error": "Validation error", "code": "VALIDATION_ERROR", "details": [ { "path": "currentAge", "message": "Must be between 18 and 100" } ]}