Skip to main content
Product managers: send this page to your developers. They only need an embed id, an API key, your Vizkraft base URL, and the liquid tag names you configured.
This guide walks engineering through a complete integration of @vizkraft/embed. For why the API key stays on the server, read Security first. Base URL in production: https://app.vizkraft.com · Product: vizkraft.com

What you will build

  1. A backend route that calls Vizkraft with your embed API key and tenant liquid values, then returns only a short-lived sessionToken to the browser.
  2. A frontend page that installs @vizkraft/embed and mounts the dashboard with getSessionToken.

Prerequisites from your PM

Step 1 — Install

Or with a CDN (HTML):

Step 2 — Backend mint

Create a server route your frontend can call (cookie / session auth on your side). That route calls Vizkraft: POST {baseUrl}/api/embed/session Headers:
  • Authorization: Bearer <YOUR_EMBED_API_KEY>
  • Content-Type: application/json
Body:
Return JSON to the browser with only sessionToken (and optionally expiresAt). Never return the API key.

Step 3 — Frontend mount

Call your backend from getSessionToken. Pass baseUrl when you are not on the default production host.

Height tip

Use height: '100%' when the host container is a flex/grid pane that should scroll inside the iframe. Percentage heights do not auto-grow from content. Pixel heights (or omitting height) allow the SDK to resize from viewer vizkraft:resize messages.

Step 4 — Session refresh

You do not build refresh timers. The SDK calls getSessionToken:
  • On mount
  • Before session expiry (~5 minutes)
  • After auth errors from the viewer
Implement getSessionToken as a fresh mint each time (or a short cache on your backend if you prefer).

Step 5 — Verify

  1. onReady fires and charts load for tenant A.
  2. Sign in as tenant B (or mint with different liquid) and confirm KPIs change—isolation works.
  3. Confirm your app origin is listed under Allowed origins in Vizkraft.
  4. Optional: walk through Partner demo on the same deployment.

API quick reference

VizkraftEmbed.mount(options)

Handle methods

postMessage (origins checked)

Common errors