GET/api/public/widget/history

Loads the message history of a widget conversation, for example after the page has been reloaded.

Pass `widget_code`, `session_id` and `visitor_id` as query parameters. In the `data` object, the response contains the `messages` list with `role` (`user` or `assistant`), `text` and `created_at` in conversation order. The call is read-only and idempotent. The `X-Widget-Token` header with the embed token and `widget_code` are required. If the token is missing, the server responds with 401 `WIDGET_TOKEN_MISSING`, if it is invalid with 401 `WIDGET_TOKEN_INVALID`; calls from domains that are not approved receive 403 `WIDGET_ORIGIN_DENIED`, a deactivated widget 404 `WIDGET_DISABLED`. If `session_id` or `visitor_id` is missing, the server responds with 400 `PARAMS_REQUIRED`. If the session is no longer known, start a new conversation.

Overview

Call: GET /api/public/widget/history. This endpoint belongs to the “Chat Widget” group of the Zentor App API. It requires a valid widget embed token. The call is idempotent: repeating it with the same input returns the same result. Required parameters: widget_code (query), session_id (query), visitor_id (query). Documented error cases: 400 PARAMS_REQUIRED. The example response below shows the structure of a successful JSON response.

Auth & Security

Widget embed token (X-Widget-Token header) + origin allowlist

Idempotent: Yes

Parameters

widget_code(query, string, required)— Widget code from your embed code
session_id(query, string, required)— Session ID of the conversation from the `message` response
visitor_id(query, string, required)— Visitor ID generated by the widget and stored in the browser

Example Response

{"ok":true,"data":{"messages":[{"role":"user","text":"Hello...","created_at":"..."},{"role":"assistant","text":"...","created_at":"..."}]}}

Error Codes

400 PARAMS_REQUIRED — `session_id` or `visitor_id` is missing.

Verified behaviour

An existing session returns 200 with the message history; missing parameters return 400 `PARAMS_REQUIRED`.

Chat Widget

GET /api/public/widget/healthSimple availability check of the widget service.GET /api/public/widget/config/:widget_codeReturns the public configuration of a widget (display name, greeting, design, language, voice feature) for initialisation in the browser.POST /api/public/widget/messageSends a visitor's message to the chatbot and returns its reply – the central endpoint of the chat widget.POST /api/public/widget/pollFetches messages received after a given point in time – for example the reply of an agent who has taken over the conversation.POST /api/public/widget/ratingStores the visitor's rating of a conversation (helpful or not helpful).POST /api/public/widget/trackRecords an anonymous widget usage event (e.g. “widget opened”) for the analyses in the dashboard.POST /api/public/widget/voice-transcribeConverts a visitor's voice recording into text (voice input), if the voice feature is enabled for the widget.POST /api/public/widget/voice-speakConverts text into speech (voice output in the widget), if the voice feature is enabled.

Related articles

← Chat Widget