Overview
The Text Chat API enables developers to integrate TalkifAI text agents into websites, mobile apps, and other applications using REST + Server-Sent Events (SSE) streaming. Base URL:https://api.talkifai.dev/v1/chat
Authentication:
- Session Creation:
X-API-KeyorX-Studio-Tokenheader - All Other Requests:
Authorization: Bearer {session_token}(JWT)
Endpoints
Create Session
POST /sessions — Create a new chat sessionSend Message
POST /sessions/{id}/messages — Send message (SSE stream)Get History
GET /sessions/{id}/messages — Retrieve message historyEnd Session
POST /sessions/{id}/end — End session and cleanupCreate Voice Session
POST /voice-sessions — Create LiveKit voice sessionAuthentication
Session Creation (Server-Side)
Two authentication methods supported: Method 1: API KeyAll Other Requests (Client-Side)
/sessions endpoint, valid for 24 hours.
Request/Response Models
CreateSessionRequest
CreateSessionResponse
SendMessageRequest
Message
MessagesResponse
EndSessionResponse
SSE Event Types
When sending messages, the response is streamed via Server-Sent Events:Error Codes
Session Lifecycle
Related Documentation
- Chat API Guide — Complete integration guide with examples
- Custom Functions — Add API integrations
- Conversation Memory — Enable long-term memory
- Agent Architectures — Text vs Voice agents
SDK Support
Official SDKs:- JavaScript/TypeScript (coming soon)
- Python (coming soon)
- React Hook (see guide)
- Check npm and PyPI for community-maintained packages
Rate Limits
Rate limits are per API key or session token.
CORS
Allowed Origins:- All origins allowed (
*) - Configure in your API key settings
GET,POST,OPTIONS
Content-TypeAuthorizationX-API-KeyX-Studio-TokenOrigin
Webhooks
When a chat session ends, a webhook is sent if configured on the agent:Next Steps
Create Session
Start with POST /sessions to create your first chat session.
Integration Guide
See the complete guide with React/Next.js examples.