Call the Experimentation Assignment API

Updated Nov 8, 2026 Based on Salesforce docs updated 2026-08-27

Use the Experimentation Assignment API when you deliver personalization through a custom channel — your own app or system, not a built-in connector — and need to know which variant (the test version shown) or control (the no-change baseline) a visitor is in, so your code shows the matching experience consistently on every visit.

Request an assignment

  1. Obtain an OAuth access token for your connected app.
  2. Send a Bearer-authenticated request naming the experiment and the individual.
  3. Read the variant (or control) name from the response.
  4. Cache that assignment for the visitor’s session.
  5. Serve the matching content or logic for the returned variant.
assignment-request.sh (illustrative)
curl -X POST "{{instance_url}}/personalization/experiments/assignment" \
-H "Authorization: Bearer {{access_token}}" \
-H "Content-Type: application/json" \
-d '{ "experimentId": "{{experiment_id}}", "individualId": "{{individual_id}}" }'
assignment-response.json (illustrative)
{
"experimentId": "{{experiment_id}}",
"individualId": "{{individual_id}}",
"variant": "{{variant_name}}"
}
Experimentation Assignment API request and response shown in an API client
Screenshot: Assignment API call

Discussion

Comments are not configured for local development. They appear once the site owner connects GitHub Discussions (Giscus).

Support SF Guide

SF Guide is a free, independent guide to Salesforce Personalization, built and maintained in the open. If it saved you time on an implementation, a small contribution helps keep it current and ad-light.