Palbase Flags · API
/flags/experimentsStart an experiment
Starts an experiment on a flag: from the next read on, each of its people — everyone a read names (a user, or signed in as no one the installation proven with its secret: X-Palbase-Installation, X-Palbase-Installation-Secret), or the people of audience_id who allowed personalization — gets one variant's value, the same on every read (a hash of the experiment and the person over the weights: nothing is stored per person). A user's own value still comes first. A read carries the variant (Snapshot.experiments, DeltaOp.experiment); the app reports reading it as the analytics event $flag_exposure {flag, experiment, variant}, once a session. Every variant's value is one the flag takes; one experiment runs on a flag at a time; every reader is told (flags:<ref>).
Called by your server, with the project's secret key.
Request body
audience_idstring (uuid) · optionalAn analytics audience: only its people who allowed personalization are in the experiment, everyone else gets the flag's own value. Absent: everyone a read names.goal_eventstring · requiredThe analytics event that counts as converting: a letter or $, then letters, digits and _ . : - $, at most 64.keystring · requiredThe flag's key (not a Palbase-managed one).namestring · requiredIts name, 1 to 100 characters.variantsobject[] · required2 to 4 variants.curl -X POST "https://<your-ref>.palbase.studio/flags/experiments" \
-H "apikey: $PALBASE_SECRET_KEY" \
-H "content-type: application/json" \
-d '{"goal_event":"string","key":"string","name":"string","variants":[{"key":"string","value":null,"weight":1}]}'Responses
201The experiment, running
400The request is malformed, or a definition or a value breaks a flag's rules (the error names which)
401No key, or not a key of this project, or a token that is not valid (the edge's answer)
403Not the project's secret key
404No flag with this key, no value of the user's own for it, no such template, or no such experiment
409An experiment already runs on the flag (`experiment_running`)
422Not an experiment that can be (`invalid_experiment`): its name, audience, goal event or variants — 2 to 4, each its own value the flag takes
429The project's request rate, or its flag reads for the period under its quota, are used up; Retry-After says when to try again
503The platform could not answer now; retrying is safe (Retry-After)
defaultAn error: the envelope names it (`error`) and explains it (`error_description`).
Operation StartExperiment of flags's contract.