Overview
The Chat API lets you embed a TalkifAI text agent as a chat interface in any website or application. It uses standard REST + Server-Sent Events (SSE) streaming — no WebRTC or microphone required. Base URL:Endpoints
Create Session
Response:
Send Message
Response: Server-Sent Events (SSE) stream (
Content-Type: text/event-stream)
Each SSE event has a named event: field followed by a data: line, separated by a blank line:
SSE Event Types
Parsing the Stream
SSE events are separated by blank lines (\n\n). Each event block contains event: and data: lines. Parse them together — do not rely on the data: line alone to determine event type.
Get Message History
Response:
End Session
Always end sessions explicitly to trigger memory ingestion, post-call analysis, and webhooks.- Billing session closed and credits consumed
- Memory ingested into Graphiti (for returning user context)
- Post-call analysis triggered (if configured on agent)
- Webhook fired (if agent has webhook configured)
Sessions automatically expire after 30 minutes of inactivity. Always call
/end explicitly to ensure memory ingestion and webhooks fire correctly.Error Codes
Session Lifecycle
/end. However, calling /end is required to trigger billing finalization, memory ingestion, and post-call analysis.