Skip to content

Force a variant assignment for an experiment context

POST
/api/v4/experiments/{experiment_name}/assignments

Forces a specific variant assignment for the given experiment and context. The assignment is stored in Redis cache and will persist until overwritten. Defaults to current user if no context is provided.

experiment_name
required
string
Media type application/json
object
variant
required

The variant name to assign (e.g., control, candidate)

string
nullable
context

Context parameters (user, namespace, project). An actor context is resolved from the user. Defaults to current user.

object
Example generated
{
"variant": "example",
"context": {}
}

OK

Media type application/json
object
experiment
string
variant
string
context_key
string
cached
boolean
Example
{
"experiment": "lightweight_trial_registration_redesign",
"variant": "candidate",
"context_key": "abc123def456",
"cached": true
}

Bad request

Unauthorized

Forbidden

Not Found