Skip to main content

Wellness Chat API

The Wellness Chat API powers the 1CARE wellness assistant experience. It supports authenticated, streaming conversations focused on general wellness topics such as recovery, sleep, movement, nutrition, and interpretation of recent assessment context.

Authentication

Use a Firebase user token in the Authorization: Bearer <firebase_jwt> header.

note

The Wellness Chat module must be enabled for your client. If the feature is unavailable, contact your administrator.

Start Or Continue A Chat

POST /api/wellness-chat

Streams the assistant response for a new or existing chat thread.

This endpoint accepts either:

  • A full messages array for stateless requests, or
  • A chatId / id plus the latest message when continuing a persisted chat

Request Body:

FieldTypeRequiredDescription
idstringNoChat ID for a persisted thread
chatIdstringNoAlias of id
messageobjectNoLatest user message when continuing a persisted thread
messagesarrayNoFull message list for a non-persisted or stateless request
Request
{
"id": "wellness-chat:123e4567-e89b-12d3-a456-426614174000",
"message": {
"id": "msg-001",
"role": "user",
"parts": [
{
"type": "text",
"text": "What are three simple ways to improve my sleep this week?"
}
]
}
}

Response:

The response is streamed. Client applications should consume it as an AI SDK UI message stream.

Chat History

GET /api/wellness-chat/chats

Returns the authenticated user's saved wellness chat threads.

Response
{
"chats": [
{
"id": "wellness-chat:123e4567-e89b-12d3-a456-426614174000",
"user_id": "user-001",
"title": "What are three simple ways to improve my sleep this week?",
"created_at": "2026-03-18T10:00:00Z",
"updated_at": "2026-03-18T10:02:00Z"
}
],
"hasMore": false
}

GET /api/wellness-chat/chats/[chatId]

Returns a single chat thread and its saved messages.

Response
{
"chat": {
"id": "wellness-chat:123e4567-e89b-12d3-a456-426614174000",
"user_id": "user-001",
"title": "What are three simple ways to improve my sleep this week?",
"created_at": "2026-03-18T10:00:00Z",
"updated_at": "2026-03-18T10:02:00Z"
},
"messages": [
{
"id": "msg-001",
"role": "user",
"parts": [
{
"type": "text",
"text": "What are three simple ways to improve my sleep this week?"
}
]
}
]
}

PATCH /api/wellness-chat/chats/[chatId]

Update the saved title for a wellness chat thread.

Request Body:

FieldTypeRequiredDescription
titlestringYesNew chat title
Request
{
"title": "Sleep improvement ideas"
}
Response
{
"success": true
}

DELETE /api/wellness-chat/chats/[chatId]

Delete a saved wellness chat thread.

Response
{
"success": true
}

Notes

  • The assistant may incorporate user profile context and recent assessment context when relevant.
  • Responses are informational and wellness-oriented. They are not a substitute for professional medical advice.