← Back to LibreBot

LibreBot Widget API

LibreBot exposes a small browser API for loading widget configuration and sending chat messages grounded in a site's uploaded documents.

Authentication and origin policy

The public site key bootstraps a short-lived widget token. Tokens are signed, restricted to the saved website hostname, bound to the requesting client, and expire after ten minutes. The widget performs this exchange automatically.

POST https://api.librebot.ai/widget-token
Authorization: Bearer lb_your_site_key

Load widget configuration

GET https://api.librebot.ai/widget-config?key=lb_your_site_key

Returns public display settings such as colors, title, position, and welcome text.

Send a chat message

POST https://api.librebot.ai/chat
Content-Type: application/json
Authorization: Bearer wst_short_lived_widget_token

{
  "message": "How do I configure authentication?",
  "stream": true,
  "sessionId": "optional-session-id"
}

Streaming responses use Server-Sent Events. Each content event contains a JSON object with a content field, followed by metadata anddata: [DONE].

Do not send the long-lived lb_… site key to the chat endpoint.

Machine-readable resources