Widget Gateway
The widget gateway powers the embedded web widget. Authentication uses widget API keys (wk_pub_ / wk_sec_), then optional JWT for message calls.
Base URL: https://agent-api.auteryn.ai
Authentication flow
Section titled “Authentication flow”POST /api/v1/widget/init— validate domain + API key; returnssession_id,resume_tokenand the widget configPOST /api/v1/widget/auth?session_id=...— exchange the session’sresume_tokenfor a one-hour JWTPOST /api/v1/widget/message— send chat messages (SSE response); auth via Bearer JWT orX-API-KeyGET /api/v1/widget/history/{session_id}— fetch conversation history (Bearer JWT only;limitdefaults to 50, max 100)
PUT /api/v1/widget/session (Bearer JWT only) turns an anonymous session into a known customer: session_id, email, and optionally name and external_id.
The agent is bound to the widget connection through a Loop, not passed in the embed script.
Widget API keys
Section titled “Widget API keys”Widget keys are separate from org API keys:
| Type | Prefix | Usage |
|---|---|---|
| Public | wk_pub_... |
Client-side embed (domain-restricted) |
| Secret | wk_sec_... |
Server-side only |
These keys belong to widgets added before 26 September 2026. Integrations → Web Chat Widget now adds a website on the Website channel, with a site_pub_ key instead.
Example: init
Section titled “Example: init”POST https://agent-api.auteryn.ai/api/v1/widget/initX-API-Key: wk_pub_xxxxxxxxOrigin: https://yoursite.comContent-Type: application/json{ "fingerprint": "browser-fingerprint-string", "visitor_id": "optional-persistent-visitor-id", "referring_page": "https://yoursite.com/pricing"}The response includes session_id (required for /auth and /message), config,
is_new_session, is_identified and resume_token. Treat resume_token like a
password: it is the visitor’s session. Send it back to /init to resume the
session.
Example: auth
Section titled “Example: auth”POST https://agent-api.auteryn.ai/api/v1/widget/auth?session_id=sess_abcX-API-Key: wk_pub_xxxxxxxxOrigin: https://yoursite.comContent-Type: application/json{ "resume_token": "the resume_token from /init" }Returns { "success": true, "access_token": "...", "expires_in": 3600, "message": "Authentication successful" }.
Without a resume_token the call answers 401. When no token can be issued,
expires_in is 0 and there is no access_token; send X-API-Key on
/message instead.
Example: send message
Section titled “Example: send message”POST https://agent-api.auteryn.ai/api/v1/widget/messageAuthorization: Bearer eyJ...Content-Type: application/jsonOrigin: https://yoursite.com{ "content": "How do I reset my password?", "session_id": "sess_abc"}Alternatively, pass X-API-Key: wk_pub_... instead of Bearer JWT.
Domain restriction
Section titled “Domain restriction”Widget keys are restricted to allowed domains configured on the connection. Requests from other origins are rejected.
Related
Section titled “Related”- Integrations → Web Chat Widget: the Integration behind the Website channel
- Website channel: set up a website and install the chat

