What Is a Widget Key?
Every MediaSFU widget — whether it's a Click-to-Call button, an AI agent, or a full meeting portal — requires a Widget Key to function. Think of it as a scoped API token specifically designed for client-side embeds.
ℹ️ Not a secret Unlike traditional API keys that you'd keep secret on your server, widget keys are meant to be visible in your HTML. They're embedded right in the page source. This is safe because of how they're designed.Why Widget Keys Are Safe in Client-Side Code
Traditional API keys are dangerous in client code because they grant broad access. Widget keys are different:
🔒 Domain-lockedA widget key only works on the domains you authorize. Even if someone copies the key from your page source and puts it on their site — it won't work. The MediaSFU CDN checks the requesting origin before initializing.
🎯 Scoped to a single widget typeA Click-to-Call key can't be used to spin up an AI Agent session. Each key is tied to a specific widget type and configuration profile.
⚡ Rate-limitedEvery key has built-in rate limiting. If someone tries to abuse a key (e.g., automated flood of call attempts), the system throttles and eventually blocks that key until you investigate.
♻️ DisposableKeys are cheap to create and cheap to revoke. If anything looks wrong, generate a new key, update your embed, and the old key becomes useless. There's no "master key" situation.
Creating Your First Widget Key
Here's the step-by-step:
- Log in to your MediaSFU dashboard
- Navigate to Widgets in the sidebar
- Click Create Widget
- Choose your widget type (Call Button, AI Agent, Meeting Portal, Web Agent, Calls Dashboard, or Agents Dashboard)
- Configure the widget — appearance, behavior, connected phone numbers or AI agents
- Click Generate Key
- Copy the embed snippet
The snippet looks like this:
<script src="https://cdn.mediasfu.com/widget.js" async></script>
<mediasfu-call-button
widget-key="wk_abc123def456"
button-text="Talk to Sales"
primary-color="#6366f1"
theme="dark"
position="bottom-right">
</mediasfu-call-button>
That's your entire integration. Paste it before </body> and you're live.
The Localhost Development Workflow
Every new widget key works on localhost by default. This is intentional — we want you to be able to develop and test without friction.
During development:
- Keys work on
localhost,127.0.0.1, andlocalhost:*(any port) - All widget features function identically to production
- Call routing, AI agent responses, meeting creation — everything is real
- Usage still counts against your account (be mindful during heavy testing)
Locking Down for Production
When you're ready to go live, update the key's domain restrictions:
Dashboard → Widgets → [Your Widget] → Settings → Allowed Domains
Add your production domain(s):
yourdomain.com
www.yourdomain.com
app.yourdomain.com
You can add multiple domains. Subdomains need to be listed explicitly — yourdomain.com does not automatically cover app.yourdomain.com.
After adding domains:
- The widget will only work on those listed domains
localhostaccess is removed unless you explicitly keep it in the list- Unauthorized origins get a silent failure (no console errors, no visible feedback)
localhost allowed for ongoing development. Use a different key — locked to production domains — for your live site.
Managing Multiple Widget Keys
Most real deployments use several keys:
| Key | Widget Type | Domains | Purpose |
|---|---|---|---|
wk_prod_call |
Click-to-Call | yoursite.com, www.yoursite.com |
Production website call button |
wk_prod_agent |
AI Agent | yoursite.com |
Production AI receptionist |
wk_internal_dash |
Calls Dashboard | admin.yoursite.com |
Internal call management |
wk_internal_agents |
Agents Dashboard | admin.yoursite.com |
Internal AI session monitoring |
wk_dev_call |
Click-to-Call | localhost |
Dev local development |
wk_staging_all |
Meeting Portal | staging.yoursite.com |
Staging environment |
Each key has independent analytics, so you can see usage broken down by environment and purpose.
Public-Facing vs. Internal Widgets
This distinction matters for security planning:
Public-facing widgets Public
Click-to-Call, AI Agent, Meeting Portal, Web Agent
- Embedded on pages accessible to anyone
- Domain-locked to your public site
- Rate-limited per visitor (IP-based)
- Designed to handle anonymous, untrusted traffic
- Self-healing — if an AI agent session crashes, the widget auto-recovers
Internal widgets Internal
Calls Dashboard, Agents Dashboard
- Embedded behind your authentication layer
- Domain-locked to internal domains (
admin.*,ops.*, etc.) - Display sensitive operational data
- Should never be on a publicly accessible page
- Pair with your own RBAC (role-based access control) for who sees what
Key Rotation and Security Hygiene
Best practices for ongoing security:
1. Rotate keys periodically
Even if nothing is wrong, rotate production keys every 90 days. Create a new key with the same configuration, update your embed, verify it works, then revoke the old key.
2. Use different keys per environment
Dev, staging, production — each should have its own key. This prevents dev testing from polluting production analytics and limits blast radius if a key leaks.
3. Monitor usage dashboards
Unusual spikes in call volume or AI sessions could indicate key abuse. Set up alerts if available.
4. Revoke immediately on breach
If you suspect a key has been exposed (e.g., committed to a public GitHub repo), revoke it immediately. Generate a new one. The transition takes seconds.
5. Keep embed codes in environment variables
If you're using React, Vue, or similar:
<mediasfu-call-button
widget-key={process.env.REACT_APP_WIDGET_KEY}
...
/>
This way the key lives in .env and isn't hardcoded in your source repository. The key is still visible in the rendered HTML — that's fine because it's domain-locked — but it's not in your Git history.
What Happens When a Key Is Revoked?
When you revoke a widget key:
- The widget stops initializing on all domains within ~60 seconds (CDN cache TTL)
- No new calls, sessions, or meetings can be created with that key
- Active calls or sessions already in progress are not interrupted — they complete normally
- Usage data for the revoked key remains in your dashboard for auditing
- The key ID is permanently retired and cannot be reused
Pricing and Usage
| Service | Billing | Notes |
|---|---|---|
| AI Agent sessions | Per minute of agent time | LLM provider costs included |
| Voice calls | Per minute | As low as $0.10/1K minutes |
| Meeting sessions | Per participant-minute | Includes recording if enabled |
| Widget keys | Free | No limit on quantity |
There's no separate "widget fee." The widgets are a delivery mechanism; you pay for the underlying communication services they consume.
Getting Started Today
- Log in to mediasfu.com
- Navigate to Widgets
- Create your first widget — we recommend starting with Click-to-Call (simplest to test)
- Paste the embed on a local HTML file and open it
- Make a test call
- When ready, add your domain and deploy
Have questions about widget keys or security? Reach out to our team or try the AI support agent right on our demos page.