Water Intake API
Water Intake provides water logging and daily goal tracking for authenticated users.
Authentication
Use a Firebase user token in the Authorization: Bearer <firebase_jwt> header.
The Water Intake module must be enabled for your client. Contact your administrator if you receive a module-disabled error.
Logs
POST /api/water-intake/logs
Log a water intake entry.
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
amountMl | number | Yes | Amount in millilitres (1–5000) |
date | string | No | Date in YYYY-MM-DD format (defaults to today) |
{
"amountMl": 250,
"date": "2026-03-17"
}
{
"logId": "log-001",
"clientId": "gofa",
"userId": "user-001",
"amountMl": 250,
"date": "2026-03-17",
"createdAt": "2026-03-17T10:30:00Z"
}
GET /api/water-intake/logs
Get water intake logs for a specific date, including a daily summary.
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
date | string | Today | Date in YYYY-MM-DD format |
{
"date": "2026-03-17",
"totalMl": 1250,
"goalMl": 2000,
"logs": [
{
"id": "log-001",
"amountMl": 250,
"timestamp": "2026-03-17T10:30:00Z"
},
{
"id": "log-002",
"amountMl": 500,
"timestamp": "2026-03-17T08:15:00Z"
},
{
"id": "log-003",
"amountMl": 500,
"timestamp": "2026-03-17T07:00:00Z"
}
]
}
DELETE /api/water-intake/logs/[logId]
Remove a water intake log entry. Users can only delete their own logs.
{
"success": true
}
Error Responses:
| Status | Description |
|---|---|
| 403 | User does not own this log |
| 404 | Log not found |
Settings
GET /api/water-intake/settings
Get the user's water intake settings.
{
"dailyGoalMl": 2000
}
PATCH /api/water-intake/settings
Update the user's daily water intake goal.
Request Body:
| Field | Type | Required | Description |
|---|---|---|---|
dailyGoalMl | number | Yes | Daily goal in millilitres (500–10 000) |
{
"dailyGoalMl": 2500
}
{
"dailyGoalMl": 2500
}
Admin Records
GET /api/water-intake/records
Admin-only endpoint to list water intake log records for a client. Requires admin authentication.
Query Parameters:
| Parameter | Type | Default | Description |
|---|---|---|---|
clientId | string | — | Target client ID (admin can query other clients) |
limit | number | 50 | Max results (1–500) |
{
"data": [
{
"id": "log-001",
"clientId": "gofa",
"userId": "user-001",
"amountMl": 250,
"date": "2026-03-17",
"createdAt": "2026-03-17T10:30:00.000Z",
"timestamp": "2026-03-17T10:30:00.000Z"
}
],
"count": 1
}
Error Responses:
| Status | Description |
|---|---|
| 401 | Unauthorized — admin authentication required |
| 403 | Water Intake module not enabled for this client |
| 500 | Internal server error |
Results are ordered by createdAt descending. The Water Intake module must be enabled for the target client.