Embed Clarity
Render Clarity in a browser without exposing your API key.
Step 1: Mint a token (server-side)
const embed = await motif.clarity.createEmbed({
portfolioId: 'ppf_abc',
allowedOrigins: ['https://app.acme.com'],
ttlSeconds: 900,
scope: ['card', 'chat'],
})
return { iframeUrl: embed.url } // hand to the browsercurl -X POST https://api.motifapp.ai/api/v1/sdk/clarity/embeds \
-H "x-api-key: $MOTIF_API_KEY" \
-H "content-type: application/json" \
-d '{
"portfolioId": "ppf_abc",
"allowedOrigins": ["https://app.acme.com"],
"ttlSeconds": 900,
"scope": ["card", "chat"]
}'{
"url": "https://clarity-embed.motifapp.ai/?token=eyJ...",
"token": "eyJ...",
"expiresAt": "2026-05-22T16:45:00Z",
"jti": "..."
}Token bindings
Step 2: Render the iframe
Step 3: Listen for parent-window events (optional)
Allowed origins
Production checklist
Troubleshooting
Symptom
Likely cause
Last updated