Skip to main content
<ToltEmbed /> renders a partner’s referral dashboard (link, earnings, customers) inside your app. For a step-by-step walkthrough, see Refer-a-friend page.
Your app
Your servertoken route
Toltplatform.tolt.com
1/api/tolt/embed-token
2POST /v2/embed-tokens
3
4token
5iframe /referrals?token=…
6tolt-embed:ready

Install

Requires React 17 or later. Without React, use the iframe directly.

1. Mint a token on your server

Your API key never reaches the browser. Your backend exchanges it for a token scoped to one partner, valid for about an hour; read expires_at.
Send exactly one of partner_id or partner: { email, program_id }. With partner, Tolt finds the partner by email in the program, or creates them (active, with a referral link) when there is none; add first_name and last_name to name a new partner. Add external_id, your own user id, and Tolt matches on it before email and keeps it on the partner, so a user who changes their email keeps the same partner. partner_id only finds an existing partner. Either way you get 404 for a partner who is invited, suspended or rejected, or a program that isn’t active, and 409 when the partner with that email already has a different external_id. The response includes the partner_id the token is for.

2. Render the component

referrals.tsx
Wait for the token before rendering. Without token, the component shows a sample dashboard with demo data.

Props

string
The embed token from your server. Omit it to render a sample dashboard (useful while designing).
"light" | "dark" | "system"
default:"system"
Force a color scheme, or follow the partner’s system setting.
ToltEmbedThemeOptions
Match the dashboard to your brand. Every key is optional; anything you leave out keeps the default for the active theme.
Show this link (lnk_...) instead of the partner’s first one. If it isn’t one of the partner’s links, the dashboard shows the first link.
Hide the referral link and copy button, for when your app already shows the link.
"referrals"
default:"referrals"
Which embed to render. The referral dashboard is the only one today.
() => void
Fires once the dashboard has loaded and reported its size.
(message: string) => void
Fires if the dashboard fails to load, for example because the token had already expired. Fetch a new token here. A dashboard that has loaded doesn’t re-check its token, so for long sessions fetch a new one before expires_at.
string
Class name for the iframe.
CSSProperties
Inline styles for the iframe, merged over the defaults (width: 100%, no border).
string
default:"https://platform.tolt.com"
Override the embed host. Mostly for local development.
The iframe starts 520px tall and then resizes itself to fit its content.

Iframe without React

Point an iframe at /referrals with the token and any theme options as query params. linkId and hideLink=true work the same way:
A raw iframe does not resize itself. To match the component, listen for its messages: