[DE] Bob [DE] Office 168/52 developer documentation

[DE] API reference, webhooks, and the embeddable widget for Bobโ€”your governed AI front office.

[DE] ๐Ÿ” Authentication

POST /api/auth/login
[DE] Authenticate admin users and obtain access token
{
  "email": "admin@office16852.com",
  "password": "your_password"
}
POST /api/customers/auth/login
[DE] Authenticate customer users (multi-tenant)
{
  "email": "customer@business.com",
  "password": "customer_password"
}

[DE] ๐Ÿ’ฌ Chat & Conversations

[DE] Three paths: [DE] (1) [DE] Public same-origin anonymous โ†’ POST /api/chat [DE] (e.g. marketing site widget; no login). (2) [DE] Cross-origin embed โ†’ POST /api/widget/chat [DE] with X-Widget-Key [DE] and allowed Origin[DE] . (3) [DE] Authenticated app / Mission Control โ†’ POST /api/chat/session [DE] and POST /api/chat/message [DE] (requires chat.manage [DE] and session/CSRF for cookie auth) โ€” [DE] not [DE] for anonymous fetch [DE] from public pages.

[DE] 1) Public anonymous (same-origin)

POST /api/chat
[DE] Unified pipeline for visitors on your own domain without signing in. Body includes message, session_id[DE] , optional business_id.

[DE] 2) Cross-origin widget

POST /api/widget/chat
[DE] Embeds on customer sites. Headers: X-Widget-Key, Content-Type: application/json. Origin [DE] must be allowed for the key. See docs/REQUEST_FLOWS.md [DE] in the repository for CORS details.

[DE] 3) Authenticated session / admin UI only

POST /api/chat/session
[DE] Create session when logged into Mission Control or dashboard (RBAC + CSRF for cookies).
POST /api/chat/message
[DE] Send a message from [DE] authenticated [DE] admin/chat UI (chat.manage[DE] ). Returns 401 [DE] if called anonymously from a public page โ€” use POST /api/chat [DE] for that case instead.
{
  "session_id": "session_123",
  "message": "Hello, I need help with my order"
}
GET /api/chat/history/:session_id
[DE] Retrieve chat conversation history (authenticated)

[DE] ๐Ÿ“Š Analytics & Monitoring

GET /api/analytics/overview
[DE] Get system analytics overview
GET /api/health
[DE] Check system health status
GET /api/metrics/business
[DE] Get business-specific metrics

[DE] ๐Ÿข Multi-Tenant Customer Management

GET /api/customers/dashboard/:businessId
[DE] Get customer dashboard data for specific business
GET /api/customers/analytics/:businessId
[DE] Get business analytics for specific customer
GET /api/customers/integration/:businessId/status
[DE] Check integration status for business

[DE] ๐ŸŽฏ UnityXpressions Pilot

GET /api/unityxpressions/dashboard
[DE] UnityXpressions pilot dashboard data
GET /api/pilot/metrics/realtime
[DE] Real-time pilot performance metrics
GET /api/pilot/feedback/recent
[DE] Recent customer feedback from pilot

[DE] ๐ŸŽ“ Training & Learning

POST /api/training/unityxpressions/analyze
[DE] Analyze UnityXpressions business for training
POST /api/training/unityxpressions/quick-setup
[DE] Quick setup training for UnityXpressions
GET /api/learning/health
[DE] Learning engine health status

[DE] ๐Ÿ”Œ Widget Installation

[DE] Add Bob to any website with a single script tag. After onboarding, your widget embed code is available in the Customer Portal under [DE] Widget Setup.

<!-- Paste before </body> -->
<script
  src="https://your-domain.com/widget/loader.js"
  data-widget-key="YOUR_WIDGET_KEY"
  data-position="bottom-right"
  async>
</script>
GET /api/customer-portal/widget-code
[DE] Returns ready-to-paste embed code for your website. Requires customer JWT.

[DE] ๐ŸŽญ Persona Customization

[DE] Personas control how Bob communicates โ€” tone, name, and system instructions. Every tenant gets a default persona on signup; you can customize it from the Admin Dashboard or the API.

GET /api/personas/:tenantId
[DE] List all personas for a tenant.
POST /api/personas/:tenantId
[DE] Create a new persona. Body: { name, description, tone, systemPrompt }
PUT /api/personas/:tenantId/:personaId
[DE] Update an existing persona's tone, instructions, or name.

[DE] ๐Ÿ’ฐ Plans & Pricing

[DE] Published pricebook is the source of truth. Use the APIs below for live numbers; this table matches pricebook-seed [DE] V1 (adjusts when you publish a new version).

[DE] Feature [DE] Starter [DE] Pro [DE] Enterprise
[DE] List price (USD/mo) [DE] $79 [DE] $249 [DE] $899
[DE] Included AI credits / mo [DE] 15,000 [DE] 75,000 [DE] 250,000
[DE] Team seats [DE] Up to 3 [DE] Up to 10 [DE] Unlimited
[DE] Standard integrations (included) 1 3 10
[DE] Support [DE] Email [DE] Priority [DE] Dedicated
GET /api/pricing/marketing-cards
[DE] Plan cards for marketing and checkout UI (prices, credits, estimates)โ€”derived from the published pricebook. No authentication required.
GET /api/pricing/snapshot
[DE] Public-safe full pricebook snapshot (no provider cost fields). No authentication required.

[DE] ๐Ÿ› ๏ธ Integration Examples

[DE] Use the block that matches your scenario. Do not copy the admin example into anonymous marketing HTML.

[DE] Public same-origin (anonymous)

const response = await fetch('/api/chat', {
  method: 'POST',
  headers: { 'Content-Type': 'application/json' },
  body: JSON.stringify({
    session_id: sessionId,
    message: userMessage,
    business_id: 'office16852-platform'
  })
});
const data = await response.json();

[DE] Cross-origin widget

const response = await fetch('https://office16852.com/api/widget/chat', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'X-Widget-Key': 'pk_live_...',
    'Origin': 'https://your-customer-site.com'
  },
  body: JSON.stringify({ session_id: sessionId, message: userMessage })
});

[DE] Authenticated admin only (Bearer)

// JavaScript โ€” requires logged-in admin / Mission Control (Bearer)
const response = await fetch('/api/chat/message', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json',
    'Authorization': 'Bearer ' + token
  },
  body: JSON.stringify({
    session_id: sessionId,
    message: userMessage
  })
});
const data = await response.json();
// Python โ€” authenticated only
import requests
response = requests.post(
    'https://office16852.com/api/chat/message',
    headers={
        'Content-Type': 'application/json',
        'Authorization': f'Bearer {token}'
    },
    json={ 'session_id': session_id, 'message': user_message }
)