Accessing page version to set version to load

Builder content link

Builder public api key

What are you trying to accomplish
I have two versions of my home page with the same url. I want to load either version 1 or version 2 based on a property value coming back from an API call. I’m making the call on the page code, I’ve retrieved the property, and I can redirect to a website based on that property. I just can’t figure out how to access different versions of the page.

Or perhaps there’s a better way altogether.

Code stack you are integrating Builder with

Hi @maria Welcome to Forum!

You can refer to the below code for your reference:-

export const getContentWithInfo = (content?: Content) => {
  if (content) {
    const cookieValue = builder.getCookie(`builder.tests.${}`);
    const cookieVariation =
      cookieValue === ? content : content.variations?.[cookieValue];
    const variationName =
      cookieVariation?.name || (cookieVariation?.id === ? 'Default variation' : '');

    return {
      variationId: cookieValue,
      testVariationId: cookieValue,
      testVariationName: variationName,
  return null;

Let us know if you’ve further questions!

Thank you!! Directions have changed, I’ll have to come back to this later to test it out.