Evaluate Flag
Evaluate a feature flag for a specific user and receive a boolean result.
Endpoint
POST https://api.releaseanchor.com/v1/evaluateAuthentication
All requests require an API key in the Authorization header:
Authorization: ApiKey <YOUR_API_KEY>Request Body
{
"flagKey": "new-checkout",
"userIdentifier": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}| Field | Type | Required | Description |
|---|---|---|---|
flagKey | string | ✓ | The flag's unique key. Case-sensitive. |
userIdentifier | string | ✓ | A stable identifier for the user. Used for segment matching and percentage rollout hashing. |
Example request
curl --location 'https://api.releaseanchor.com/v1/evaluate' \
--header 'Content-Type: application/json' \
--header 'Authorization: ApiKey <YOUR_API_KEY>' \
--data '{
"flagKey": "new-checkout",
"userIdentifier": "a1b2c3d4-e5f6-7890-abcd-ef1234567890"
}'Response
All evaluation responses return HTTP 200, even when the flag is not found or disabled. Check the error field in the response body, not the HTTP status code.
Successful evaluation 200
{
"value": false,
"matchedRuleType": "STATIC",
"error": null
}| Field | Type | Description |
|---|---|---|
value | boolean | The flag's value for this user. Always use this field to gate your feature. |
matchedRuleType | "STATIC" | "SEGMENT" | "PERCENTAGE" | null | The type of rule that matched, or null if no rule matched or an error occurred. |
error | object | null | Present when the evaluation could not be completed normally. |
matchedRuleType values
| Value | Description |
|---|---|
STATIC | A static (always-matches) rule determined the value |
SEGMENT | A segment membership rule matched the user |
PERCENTAGE | A percentage rollout rule matched the user |
null | No rule matched, or an error prevented normal evaluation |
Flag not found 200
The flag key does not exist in this environment:
{
"value": false,
"matchedRuleType": null,
"error": {
"type": "FLAG_NOT_FOUND",
"message": "Flag not found"
}
}Flag disabled 200
The flag exists but is toggled off in this environment:
{
"value": false,
"matchedRuleType": null,
"error": {
"type": "FLAG_DISABLED",
"message": "Flag disabled"
}
}Flag archived 200
The flag has been archived:
{
"value": false,
"matchedRuleType": null,
"error": {
"type": "FLAG_ARCHIVED",
"message": "Flag archived"
}
}Plan limit exceeded 200
The organization has exceeded its monthly evaluation limit:
{
"value": false,
"matchedRuleType": null,
"error": {
"type": "PLAN_LIMIT_EXCEEDED",
"message": "Plan limit exceeded. Upgrade your plan to continue."
}
}EvaluationErrorType values
| Type | Description |
|---|---|
FLAG_NOT_FOUND | No flag with this key exists in the environment |
FLAG_ARCHIVED | The flag has been archived |
FLAG_DISABLED | The flag is toggled off in this environment |
PLAN_LIMIT_EXCEEDED | Monthly evaluation limit reached; evaluations are blocked |
Unauthorized 401
A missing or invalid API key returns HTTP 401:
{
"status": 401,
"error": "Unauthorized",
"message": "Missing or invalid Authorization header"
}Bulk evaluation
Evaluate a single flag for multiple users in one request. Useful for backend batch processing — e.g. sending an email campaign only to users who have a feature enabled.
POST https://api.releaseanchor.com/v1/evaluate/bulkRequest body
{
"flagKey": "new-checkout",
"userIdentifiers": ["a1b2c3d4-e5f6-7890-abcd-ef1234567890", "b2c3d4e5-f6a7-8901-bcde-f12345678901", "c3d4e5f6-a7b8-9012-cdef-123456789012"]
}| Field | Type | Required | Description |
|---|---|---|---|
flagKey | string | ✓ | The flag to evaluate. |
userIdentifiers | string[] | ✓ | List of user identifiers to evaluate the flag for. |
Response
Returns a map of userIdentifier → EvaluateResponse:
{
"a1b2c3d4-e5f6-7890-abcd-ef1234567890": { "value": true, "matchedRuleType": "SEGMENT", "error": null },
"b2c3d4e5-f6a7-8901-bcde-f12345678901": { "value": true, "matchedRuleType": "SEGMENT", "error": null },
"c3d4e5f6-a7b8-9012-cdef-123456789012": { "value": false, "matchedRuleType": null, "error": null }
}Fault tolerance
If the API is unreachable or returns an unexpected error, always fall back to false. Never let a flag evaluation crash your application:
async function isEnabled(flagKey, userIdentifier) {
try {
const res = await fetch("https://api.releaseanchor.com/v1/evaluate", {
method: "POST",
headers: {
"Content-Type": "application/json",
"Authorization": `ApiKey ${process.env.RELEASE_ANCHOR_KEY}`,
},
body: JSON.stringify({ flagKey, userIdentifier }),
});
const data = await res.json();
return data.value === true;
} catch {
return false; // safe default
}
}