Skip to content
APIProductBuild and shipFlag

Flag routes: evaluate

The Flag Verbs evaluate as api.sb routes, with inputs, result, refusals and an example.

Reference for Flag, one group of Flag routes.

Flag.evaluate

Evaluate returns the Variant a Flag assigns one unit, the same one every time, and records the Exposure with every option and its propensity. Verb page.

Text
POST /{namespace}/flags/{flag}/evaluate

Path: flag. Body, as JSON: the other inputs. Emits Flag.evaluated.

Inputs

InputTypeRequiredDescription
flagFlagrequiredThe Flag to evaluate, by key.
unitstringrequiredThe id of the Visitor, Customer, Contact, Conversation or request being assigned.
defaultstringThe Variant key returned when the Flag is off or the value may not be varied.

Returns

OutputTypeRequiredDescription
variantVariantrequiredThe Variant assigned to the unit.
exposureExposureThe Exposure recorded; none in Mode try.

Refuses when

CheckErrorFixThen call
The key is valid, but its scopes do not allow this operation.forbiddenUse a key whose scopes cover the operation, or ask an owner of the namespace to grant them.None.

Example

Terminal
curl -X POST https://api.sb/leaseline.app/flags/flag_1YJLhjTlfx/evaluate \
  -H "Authorization: Bearer $STARTUP_BUILDER_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{"unit":"Example unit"}'
JSON
{
  "api": "https://api.sb/leaseline.app",
  "variant": {
    "$id": "https://api.sb/leaseline.app/variants/variant_nvdfmt7dTw",
    "$type": "Variant",
    "key": "Example key",
    "value": {}
  },
  "exposure": {
    "$id": "https://api.sb/leaseline.app/exposures/exposure_Ua2Xw4KsJB",
    "$type": "Exposure",
    "unit": "Example unit",
    "options": {},
    "propensity": 1,
    "at": "2026-10-22T12:00:00Z"
  },
  "action": {
    "$id": "https://api.sb/leaseline.app/actions/act_br07HsG8MG",
    "operation": "Flag.evaluate",
    "status": "done"
  },
  "links": {
    "self": "https://api.sb/leaseline.app/actions/act_br07HsG8MG"
  }
}