Set daily targets
set_targetChanges- What it does
- Changes or deletes something you had. Your assistant can ask you to confirm first. Safe to retry: the same call twice changes nothing more.
- Permission
- Targets, change
targets:write
What your assistant is told
Record a new version of the user's daily targets, effective from a date
(today unless effective_from says otherwise). Returns the saved
version.
Set only the bounds you mean. A minimum alone is a floor ("at least this
much protein"); a maximum alone is a cap ("no more than this much fat");
both together are a band ("land between 2,000 and 2,400 kcal"); omitting
both leaves that metric untracked. There is no separate goal-type field —
the bounds are the goal type.
Do NOT assume this overwrites history: earlier versions stay, and a
summary for a past day is still scored against whatever was in force
then. Setting a target twice for the same effective date amends that
version rather than adding another.
That amendment REPLACES the whole set of bounds — any bound you leave
out is cleared, not kept. So to change one metric on a date you have
already set, call get_target first and send every bound you want to
keep alongside the new one.
Always pass a note explaining why you changed it — the user reads it in
their goal history, and an unexplained change looks like a bug.
Parameters
energy_kcal_minwhole number, optionalLower bound for daily energy, kcal. Omit for a cap-only or untracked goal.energy_kcal_maxwhole number, optionalUpper bound for daily energy, kcal. Omit for a floor-only or untracked goal.protein_g_minnumber, optionalLower bound for daily protein, grams — usually the one you want.protein_g_maxnumber, optionalUpper bound for daily protein, grams. Rarely set.carb_g_minnumber, optionalLower bound for daily carbohydrate, grams.carb_g_maxnumber, optionalUpper bound for daily carbohydrate, grams — usually the one you want.fat_g_minnumber, optionalLower bound for daily fat, grams.fat_g_maxnumber, optionalUpper bound for daily fat, grams — usually the one you want.fiber_g_minnumber, optionalLower bound for daily fiber, grams — usually the one you want.fiber_g_maxnumber, optionalUpper bound for daily fiber, grams. Rarely set.water_ml_minwhole number, optionalLower bound for daily water, millilitres — usually the one you want.water_ml_maxwhole number, optionalUpper bound for daily water, millilitres. Rarely set.effective_fromtext, optionalLocal date this version takes effect, yyyy-MM-dd. Defaults to today; back-date only when correcting the record.notetext, optionalWhy this changed, one short sentence. Shown to the user in their goal history.