Public Embed Keys

Safely support one-script chatbot embeds without exposing broad API credentials.

A website chatbot needs a credential that can be used from the browser. That credential should be publishable, scoped, and limited. It should not be the same as a server-side secret API key.

Credential Types

Key typeExposed to browser?Scope
Secret API keyNoBackend API calls for trusted servers.
Public embed keyYesOne published chatbot, on allowed domains, with strict limits.
Widget loads with a public embed key
  -> Fluo validates origin, key, agent, and limits
  -> Fluo creates a short-lived chat session
  -> The browser sends chat messages using that session

This keeps the embed simple while making the exposed key low-risk.

Abuse Controls

Public embed keys should be protected by several controls at once:

ControlWhy it matters
Allowed originsPrevents casual reuse of the key on unrelated websites.
Agent scopeLimits the key to one chatbot or explicit agent allowlist.
Endpoint scopePrevents the key from managing projects, agents, knowledge, integrations, or billing.
Rate limitsReduces automated abuse by key, IP, origin, and session.
Spend capsStops unexpected model or tool costs.
Short-lived sessionsLets Fluo expire browser sessions without rotating the public key.
Optional bot checksAdds friction for suspicious or anonymous traffic.

What Public Keys Should Not Do

Public embed keys should not be able to:

  • Create, update, or delete agents.
  • Manage integrations or credentials.
  • Read project settings.
  • List API keys.
  • Access usage or wallet information.
  • Trigger write-capable tools unless explicitly allowed.

Allowed Domains

Add every production domain where the widget runs:

  • https://example.com
  • https://www.example.com
  • https://app.example.com

Use development origins only for local testing, and remove them from production keys.

Budget Defaults

Good starting limits for public embeds:

LimitStarting point
Messages per minute per IP20
Active streams per session1
Daily messages per keyBased on expected site traffic
Monthly spend capSet below the customer's approved budget
File sizeKeep small unless the use case requires large documents

Incident Response

If an embed key is abused:

  1. Disable or rotate the key.
  2. Review top origins, IPs, and sessions.
  3. Tighten allowed domains and rate limits.
  4. Check whether write-capable tools were enabled.
  5. Create a new key after limits are updated.