Skip to navigation

Persist Chat

Persist a completed chat turn (after the client has streamed the assistant reply) to the conversation history.

Authentication: Required — Bearer token. No AI connector required.

Request body:

  • conversation_id — Conversation/client id
  • base_messages — Prior { role, content } turns to persist
  • assistant_content — The assistant’s reply (sanitized for end users; any embedded internal payload is stripped)
  • intent (optional) — Stored in internal metadata
  • action_context (optional, default {})
  • safe_intent (optional) — When true the system prompt is excluded from saved history
  • total_tokens (optional) — When > 0, records intent token usage

Response:

  • data.status — ok
  • data.assistant_content — The sanitized assistant text that was stored

Side effects: Writes ChatHistory; records token usage when total_tokens > 0.

Errors:

  • 422 — { error: { message } } on a raised error

Authentication

AuthorizationBearer

Bearer authentication of the form Bearer <token>, where token is your auth token.

Request

This endpoint expects an object.
conversation_idstringOptional
base_messageslist of objectsOptional
assistant_contentstringOptional
intentstringOptional
action_contextobjectOptional
safe_intentbooleanOptional
total_tokensintegerOptional

Response

OK