Loki Docs
Tools › Workouts › Record a completed workout

Record a completed workout

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

What your assistant is told

Record a COMPLETED workout that already happened — in ONE call. Use this when the user tells you about a workout after the fact: "I did 50 squats yesterday", "logged a bench session this morning". You give the date it was performed (resolve "yesterday", "last Monday", etc. to an absolute date/time yourself — it cannot be in the future) and the full list of sets. It's stored as an already-finished, point-in-time session, so it does NOT conflict with — and is not blocked by — a live in-progress workout. You give one entry per exercise, in the order performed, each with its own sets — the same shape a workout template has, so a workout recorded afterwards can carry supersets (groupKey) and per-exercise notes just like a planned or a live one. List each exercise ONCE, with all of its sets; exercises may be empty for a workout with nothing logged. For a workout you are logging LIVE, rep-by-rep as the user trains, prefer start_workout + log_set + end_workout instead. Returns the created session.

Parameters

  • nametext, requiredName for the workout, e.g. "Leg Day" or "Morning row".
  • datedate and time, requiredWhen the workout was performed, as an absolute date/time. Resolve relative phrases ("yesterday") yourself. Must not be in the future.
  • exerciseslist of object, requiredThe exercises performed, in order, each with the sets done for it. One entry per exercise. May be empty for a workout with no logged sets. Each set follows its exercise — see the tool description.
  • notestext, optionalOptional free-text note for the whole workout.
  • idempotencyKeyid, 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 errored with an unclear outcome: the server returns the record the first attempt created instead of writing a second one. Generate a fresh key per distinct write — reusing one is how you'd silently skip a second, genuinely new entry. Omit it and every call writes a new record.
  • clientHandletext, optionalOptional client_handle from list_clients to run this tool against a coached client's data instead of your own. Omit (or pass null) for your own data — the legacy default.