API Quick Start & Reference

Everything your Web, Android, iOS, or wearable client needs to authenticate, log structured meals and exercise burn, and plot range dashboards on /api/v1.

Progressive integration path

Follow these four steps—every free feature works with zero server LLM calls.

Authenticate & create a token

Register a user account for short-lived JWT + refresh tokens, or issue a scoped Personal Access Token (vhl_...) for scripts and MCP.

Always send Authorization: Bearer <token>. Use Idempotency-Key on POST writes to avoid duplicates during mobile retries.

Log intake & exercise outflow (Free+)

Use POST /meals for itemized foods, POST /meals/nutrients when you already know exact macros, and POST /exercises for structured calories burned.

Zero server LLM calls on structured routes—fast, deterministic, and available on the Free tier.

Query daily totals & /dashboard charts

Call GET /dashboard with no params for month-to-date in the user's timezone, or pass month=YYYY-MM, year=YYYY, or start_date/end_date.

Returns intake, outflow, net calories, averages, category breakdowns, and body-metric trends in one JSON payload.

Optional: BYO storage or Premium server AI

Point storage at platform, local_sqlite, or remote_sql—or upgrade to Premium for plain-English log-text parsing, AI plans, and white-label.

Free and Capacity users calling Premium endpoints receive 403 premium_required so your app can gracefully prompt an upgrade.

Quick requests by language

Base URL: https://vhealth-api.sumflowcloud.com/api/v1 · Interactive Swagger UI at /docs.

POST /api/v1/meals/nutrientsSend Authorization: Bearer <token>
curl -X POST "https://vhealth-api.sumflowcloud.com/api/v1/meals/nutrients" \
  -H "Authorization: Bearer vhl_your_token" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: 7c9e6679-7425-40de-944b-e07fc1f90ae7" \
  -d '{
    "label": "Whey shake + oats",
    "meal_category": "breakfast",
    "calories_kcal": 380,
    "protein_g": 32,
    "carbs_g": 42,
    "fat_g": 8,
    "fiber_g": 5
  }'

Endpoint catalog

Structured meal/nutrient, exercise burn, and dashboard routes are available on Free and Capacity tiers; log-text, AI plans, and white-label require Premium.

Auth & Personal Access Tokens

JWT access tokens, rotating refresh tokens, user settings, and long-lived scoped PATs (vhl_...).

Auth & Personal Access Tokens
EndpointTierBehavior
POST /api/v1/auth/register Public Register user, create profile & storage settings, return tokens
POST /api/v1/auth/login Public Authenticate and return access + refresh tokens
POST /api/v1/auth/refresh Public Rotate refresh token and issue new access token
POST /api/v1/auth/logout Auth Revoke submitted refresh token
GET / PATCH /api/v1/auth/me Auth Read or update full_name, timezone, and unit_system
POST / GET / DELETE /api/v1/auth/tokens Auth Create, list, or revoke scoped Personal Access Tokens (vhl_...)

Profile & Storage Settings

Nutrition targets, dietary preferences/allergies, and data storage mode selection.

Profile & Storage Settings
EndpointTierBehavior
GET / PATCH /api/v1/profile Free+ Read or partial-merge age, weights, goal_type, diet_type, allergies, and macro targets
GET / PUT /api/v1/settings/storage Free+ Configure platform, local_sqlite, or encrypted remote_sql storage

Meals (Intake)

Free structured food & nutrients-only endpoints plus Premium server-LLM plain-English logging.

Meals (Intake)
EndpointTierBehavior
POST /api/v1/meals Free+ / MCP Log itemized structured foods with known or catalog macros (no server LLM)
POST /api/v1/meals/nutrients Free+ / MCP Log exact calories, macros & micronutrients directly without food breakdowns (no server LLM)
POST /api/v1/meals/log-text Premium Parse plain-English meal descriptions via server LLM (403 premium_required on Free)
GET /api/v1/meals Free+ List meals with from/to, meal_category, entry_source, search q, and pagination
GET / PATCH / DELETE /api/v1/meals/{meal_id} Free+ Read, update metadata, or delete owned meal
PATCH / DELETE /api/v1/meals/{meal_id}/items/{item_id} Free+ Edit portions/macros on one item without deleting the meal
GET /api/v1/meals/daily-summary Free+ / MCP Single-day intake, outflow, net calories, targets & remaining in user timezone

Exercises (Outflow)

Track energy expenditure from wearables, manual entries, MCP agents, or Premium NL parsing.

Exercises (Outflow)
EndpointTierBehavior
POST /api/v1/exercises Free+ / MCP Log structured workout & exact calories burned (no server LLM)
POST /api/v1/exercises/log-text Premium Parse plain-English workouts and estimate burn via server LLM
GET / PATCH / DELETE /api/v1/exercises Free+ Filter, update, or delete exercise logs by performed_at and activity_type

Body Metrics, Habits & Dashboard

Longitudinal weight/habit tracking and chart-ready energy balance aggregations.

Body Metrics, Habits & Dashboard
EndpointTierBehavior
POST / GET / DELETE /api/v1/body-metrics Free+ / MCP Record and query weight_kg, body_fat_pct, and waist_cm time series
POST / GET / DELETE /api/v1/habits Free+ / MCP Track water_ml, steps, sleep_hours, or custom habit_key check-ins
GET /api/v1/dashboard Free+ / MCP Range series (default month-to-date, month, year, or start/end) by day/week/month

Usage, Account Export & Phase 2 Premium

Self-serve meters, GDPR/DPDP export/deletion, catalog search, and Premium intelligence.

Usage, Account Export & Phase 2 Premium
EndpointTierBehavior
GET /api/v1/usage Free+ Inspect plan_tier and current log, storage, MCP, and LLM meter balances
GET / DELETE /api/v1/account/export & /account Free+ Export all personal logs (JSON/CSV) or permanently delete account
GET /api/v1/catalog/foods Free+ (Phase 2) Search verified canonical foods and aliases
GET / POST /api/v1/recommendations/daily & /plans/*/generate Premium (Phase 2) Personalized AI diet & exercise recommendations and generated plans
PUT /api/v1/settings/branding Premium (Phase 2) Configure white-label display name, primary color, and logo
Standard error codes
HTTPMachine CodeMeaning
401 unauthorized Missing, expired, or revoked JWT / PAT token
403 premium_required Endpoint requires Premium plan_tier (e.g., log-text, AI plans, white-label)
403 capacity_exceeded Platform storage or log count cap reached — upgrade or switch storage mode
429 mcp_quota_exceeded Monthly MCP tool call allowance reached — upgrade to Capacity / MCP Pro
429 rate_limited Short-window anti-abuse burst limit hit; retry after Retry-After header