Hanzo
OpenapiExperiment

Is the variant one subject is bucketed into, and the payload that variant…

Is the variant one subject is bucketed into, and the payload that variant carries.

GET /v1/experiment/{id}/assign

Addresshttps://api.hanzo.ai/v1/experiment/{id}/assign
MethodGET
Operationget_experiment_by_id_assign
AuthAuthorization: Bearer $HANZO_API_KEY

Is the variant one subject is bucketed into, and the payload that variant carries.

The bucketing is a deterministic hash of the subject, so the same subject gets the same arm on every call for as long as the flag definition is unchanged — and this is a pure READ: it records nothing. In particular it does NOT record an exposure. The caller's SDK must emit the experiment's exposure event itself, or the analysis has an empty denominator and every arm measures zero.

An empty variant with on false is not an error — it means the flag returned nothing for this subject, so the subject is not enrolled. A flags engine that is unavailable refuses rather than defaulting to an arm. Requires a validated principal, and the experiment must exist in the caller's org and project.

Request

3 fields.

FieldInTypeRequiredDescription
idpathstringyesID is the experiment the URL names.
subjectquerystringyesSubject is the unit to bucket — a user, org, session or audience key, matching the experiment's subjectKind.
propsquerystringProps is a JSON object of person properties for targeting.

Response

StatusBodyMeaning
200assignmentok

200 body — 5 fields.

FieldInTypeAlwaysDescription
experimentbodystringTrial is the experiment that was evaluated.
onbodybooleanOn is false when the flag returned nothing for this subject, which means the subject is not enrolled — not an error.
payloadbodyanyPayload is the opaque JSON the winning arm carries, which the caller interprets: a feature config, an ad-creative id, a subject line, a model id.
subjectbodystringSubject is the unit that was bucketed.
variantbodystringArm is the arm the subject falls in, empty when the flag enrolled it in none.

Failure carries the platform error shape — see Errors.

Examples

hanzo experiments assign <id> --subject <subject>

Experiment API · All Hanzo APIs · Interactive reference

How is this guide?

On this page