Embedding the dashboard is available to enterprise customers with Partner API access. Contact us to get started.
Summary/Quick Start
- Get your API key from Settings → API Keys in your Answering Agent dashboard
- Create a user via
POST /api/v1/users, or attach an existing partner identity to an approved linked organization - Request an embed token for the intended
organization_idand keep it server-side until rendering - Embed the dashboard using
<iframe src="https://answeringagent.com/dashboard/embed?token=EMBED_TOKEN"> - User’s browser loads embed → token is auto-exchanged for dashboard auth
X-API-KEY = your server only. embed_token = the compact browser input for one intended dashboard context.
The Answering Agent dashboard can be embedded into your website, providing a seamless customer support platform for your users. The embed system uses secure, compact tokens that authenticate users without exposing sensitive credentials.
Authentication Overview
The embed system involves two different authentication contexts:Your Server (Partner)
Uses the X-API-KEY header to call the Partner API and retrieve embed tokens for your users.
User's Browser (End User)
Uses the embed_token which is automatically exchanged for embedded dashboard authentication.
How Tokens Flow
1
Your server requests an embed token
Call the Partner API with your
X-API-KEY to get an embed_token for a specific user and, for scoped viewers, a specific organization_id.2
Your server passes the token to the browser
Inject the
embed_token into the iframe URL.3
The embed exchanges the token
When the iframe loads, Answering Agent exchanges the
embed_token for embedded dashboard authentication.4
User is authenticated
The embedded dashboard uses that authentication for page loads, navigation, and dashboard API calls. This happens automatically.
Getting Embed Tokens (Server-Side)
These endpoints require your X-API-KEY header and should only be called from your server, never from client-side code.
From User Creation
When you create a user from your server, the response includes anembed_token:
Managing Existing Tokens
For existing users, your server can retrieve or regenerate embed tokens. Includeorganization_id for scoped viewers and whenever a user has more than one eligible organization context:
Get Current Embed Token
- cURL
- Node.js
- PHP
Generate New Embed Token
Multi-Organization Viewer Setup
An owner-linked organization must independently approve your partner account before you can attach viewers. Your server then reuses one partner-owned identity across approved organizations:Embedding the Dashboard
Embed the dashboard with an iframe for complete DOM isolation:- Zero JavaScript required - just paste the iFrame
- Complete DOM isolation from your page
- Works with strict Content Security Policies
- No conflicts with your site’s CSS or JavaScript
- Easy to implement in any CMS or page builder
sonnys and optspot. Omit theme for the default Answering Agent dashboard styling.
Existing iframe embeds that use https://answeringagent.com/dashboard.html?token=... remain supported and run through the same embed exchange. Existing script embeds that load https://answeringagent.com/embed.js also remain supported; the script creates a /dashboard/embed iframe for you. New installs should use the direct /dashboard/embed iframe.
Quick Start Checklist
- iFrame tag with
srcpointing to/dashboard/embed?token=YOUR_TOKEN - Valid embed token in the URL query parameter
- Optional partner theme with
theme=sonnysortheme=optspot
embed_token for dashboard authentication and the dashboard enforces the selected organization scope.
When switching organizations, request a token for the new organization_id and replace the existing iframe src. Running multiple same-origin organization embeds simultaneously in one browser session is not a supported isolation boundary.
Custom API URLs are restricted to the default API origin, the playground API origin, or origins listed in the Next.js EMBED_API_URL_ALLOWLIST environment variable.
Dynamic Token Integration
For production applications, your server should fetch embed tokens and pass them to the frontend.Server-Side Endpoint
Create an endpoint in your backend that fetches the embed token:- Node.js / Express
- PHP / Laravel
Client-Side Integration
Your frontend calls your backend (not Answering Agent directly):The iframe route automatically handles exchanging the
embed_token for dashboard auth. You don’t need to call /api/validate-embed-token yourself.React Component Example
Your
/api/embed-token endpoint should authenticate the request using your own auth system, then call the Answering Agent Partner API with your X-API-KEY.Security Features
Token Types
Compact Tokens
- URL-safe base64 encoding without padding
- Optimized for query parameters and data attributes
Secure Validation
- Uses HMAC-SHA256 for cryptographic integrity
- Scoped tokens are tied to a specific user, partner, organization, grant, and authority generation
- Every scoped request revalidates current authority before it can read organization data
Token Lifecycle
- Compact tokens have no built-in expiry but can be invalidated immediately
- Exchanged dashboard bearers expire after 15 minutes
- Scoped viewers can have independent tokens for multiple organizations
- Detach, grant disable/revoke, partner-link revoke, membership removal, or user deletion invalidates the affected scoped authority
Error Handling
Invalid or Expired Tokens
If an embed token is invalid, the embedded dashboard will show an authentication error. Common causes:- Token was invalidated by generating a new one
- The viewer was detached or its owner-approved grant, partner link, membership, or user was revoked
- Token is malformed or corrupted
- User account was deleted or suspended
Missing Configuration
If the embed container is not properly configured, you may see:- Console warnings about missing configuration
- Dashboard not loading or appearing blank
- Authentication errors
Best Practices
Server-Side (Your Backend)
- Never expose X-API-KEY - Keep your API key in server-only secret storage
- Proxy embed tokens - Your backend should fetch tokens and pass them to the frontend
- Bind requests to organization_id - Authorize the organization in your own backend before requesting its scoped token
- Replace the iframe when switching - Request a fresh organization token and update the single iframe
src - Rotate on security events - Rotate only the affected organization relationship when possible
Client-Side (User’s Browser)
- Use iframe embeds - Use
/dashboard/embed?token=...for the Next.js dashboard experience - Handle errors gracefully - Show fallback UI if embedding fails
- Use HTTPS only - Never transmit tokens over insecure connections
Troubleshooting
Dashboard Won’t Load
- Verify the embed token is valid by checking the Partner API response
- Confirm the iframe
srcincludes/dashboard/embed?token=... - Check browser console for JavaScript errors
- Ensure the iframe has proper dimensions and is visible
Authentication Errors
- The embed token may have been invalidated - fetch a new one from the Partner API
- For a multi-organization user, verify your server requested the intended
organization_id - Check that your server is using the correct
X-API-KEY - Verify the user exists in Answering Agent
- Ensure the iframe URL includes a valid
tokenparameter
Configuration Errors
- Verify the iframe
srcpoints tohttps://answeringagent.com/dashboard/embed - Check that the
tokenquery parameter contains a valid embed token - Monitor network requests to verify API calls are reaching the correct endpoint
Performance Issues
- Cache embed tokens in your backend to avoid repeated Partner API calls
- Monitor iframe sizing to prevent layout shifts