Insights API

Summaries, diary audits, exports and analysis ratings. 12 ops: get_diary, get_nutrition_summary, query_foods, audit_diary, export_data, get_goals, set_goals, get_survey, answer_survey, get_query_privacy, update_query_privacy, get_query_report.

Summaries, diary audits, exports and analysis ratings.

Get the diary · POST /api/v1/get_diary · scope insights:read or GET …?input=

The food and symptom diary over a range of days (default the last 7, at most 31 per call), for reading or auditing: every day (empty ones too, so gaps show) with its meals, items (match, grams, nutrients, confidence, source), ingredients (tier, confidence, status) and symptom logs, each with who logged it and from where. Use get_day for one day, get_nutrition_summary for totals, query_foods for "what have I eaten", export_data for everything. Nutrients are integers: energy in millikilocalories, macros and most minerals in milligrams, some vitamins in micrograms; *_display has kcal and grams. The data dictionary (every column, unit and provenance field) is the MCP resource gutlog://data-dictionary and the README.md of export_data. May include `survey`: one optional question to ask the person once (record the answer with answer_survey).

curl -X POST https://getgutlog.com/api/v1/get_diary \  -H "Authorization: Bearer gutlog_…"

Get a nutrition summary · POST /api/v1/get_nutrition_summary · scope insights:read or GET …?input=

Calories, macros or any nutrient over any range (default the last 7 days, up to a year): totals, the average per logged day, a breakdown by day, week, month or meal type, and each goal (set_goals) with the average as a percent and how many days met it. For "how much protein did I average this month", "am I under my sodium limit", "calories by week". Averages count only days with meals; audit_diary finds the missing ones. Nutrients are integers: energy in millikilocalories, macros and most minerals in milligrams, some vitamins in micrograms; *_display has kcal and grams. May include `survey`: one optional question to ask the person once (record the answer with answer_survey).

curl -X POST https://getgutlog.com/api/v1/get_nutrition_summary \  -H "Authorization: Bearer gutlog_…"

Query the foods eaten · POST /api/v1/query_foods · scope insights:read or GET …?input=

What the person has eaten, grouped by food (default the last 90 days): how many times, on how many days, when last, grams and nutrients contributed. Filter by name (query), by an ingredient the items contained (ingredient, e.g. garlic or gluten-containing wheat), or meal type; sort by times, recent, grams or a nutrient (protein → top protein sources). Each food lists meal_ids to open with get_diary. Nutrients are integers: energy in millikilocalories, macros and most minerals in milligrams, some vitamins in micrograms; *_display has kcal and grams. May include `survey`: one optional question to ask the person once (record the answer with answer_survey).

curl -X POST https://getgutlog.com/api/v1/query_foods \  -H "Authorization: Bearer gutlog_…"

Audit the diary · POST /api/v1/audit_diary · scope insights:read or GET …?input=

Checks the diary before you trust it (default the last 14 days, at most 92): days with missing meals, meals flagged for review and possible ingredients nobody confirmed, low-confidence matches, implausible portions, days with meals but no symptom log, and likely duplicate meals. Each finding has a severity, the day, the meal or item, and fix: {op, input, how} naming the op to call (fill in what the person tells you); fix.available is false for an op this server does not offer yet. Work top down, then run it again. A Gutlog Plus feature: on Free it answers 402 with the upgrade link, and get_diary has everything to check by hand. May include `survey`: one optional question to ask the person once (record the answer with answer_survey).

curl -X POST https://getgutlog.com/api/v1/audit_diary \  -H "Authorization: Bearer gutlog_…"

Export the data · POST /api/v1/export_data · scope insights:write

Exports the diary (default everything) as files: export.json (meals → items → ingredients, symptom logs, corrections and the data dictionary), meals.csv, items.csv, ingredients.csv, symptoms.csv, corrections.csv, daily.csv and README.md (the data dictionary: every file, column and unit). delivery "links" (default) returns signed download URLs that expire in an hour: give them only to the person. delivery "inline" returns README.md and export.json in the response for small ranges. Free on every plan.

curl -X POST https://getgutlog.com/api/v1/export_data \  -H "Authorization: Bearer gutlog_…"

Get nutrition goals · POST /api/v1/get_goals · scope insights:read or GET …?input=

The person's daily nutrition goals (calories, protein, carbs, fat, fiber, sugars, saturated fat, sodium) as stored integers and in kcal and grams. get_nutrition_summary compares against them. Nutrients are integers: energy in millikilocalories, macros and most minerals in milligrams, some vitamins in micrograms; *_display has kcal and grams.

curl -X POST https://getgutlog.com/api/v1/get_goals \  -H "Authorization: Bearer gutlog_…"

Set nutrition goals · POST /api/v1/set_goals · scope insights:write

Sets daily goals in the units people use: calories (kcal), protein_g, carbs_g, fat_g, fiber_g, sugar_g, added_sugar_g, saturated_fat_g, sodium_mg. Fields you leave out stay as they are (replace: true clears them); null removes one. Sugars, saturated fat and sodium are limits, the rest targets. Only the person's own numbers: never invent goals, and suggest a registered dietitian for medical diets.

curl -X POST https://getgutlog.com/api/v1/set_goals \  -H "Authorization: Bearer gutlog_…"

Get the survey to ask · POST /api/v1/get_survey · scope insights:read or GET …?input=

The one-question survey due for this person, if any (at most one a week, never one they answered): {survey: {id, question, kind, scale | choices, how}} or {survey: null}. Ask it in your own words when it fits the conversation, then record the answer with answer_survey. Reads that are due one include it as `survey` already.

curl -X POST https://getgutlog.com/api/v1/get_survey \  -H "Authorization: Bearer gutlog_…"

Answer a survey · POST /api/v1/answer_survey · scope insights:write

Records the person's answer to a survey (logging_ease, accuracy, pmf, next_improvement, nps, cancel): a number on the survey's scale or one of its choice ids, plus anything else they said as comment. Only their answer, never yours; if they declined, do not call it.

curl -X POST https://getgutlog.com/api/v1/answer_survey \  -H "Authorization: Bearer gutlog_…" \  -H "Content-Type: application/json" \  -d '{"survey":"logging_ease","answer":-9007199254740991}'

Get query privacy · POST /api/v1/get_query_privacy · scope insights:read or GET …?input=

Whether Gutlog keeps the words of free-text requests (keep_raw_queries, off by default) and what it keeps either way.

curl -X POST https://getgutlog.com/api/v1/get_query_privacy \  -H "Authorization: Bearer gutlog_…"

Update query privacy · POST /api/v1/update_query_privacy · scope insights:write

Whether Gutlog may keep the words of free-text requests (a search, a meal description) to improve how it understands them. Off by default: without it only the op, the client, timing, outcome and an intent category are kept, never the words. Only the person may turn it on; never on your own.

curl -X POST https://getgutlog.com/api/v1/update_query_privacy \  -H "Authorization: Bearer gutlog_…" \  -H "Content-Type: application/json" \  -d '{"keep_raw_queries":false}'

Get the query analytics report · POST /api/v1/get_query_report · scope insights:read or GET …?input=

Gutlog team only. How people query their data, across every organization, for the last week by default: op calls by op, surface, client (chatgpt, claude, cursor, cli…) and intent, latency, failures by error code, empty and rephrased calls, the ops nobody called, analysis ratings and survey results (NPS, product-market fit), plus highlights for the weekly post. Counts only: never anyone's food, symptoms or words.

curl -X POST https://getgutlog.com/api/v1/get_query_report \  -H "Authorization: Bearer gutlog_…"