Loki Docs
Tools › Weight and water › Log a weigh-in

Log a weigh-in

log_weightAdds
What it does
Adds a new record and leaves what you had alone. Safe to retry: the same call twice changes nothing more.
Permission
Weight and water, change body:write

What your assistant is told

Record the user's body weight in kilograms. Returns the saved entry. Several weigh-ins per day are fine — each is stored as its own entry stamped with the instant it was taken, so a user weighing morning and evening to average out food/water swings keeps both readings rather than overwriting. Pass at (ISO-8601, carrying the user's UTC offset — an offsetless timestamp is refused) for when the reading was taken; it defaults to now. date optionally overrides the local day the reading counts toward (defaults to the date of at). Weight is what lets you tell whether a maintenance estimate is right, so log it whenever the user mentions one. Do NOT infer a weight they did not state, and do NOT read anything medical into it — record the number. To remove a spurious entry, get its id from get_weights and call delete_weight. Because several weigh-ins a day are legitimate, nothing downstream can tell a duplicate from a real second reading — so pass idempotency_key and reuse it if you have to retry.

Parameters

  • weight_kgnumber, requiredBody weight in kilograms.
  • attext, optionalWhen the reading was taken, ISO-8601 WITH the user's UTC offset (e.g. 2026-06-17T07:30:00Z or 2026-06-17T07:30:00+03:00). Defaults to now; if you don't know their offset, omit it rather than guessing.
  • datetext, optionalLocal day the reading counts toward, yyyy-MM-dd. Defaults to the date of at.
  • idempotency_keyid, optionalOptional UUID you generate for THIS write, so retrying it is safe. Pass the SAME key when you retry a call that timed out or whose outcome you don't know: the server returns the entry the first attempt created instead of recording a second weigh-in. Generate a fresh key per distinct reading — reusing one silently returns the earlier entry instead of logging a genuinely new one. Omit it and every call writes a new entry.