palbaseDocs

Palbase IAP · API

POST/iap/experiments/{experiment_id}/winner

Declare an experiment's winner

Ends a running experiment with a winner, at once: for everyone at the placement, the winner's paywall becomes the placement's default — or, with as_rule, a live rule at the top of its rules shows it to everyone (to narrow later) and the default stays; for the rules, the rules that targeted the experiment show the winner's paywall. Its results stay.

Called by your server, with the project's secret key.

Path

experiment_idstring (uuid) · requiredThe experiment's id.

Headers

Idempotency-Keystring · optionalMakes the write safe to send again (at most 255 characters). A retry with the same key and the same request gets the first answer back, marked `Idempotent-Replayed: true`, and changes nothing; the same key with a different request is refused with 422, and while the first request still runs a retry gets 409 with Retry-After. Answers are kept for 24 hours.

Request body

as_ruleboolean · optionalFor an experiment for everyone at the placement: roll the winner out as a live rule at the top of the placement's rules (for everyone, to narrow later) and keep the placement's default; otherwise the winner becomes the default.
variantstring · requiredThe variant's key.
curl
curl -X POST "https://<your-ref>.palbase.studio/iap/experiments/<experiment_id>/winner" \
  -H "apikey: $PALBASE_SECRET_KEY" \
  -H "content-type: application/json" \
  -d '{"variant":"string"}'

Responses

200The experiment, won

400The request is malformed, or a field breaks a rule (the error names which)

401No key, not a key of this project, or a token that is not valid (the edge's answer)

403Not the project's secret key (`secret_key_required`)

404No such experiment (`experiment_not_found`)

409The experiment has ended (`experiment_ended`); the placement has 50 rules, the most it holds, for `as_rule` (`too_many_rules`); or a request with this Idempotency-Key is still running (`idempotency_key_in_use`, Retry-After)

413The request body is too large (`request_too_large`)

422The experiment has no such variant (`unknown_variant`). Or the Idempotency-Key was sent with a different request (`idempotency_key_reused`)

429Over the project's request limit; Retry-After says when to try again

503Temporarily unavailable; retrying is safe after Retry-After

defaultAn error: the envelope names it (`error`) and explains it (`error_description`).

Operation DeclareExperimentWinner of iap's contract.