Authenticated streaming conversations with the 1CARE wellness assistant.
The Wellness Chat API powers the 1CARE wellness assistant. It supports authenticated, streaming conversations about general wellness topics such as recovery, sleep, movement, nutrition, and recent assessment context.
Send a Firebase ID token in the Authorization header:
Authorization: Bearer <firebase-id-token>The aiChat module must be available for the request hostname's client. The
assistant runs in the authenticated user's context and must not be used to
access another user's data.
/api/wellness-chatThe request must include an id and either a latest message or a non-empty
messages array. The last message must have the user role.
| Field | Type | Required | Description |
|---|---|---|---|
id | string | Yes | Session identifier. Use draft-session to create a new persisted session. |
message | UI message | No | Latest user message for a new or continuing request. |
messages | UI message[] | No | Alternative input; the final item is used as the latest user message. |
An AI SDK UI message contains a role and parts. A text part has
{"type":"text","text":"..."}.
{
"id": "draft-session",
"message": {
"id": "msg-001",
"role": "user",
"parts": [
{
"type": "text",
"text": "What are three simple ways to improve my sleep this week?"
}
]
}
}When id is draft-session, the server creates a wellness session for the
authenticated user and returns its generated ID in the stream metadata. When
continuing a session, the ID must belong to the authenticated user and have
the wellness assistant type; otherwise the route returns 404.
The response is an AI SDK UI message stream. Consume the stream with the AI SDK client rather than treating it as a JSON object. The stream can include assistant reasoning and tool parts. The server may use these user-scoped tools when relevant:
get_current_timeget_user_available_dataget_user_field_valueget_body_metrics_historyThe assistant provides general wellness information. It does not diagnose medical conditions or prescribe treatment. Users describing urgent symptoms should be directed to qualified medical help.
The route returns 400 when no session ID is supplied, no message is supplied,
or the latest message is not from the user. Missing or invalid authentication
returns 401; an unavailable client module returns 403.
The published production route exposes chat creation and continuation through this POST endpoint. It does not publish separate chat-history GET, PATCH, or DELETE routes, so clients should not build against the legacy history paths.