Skip to main content
Sitecore Documentation
  • Learn
  • Downloads
  • Changelog
  • Roadmap
PersonalizeCloud Portal
Sitecore Personalize
        • Getting started
        • Using traffic allocation and variant traffic assignment
            • Use FreeMarker snippets
            • Test the API response
            • Use dynamic experiment data
            • Use dynamic guest data
            • Use dynamic decision model data
        • Apply a condition
        • Apply a segment
        • Use a decision model
        • Run an experiment
    • SitecoreAI experiments
    • Using the experiment list
    • Manage experiment details
    • Set automated post-test actions
    • Set up email notifications
    • Duplicate, delete, and view details
  • Using client-side JavaScript
  • Glossary
  1. Sitecore Personalize
  1. Sitecore Personalize
  2. Introduction to experiments in Sitecore Personalize

Use dynamic guest data in the API response for an interactive experiment

You can copy attributes or paths from the guest data model and use them in the API response.

To include dynamic guest data in the API response:

  1. In the API editor, from the API tab, click the Data tab.

  2. To insert dynamic data into the API response, enter a guest's email address or other identifier to search in the Data Selector search box. This enables you to access data model attributes and paths.

    Tip

    If there is a guest whose data you often use when configuring or testing code, just click the star icon to bookmark the guest so you no longer have to search for them.

  3. Under Guest data model, click Copy icon next to the attribute or path and click Copy Path as Freemarker.

    Copying attributes from the guest data model
  4. Paste into the API tab.

    Tip

    There are some situations when you might want to insert a custom field in your API response, using FreeMarker. For example, you might want to retrieve the logged in state of the site visitor. To do this, create a custom fieldcreate a custom field called loggedInState. Then use the following path in FreeMarker when configuring the API response: "customField": "${request.params.customField}"

  5. Click Save.

  6. Click to close the API editor.

If you have suggestions for improving this article, let us know!

© Copyright 2026, Sitecore A/S or a Sitecore affiliated company.
All rights reserved.

Privacy policySitecore Trust CenterTerms of use