The Chat API powers NutriBot, HealtyHelp’s conversational nutrition assistant. NutriBot uses Groq LLaMA 3.3 70B (Documentation Index
Fetch the complete documentation index at: https://mintlify.com/JuanSebasSV/healtyhelp/llms.txt
Use this file to discover all available pages before exploring further.
llama-3.3-70b-versatile) and personalises every response with the authenticated user’s health profile, allergies, dietary preferences, and the filtered recipe catalogue.
All routes require a valid Bearer token in the Authorization header.
POST /api/chat
Sends a message to NutriBot and receives a reply. The conversation history (up to the last 10 messages) can be provided to maintain context across turns. Request bodyThe user’s message text. Cannot be empty.
Optional array of previous conversation turns. Maximum of 10 entries are used (older entries are silently discarded). Each entry must begin with a
user message — any leading model entries are removed before the request is forwarded to Groq.The
history array uses "model" for the assistant role. Internally, the API maps "model" → "assistant" when building the Groq request, because the Groq API follows the OpenAI message role convention.- Loads the user’s
healthProfile(condiciones,categorias,alergias,preferencias) and legacyalergiafield. - Filters the recipe catalogue to those matching
healthProfile.categorias(or the full catalogue if none are set). - Removes recipes whose
ingredientescontain any of the user’s allergies. - Injects the filtered recipe list, the user’s profile, and a behaviour directive into a system prompt that also includes the active NutriBot prompt from
AIConfig.
200 OK
| Status | Body | Condition |
|---|---|---|
400 | { "error": "El mensaje es requerido" } | message field is missing or empty |
429 | { "error": "rate_limit", "reply": "Estoy recibiendo muchas consultas..." } | Groq quota exceeded or upstream 429/503 |
500 | { "error": "Error al procesar tu mensaje" } | Unexpected server-side error |
GET /api/chat/filtros
Returns the full health profile used to personalise chat responses, including allergies and preferences (unlikeGET /api/recomendaciones/filtros, which intentionally omits those fields).
Response 200 OK
| Field | Type | Description |
|---|---|---|
condiciones | string[] | Active health conditions; drive both chat and recommendations |
categorias | string[] | Meal category filters; restrict the recipe catalogue shown to NutriBot |
alergias | string[] | Allergen strings; recipes containing matching ingredients are filtered out before the chat call |
preferencias | string[] | Free-form dietary preferences; surfaced to NutriBot in the system prompt for context only |
PUT /api/chat/health-profile
Updates the authenticated user’s health profile. All fields are optional arrays — omit any field to leave it unchanged. Request bodyReplace the user’s active health condition identifiers. See the Recommendations API for the full list of recognised values.
Replace the active meal category filters used to narrow the recipe catalogue (e.g.
["desayuno", "almuerzo"]).Replace the user’s allergen list. Ingredient matching is case-insensitive substring search.
Replace the user’s free-form dietary preferences (e.g.
["alto en proteína", "sin gluten"]).200 OK
GET /api/chat/prompt
Returns the current NutriBot system prompt stored inAIConfig. This is the base behaviour directive injected at the start of every chat completion.
Response 200 OK
The prompt is cached in memory for up to 60 seconds. Changes made via
PUT /api/chat/prompt take effect immediately (cache is invalidated on save), but concurrent server instances may serve the old prompt for up to one minute.PUT /api/chat/prompt
Replaces the NutriBot system prompt. All authenticated users can call this endpoint; restrict access to admin roles at the application level. Request bodyNew system prompt text. Must be a non-empty string.
200 OK
| Status | Condition |
|---|---|
400 | prompt is missing, not a string, or blank |
500 | Database write error |