CDPGuidesSupport

Get Experiment Assignment

REST reference for POST /experiments/assignments/{experiment_key}: the server-side variant assignment endpoint. Sticky on visitor_id, optionally records an impression.

Return the server-side variant assignment for a visitor in a single A/B or multivariate experiment, identified by its experiment key. Bucketing is deterministic on visitor_id and is sticky across calls. Tracking an impression is the default. Pass track_impression: false to read without recording. The browser SDK and this endpoint converge on the same variant for the same visitor.

See the Server-Side Experimentation guide for end-to-end recipes.

POST
/experiments/assignments/{experiment_key}
*object

Path Parameters

experiment_key*string

The experiment's stable key. Surfaced in the dashboard under each experiment's setup tab.

Request Body

application/json

Visitor + optional page context for eligibility. The schema describes canonical JSON inputs. The server also accepts values normalized by the preprocessing described on individual fields.

TypeScript Definitions

Use the request body type in TypeScript.

Response Body

application/json

application/json

application/json

application/json

application/json

curl -X POST "https://example.com/experiments/assignments/string" \  -H "Content-Type: application/json" \  -d '{    "token": "string",    "visitor_id": "string"  }'
{  "success": true,  "in_experiment": true,  "experiment_id": "string",  "experiment_key": "string",  "experiment_name": "string",  "variant_id": "string",  "variant_name": "string",  "is_control": true,  "type": "string",  "redirect": "string"}

How is this guide?