Skip to content
Open Vivreal

Playground

Explore interactive code examples for the Vivreal API. Pick a template, edit the code, and see the results live in your browser.

Fetch your site configuration — theme colors, logo, business info.

index.js
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
// ✎ UPDATE THESE WITH YOUR REAL VALUES
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━
var API_KEY = 'your-api-key-here';
var SITE_ID = 'your-site-id-here';
// ━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━━

var BASE = 'https://client.vivreal.io';

async function run() {
  if (isPlaceholder(API_KEY) || isPlaceholder(SITE_ID)) {
    showMock(MOCK, ['API_KEY', 'SITE_ID']);
    return;
  }

  try {
    var res = await fetch(
      BASE + '/tenant/siteDetails?siteId=' + SITE_ID,
      { headers: { Authorization: API_KEY } }
    );
    var json = await res.json();
    if (!json.success) throw new Error(json.error);
    showResult(json);
  } catch (err) {
    showError(err.message);
  }
}

run();

Edit the code and switch to Preview to see the result