EcoBot is Eco-It’s conversational AI assistant, specialised exclusively in recycling and environmental sustainability in the Colombian context. It is powered by OpenRouter usingDocumentation Index
Fetch the complete documentation index at: https://mintlify.com/vanegasjoseignacio2-cyber/Eco-It/llms.txt
Use this file to discover all available pages before exploring further.
openrouter/free as the primary model, with an automatic fallback to Google Gemini 2.5 Flash Lite (google/gemini-2.5-flash-lite) when the free-model quota is exhausted. All endpoints under /api/ai require a valid JWT and apply the verificarToken middleware — unauthenticated requests receive 401 Unauthorized.
Text chat
POST /api/ai/consultar
Sends a question to EcoBot and streams the response back using Server-Sent Events (SSE). Chat history is persisted per user. Each user may have up to 50 chats; the oldest are removed automatically when the limit is exceeded.
Authentication: Required.
Request body
The question or message to send to EcoBot. Must be a non-empty string.
Optional. The
_id of an existing chat to continue. If omitted, a new chat is created and its ID is sent as the first SSE event.data: lines until the model finishes:
First event. Always sent before any content. Contains the chat ID (new or existing) so the client can associate the stream with a chat record.
Content chunk events. One or more events, each carrying a fragment of the model’s response. Concatenate all
content values to build the full answer.Final event. Signals that the stream is complete. Close the reader when this event is received.
Image analysis
POST /api/ai/analizar-imagen
Sends an image to EcoBot for recycling-focused visual analysis using Gemini 2.5 Flash Lite (multimodal). The model identifies materials in the image and advises which Colombian recycling bin colour to use. This endpoint is not streaming — it returns a complete JSON response.
Authentication: Required.
Request body
The image as a base64 data URL — e.g.,
"data:image/jpeg;base64,/9j/4AAQ...". Obtain this by reading a <input type="file"> with FileReader.readAsDataURL().Optional. Additional text context to help EcoBot understand the image — e.g.,
"¿En qué caneca va este envase?". If omitted, the model is instructed to perform a general sustainability analysis.Optional. Attach this analysis to an existing chat. If omitted, a new chat titled
"Análisis de imagen" is created.EcoBot’s analysis in plain text (no Markdown formatting). Contains bin colour recommendations based on Colombian recycling norms.
The
_id of the chat where this analysis was saved.Chat history
All chat history endpoints are scoped to the authenticated user — a user can only read or delete their own chats.GET /api/ai/chats
Returns a lightweight list of all the user’s chats, sorted from most recently updated to oldest. Use this to populate a sidebar or history panel.
Authentication: Required.
Response
Array of chat summary objects.
MongoDB
_id of the chat.Auto-generated title (first 40 characters of the opening question).
ISO 8601 timestamp of the last message.
GET /api/ai/chats/:id
Retrieves the full message history of a single chat, including every user and bot turn, plus any attached image data.
Authentication: Required.
Path parameter
The
_id of the chat to retrieve.The owner’s user
_id.Ordered array of message objects.
"user" or "bot".Text content of the message.
Base64 data URL of an attached image (present only on image-analysis messages).
DELETE /api/ai/chats/:id
Permanently deletes a single chat and all its messages.
Authentication: Required.
Path parameter
The
_id of the chat to delete."Chat eliminado correctamente".DELETE /api/ai/chats
Deletes all chats belonging to the authenticated user. Use this for a “clear history” feature.
Authentication: Required.
Request body: None.
Response
"Todos los chats han sido eliminados".EcoBot behaviour notes
EcoBot is restricted to topics about recycling, waste classification, composting, circular economy, renewable energy, and environmental sustainability in a Colombian context. It always refers to Colombia’s three-colour bin system: White (aprovechables — plastics, glass, metals), Black (no aprovechables — soiled paper, diapers), Green (orgánicos — food waste).
EcoBot responds in plain text only — no Markdown, no bold, no headings. Render the response content directly in your UI without a Markdown parser.
Error reference
| HTTP Status | Cause |
|---|---|
400 | Missing pregunta or imagen field |
401 | Missing, expired, or invalid JWT |
404 | chatId not found or does not belong to the authenticated user |
500 | OpenRouter / Gemini API error; internal server error |