Is every experiment in the caller's org, with its variants, status and…
Is every experiment in the caller's org, with its variants, status and decision, ordered by project then id.
GET /v1/experiment
| Address | https://api.hanzo.ai/v1/experiment |
| Method | GET |
| Operation | get_experiment |
| Auth | Authorization: Bearer $HANZO_API_KEY |
Is every experiment in the caller's org, with its variants, status and decision, ordered by project then id.
Scoped to the org resolved from the validated principal — a distinct org is a distinct physical store, so no query here can reach another tenant's rows — and further narrowed to the caller's project scope when the credential carries one. A principal with NO project scope sees the org's experiments across all of its projects, which is the answer a reader most often expects to be filtered and is not.
Requires a validated principal; refuses without one rather than answering an empty list.
Request
GET /v1/experiment takes no parameters and no body — the credential is the whole request.
Response
| Status | Body | Meaning |
|---|---|---|
200 | experimentList | ok |
200 body — 20 fields.
| Field | In | Type | Always | Description |
|---|---|---|---|---|
data | body | Trial[] | — | Data is the org's experiments, ordered by project then id. |
data[].createdAt | body | string | — | when it started assigning |
data[].createdBy | body | string | — | the credential that registered it |
data[].decidedAt | body | string | — | when the promotion took effect |
data[].decidedBy | body | string | — | the credential that promoted the winner |
data[].exposureEvent | body | string | — | the event that enrols a subject — the analysis denominator |
data[].flagKey | body | string | — | the assignment flag this experiment drives |
data[].id | body | string | — | the experiment's slug, unique within the project |
data[].metricEvent | body | string | — | the event that counts as a conversion — the numerator |
data[].name | body | string | — | free text for a reader |
data[].project | body | string | — | the sub-scope within the org, stamped from the principal |
data[].status | body | string | — | running while it assigns and measures, decided once a winner is promoted |
data[].subjectKind | body | string | — | the unit assigned and measured: user, org, session or audience |
data[].variants | body | Arm[] | — | the arms, weighted, one of them the control |
data[].variants[].control | body | boolean | — | true on the baseline arm every other arm is compared to |
data[].variants[].key | body | string | — | the arm's slug, unique within the experiment |
data[].variants[].payload | body | any | — | opaque JSON the arm carries, which the consumer interprets |
data[].variants[].weight | body | number | — | its share of the rollout; the arms sum to 100 |
data[].winner | body | string | — | the arm promoted to the whole rollout |
total | body | integer | — | Total is how many rows Data holds. |
Failure carries the platform error shape — see Errors.
Examples
hanzo experiments listimport { Configuration, ExperimentApi } from 'hanzoai';
const api = new ExperimentApi(new Configuration({ accessToken: process.env.HANZO_API_KEY }));
const { data } = await api.getExperiment();from hanzoai.cloud import ApiClient, Configuration
from hanzoai.cloud.api import ExperimentApi
client = ApiClient(Configuration(access_token=os.environ["HANZO_API_KEY"]))
result = ExperimentApi(client).get_experiment()cfg := cloud.NewConfiguration()
cfg.AddDefaultHeader("Authorization", "Bearer "+os.Getenv("HANZO_API_KEY"))
client := cloud.NewAPIClient(cfg)
resp, _, err := client.ExperimentAPI.GetExperiment(context.Background()).Execute()
if err != nil {
return err
}use hanzo_cloud::apis::{configuration::Configuration, experiment_api};
let mut cfg = Configuration::new();
cfg.bearer_access_token = std::env::var("HANZO_API_KEY").ok();
let result = experiment_api::get_experiment(&cfg, Default::default()).await?;import ai.hanzo.cloud.ApiClient;
import ai.hanzo.cloud.api.ExperimentApi;
ApiClient client = new ApiClient();
client.setRequestInterceptor(b -> b.header("Authorization", "Bearer " + System.getenv("HANZO_API_KEY")));
var result = new ExperimentApi(client).getExperiment();The method above is the one at the current release of the document. [email protected] (npm) and [email protected] (PyPI) were generated from an earlier release, where this operation carried a different id, so it spells the method differently — regenerating the clients is what makes the two agree. SDKs →
curl https://api.hanzo.ai/v1/experiment \
-H "Authorization: Bearer $HANZO_API_KEY"Tool experiments, op get_experiment — POST the JSON-RPC envelope to https://api.hanzo.ai/v1/mcp.
curl -X POST https://api.hanzo.ai/v1/mcp \
-H "Authorization: Bearer $HANZO_API_KEY" \
-H "Content-Type: application/json" \
-d '{
"jsonrpc": "2.0",
"id": 1,
"method": "tools/call",
"params": {
"name": "experiments",
"arguments": {
"op": "get_experiment",
"input": {}
}
}
}'How is this guide?