Ema 2.0 API Documentation
Gold-standard integration for health experiences.
Everything you need to integrate Ema into your platform. Stream responses, manage user sessions, and deliver clinical-grade conversational experiences to your users.
Quick Start Integration
Get up and running with the Ema API in minutes. Follow these steps to start delivering empathetic, clinically accurate conversations to your users.
Get Suggested Prompts
Optionally display curated prompts to help users get started with empathetic, health-focused conversations.
Create User Session
Call the Create User endpoint to get a unique userId for managing personalized conversation context.
Start Streaming
Use the Live Talk endpoint to send messages and receive real-time streaming responses from Ema.
/ema/user
Create User Session
Creates a new user session that serves as the unique identifier for conversations. This endpoint must be called before sending any messages.
Request Body
Success Response
Error Responses
Error Responses
/ema/live-talk
Send Message with Streaming Response
Send a message to Ema 2.0 and receive a live streaming response using Server-Sent Events (SSE). This endpoint supports optional user context for personalized responses.
Request Body
How to Use the context Field
Streamed Response (SSE Format)
Note: The messageId indicates the id of the message created once the stream finishes.
Note: The [DONE] message indicates the end of the stream.
data: (e.g., data: {"content": [...]}) per the SSE protocol. Some tools like Postman automatically hide the data: prefix when displaying responses in the UI but preserve it when saving to file. This is expected behavior and not an error.
Streamed Error Responses
🎮 Streaming Response Demo
This is a visual simulation showing how the streaming response looks and feels:
/ema/messages
Get Chat Message History
Retrieves the chat history for a specific user with pagination support.
Query Parameters
Success Response
/ema/messages/flag
Flag Ema's Response
Flags a specific message from Ema as “good” or “bad", accepting optional reason and description fields to provide feedback context.
Request Body
Success Response
/ema/suggestions
Get Suggested Prompts
Returns a list of suggested prompts to help users get started with their conversations, along with customizable tenant-specific messages for busy and limit states.
Query Parameters
Success Response
Error Responses
Integration Examples
Production-ready code snippets to accelerate your integration.