Integration paths
0xDoktor offers three integration patterns depending on your use case:
1. Widget embed (simplest)
Add a single <script> tag to any HTML page:
<script
src="https://widget.0xdoktor.com/v1/widget.js"
data-tenant="YOUR_TENANT_ID"
data-kb="YOUR_KB_ID"
async
></script>
The widget renders a floating chat button. No backend changes required on your side. Configuration (appearance, welcome message, confidence threshold) is managed in the admin dashboard — changes take effect without redeployment.
2. REST API (programmatic)
For custom UI or backend integration, use the REST API directly:
POST https://api.0xdoktor.com/chat
Content-Type: application/json
Authorization: Bearer <your-token>
{
"tenantId": "your-tenant-id",
"knowledgeBaseId": "your-kb-id",
"question": "How do I reset my password?",
"conversationId": "optional-for-multi-turn"
}
The response includes the answer, confidence score, sources, and any warnings. Use the conversationId field to maintain multi-turn conversation context.
3. Webhook push connector (for CMS and automation)
If you have an existing CMS, database, or document pipeline, the push connector lets you automatically keep 0xDoktor's knowledge base in sync:
POST https://api.0xdoktor.com/api/connectors/push/YOUR_TENANT_ID
X-Webhook-Secret: YOUR_HMAC_SECRET
{
"documents": [
{
"slug": "my-article-slug",
"title": "How to reset your password",
"content": "To reset your password, go to Settings → Security...",
"sourceHash": "sha256-of-content"
}
]
}
The sourceHash field enables exact duplicate detection — re-pushing the same content does not re-index it, preventing unnecessary storage and processing costs.
Content Security Policy
If your site has a strict CSP, add the following to your script-src and connect-src directives:
script-src: https://widget.0xdoktor.com
connect-src: https://api.0xdoktor.com
SSE streaming
The widget supports server-sent events for streaming responses. Enable it with data-stream="true" on the embed script tag. The API exposes POST /v1/chat/stream for the SSE path.
Authentication
Widget embeds do not require end-user authentication — the tenant ID and optional KB ID are sufficient. For admin operations (ingestion, configuration, analytics), use a JWT token obtained via POST /auth.
Can I use multiple knowledge bases?
Yes. Pass the knowledgeBaseId field to target a specific KB. Without it, the default KB for the tenant is used. This lets you power different widgets (e.g., product docs vs. support FAQ) from separate, independently managed knowledge bases.