Evaluate Flag

Evaluate a feature flag for a specific user and receive a boolean result.

Endpoint

POST https://api.releaseanchor.com/v1/evaluate

Authentication

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"
}
FieldTypeRequiredDescription
flagKeystringThe flag's unique key. Case-sensitive.
userIdentifierstringA 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
}
FieldTypeDescription
valuebooleanThe flag's value for this user. Always use this field to gate your feature.
matchedRuleType"STATIC" | "SEGMENT" | "PERCENTAGE" | nullThe type of rule that matched, or null if no rule matched or an error occurred.
errorobject | nullPresent when the evaluation could not be completed normally.

matchedRuleType values

ValueDescription
STATICA static (always-matches) rule determined the value
SEGMENTA segment membership rule matched the user
PERCENTAGEA percentage rollout rule matched the user
nullNo 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

TypeDescription
FLAG_NOT_FOUNDNo flag with this key exists in the environment
FLAG_ARCHIVEDThe flag has been archived
FLAG_DISABLEDThe flag is toggled off in this environment
PLAN_LIMIT_EXCEEDEDMonthly 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/bulk

Request body

{
  "flagKey": "new-checkout",
  "userIdentifiers": ["a1b2c3d4-e5f6-7890-abcd-ef1234567890", "b2c3d4e5-f6a7-8901-bcde-f12345678901", "c3d4e5f6-a7b8-9012-cdef-123456789012"]
}
FieldTypeRequiredDescription
flagKeystringThe flag to evaluate.
userIdentifiersstring[]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
  }
}
Was this helpful?