Create decide

Runs the caller's flag definitions for one identity and returns the flag verdict: which flags are on (or which variant), their payloads, and whether any definition failed to compute.

POST /v1/flag/decide

Addresshttps://api.hanzo.ai/v1/flag/decide
MethodPOST
Operationpost_flag_decide
AuthAuthorization: Bearer $HANZO_API_KEY

Runs the caller's flag definitions for one identity and returns the flag verdict: which flags are on (or which variant), their payloads, and whether any definition failed to compute. Evaluation is in-process over the caller's own (org, project) definitions — no network hop, no shared KV — so a tenant can only ever evaluate its own flags.

Request

3 fields, body application/json (required).

FieldInTypeRequiredDescription
distinct_idbodystring—DistinctID is the identity the flags are evaluated for.
groupsbodyany—Groups are the group-level properties, keyed by group type index.
person_propertiesbodyany—PersonProperties are the person-level properties conditions match against.

Response

StatusBodyMeaning
200ok
defaultproblem-detailsrefused

200 body — 1 field.

FieldInTypeAlwaysDescription
(body)bodyanyyes

Failure carries the platform error shape — see Errors.

Examples

hanzo flag decide
import { Configuration, FlagApi } from 'hanzoai';

const api = new FlagApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.postFlagDecide({ distinct_id: "<distinct_id>", groups: "<groups>" });
from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import FlagApi

client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = FlagApi(client).post_flag_decide(distinct_id="<distinct_id>", groups="<groups>")
cfg := hanzoai.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := hanzoai.NewAPIClient(cfg)

resp, _, err := client.FlagAPI.PostFlagDecide(context.Background()).Execute()
if err != nil {
	return err
}
use hanzo_client::apis::{configuration::Configuration, flag_api};

let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();

let result = flag_api::post_flag_decide(&cfg, Default::default()).await?;
import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.FlagApi;

ApiClient client = new ApiClient();
client.setBearerToken(System.getenv("HANZO_API_KEY"));

var result = new FlagApi(client).postFlagDecide();
curl -X POST https://api.hanzo.ai/v1/flag/decide \
  -H "Authorization: Bearer $HANZO_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
       "distinct_id": "<distinct_id>",
       "groups": "<groups>"
     }'

MCP reaches flag through the flag tool, which names its 8 operations with its own verbs — this one among them, under a name only MCP declares. describe explains any of them:

curl -X POST https://api.hanzo.ai/v1/mcp \
  -H "Content-Type: application/json" \
  -d '{
       "jsonrpc": "2.0",
       "id": 1,
       "method": "tools/call",
       "params": {
         "name": "describe",
         "arguments": {
           "op": "get_flag_activity"
         }
       }
     }'

Flag API · All Hanzo APIs · Interactive reference

Was this page useful?