{"openapi":"3.1.0","info":{"title":"next-neon-template API","version":"1.0.0","description":"Every capability the UI has, exposed as a versioned HTTP JSON API for agents and MCP clients."},"servers":[{"url":"/"}],"components":{"securitySchemes":{"bearerAuth":{"type":"http","scheme":"bearer","description":"Personal access token (nnt_...) created in Settings, or use the browser session cookie instead."},"cookieAuth":{"type":"apiKey","in":"cookie","name":"better-auth.session_token","description":"The Better Auth browser session. Token management requires this, not a token."}},"schemas":{"ApiError":{"type":"object","properties":{"error":{"type":"object","properties":{"code":{"type":"string"},"message":{"type":"string"},"field":{"type":"string"}},"required":["code","message"]}},"required":["error"]},"Group":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"user_id":{"type":"string"},"name":{"type":"string"},"position":{"type":"integer","description":"Order among the groups, from 0."},"collapsed":{"type":"boolean","description":"Whether the group is collapsed on Today."},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","user_id","name","position","collapsed","created_at","updated_at"]},"GroupsList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Group"},"description":"Every group of the caller, in order. Not paginated: groups are a small ordered collection. A new user starts with Morning, Evening and Anytime."}},"required":["data"]},"CreateGroupInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":50}},"required":["name"]},"UpdateGroupInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":50},"collapsed":{"type":"boolean"}},"additionalProperties":false},"ReorderGroupsInput":{"type":"object","properties":{"group_ids":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1,"maxItems":100,"description":"Every group of the caller, exactly once, in the new order."}},"required":["group_ids"]},"Weekday":{"type":"string","enum":["mon","tue","wed","thu","fri","sat","sun"],"description":"A weekday, Monday first."},"HabitType":{"type":"string","enum":["yes_no","count","frequency"],"description":"`yes_no`: done or not. `count`: a count per day against a target, with a unit (\"8 glasses\"). `frequency`: a number of days per Monday-Sunday week (\"3× a week\")."},"HabitIcon":{"type":"string","enum":["circle-check","droplets","glass-water","coffee","cup-soda","milk","apple","banana","carrot","salad","soup","egg","fish","utensils","candy","wine-off","cigarette-off","pill","syringe","stethoscope","heart-pulse","activity","scale","brain","smile","bed","moon","sun","alarm-clock","timer","dumbbell","bike","footprints","person-standing","mountain","waves","volleyball","book-open","notebook-pen","pen-line","newspaper","graduation-cap","languages","code","laptop","smartphone","tv","gamepad-2","music","guitar","headphones","mic","palette","brush","camera","puzzle","leaf","sprout","flower-2","trees","dog","cat","baby","users","phone","mail","hand-heart","house","bath","shower-head","shirt","sparkles","wrench","lightbulb","wallet","piggy-bank","list-todo","inbox","recycle","plane"],"description":"A lucide icon name from the curated set."},"Habit":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"user_id":{"type":"string"},"group_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"type":{"$ref":"#/components/schemas/HabitType"},"target":{"type":"integer","description":"The target in force today: 1 for yes/no, the daily count, or the days per week for frequency."},"unit":{"type":["string","null"]},"icon":{"type":"string"},"colour":{"type":"integer"},"position":{"type":"integer","description":"Order within the group, from 0."},"schedule_days":{"type":"array","items":{"$ref":"#/components/schemas/Weekday"},"description":"The scheduled weekdays. Always all seven for a frequency habit."},"archived_at":{"type":["string","null"],"format":"date-time"},"created_at":{"type":"string","format":"date-time"},"updated_at":{"type":"string","format":"date-time"}},"required":["id","user_id","group_id","name","type","target","unit","icon","colour","position","schedule_days","archived_at","created_at","updated_at"]},"HabitTarget":{"type":"object","properties":{"effective_from":{"type":"string","format":"date"},"target":{"type":"integer"}},"required":["effective_from","target"]},"HabitDetail":{"allOf":[{"$ref":"#/components/schemas/Habit"},{"type":"object","properties":{"targets":{"type":"array","items":{"$ref":"#/components/schemas/HabitTarget"},"description":"Every target version, oldest first. Each day is judged against the version in force that day."}},"required":["targets"]}]},"HabitsList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Habit"},"description":"Every matching habit, in group order and then position within the group. Not paginated: habits are a small ordered collection."}},"required":["data"]},"CreateHabitInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"type":{"$ref":"#/components/schemas/HabitType"},"target":{"type":"integer","minimum":1,"maximum":100000,"description":"Defaults to 1."},"unit":{"type":["string","null"],"minLength":1,"maxLength":30,"description":"Count habits only."},"icon":{"$ref":"#/components/schemas/HabitIcon"},"colour":{"type":"integer","minimum":1,"maximum":8,"default":1,"description":"One of the 8 line colours (Okabe-Ito), 1-8."},"group_id":{"type":"string","format":"uuid","description":"Defaults to the first group."},"schedule_days":{"type":"array","items":{"$ref":"#/components/schemas/Weekday"},"minItems":1,"maxItems":7,"description":"Defaults to every day."}},"required":["name","type"]},"UpdateHabitInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100},"target":{"type":"integer","minimum":1,"maximum":100000,"description":"Writes a new target version effective today; past days keep theirs."},"unit":{"type":["string","null"],"minLength":1,"maxLength":30},"icon":{"$ref":"#/components/schemas/HabitIcon"},"colour":{"type":"integer","minimum":1,"maximum":8,"description":"One of the 8 line colours (Okabe-Ito), 1-8."},"group_id":{"type":"string","format":"uuid","description":"Moving a habit puts it last in the new group."},"schedule_days":{"type":"array","items":{"$ref":"#/components/schemas/Weekday"},"minItems":1,"maxItems":7,"description":"The weekdays a daily habit is scheduled on. Unscheduled days never break a streak."}},"additionalProperties":false,"description":"A habit type cannot change: its history would mean something else."},"ReorderHabitsInput":{"type":"object","properties":{"group_id":{"type":"string","format":"uuid"},"habit_ids":{"type":"array","items":{"type":"string","format":"uuid"},"minItems":1,"maxItems":500,"description":"Every habit in the group (archived ones too), exactly once, in the new order."}},"required":["group_id","habit_ids"]},"CheckinInput":{"type":"object","properties":{"day":{"type":"string","format":"date","description":"The habit day (YYYY-MM-DD). Defaults to the caller's logical today: their time zone, with the day cutoff applied. At most 7 days back; never the future."},"value":{"type":"integer","minimum":0,"maximum":100000,"description":"Set the day to this value. yes/no and frequency: 1 (done) or 0 (not done). count: any value from 0. 0 clears the day."},"delta":{"type":"integer","minimum":-100000,"maximum":100000,"description":"count only: add this to the day (negative to remove), floored at 0."}},"additionalProperties":false,"description":"An empty body (or no body) logs once: yes/no and frequency set the day to 1 (so a repeated tap never double-counts), count adds 1."},"WeekProgress":{"type":"object","properties":{"done":{"type":"integer","description":"Days checked in this Monday-Sunday week."},"target":{"type":"integer","description":"Times a week, as in force on the day."}},"required":["done","target"],"description":"Frequency habits only."},"CheckinResult":{"type":"object","properties":{"habit_id":{"type":"string","format":"uuid"},"day":{"type":"string","format":"date"},"type":{"$ref":"#/components/schemas/HabitType"},"value":{"type":"integer","description":"The value for the day now. 0 means no check-in."},"target":{"type":"integer","description":"The target in force on the day."},"done":{"type":"boolean","description":"yes/no: checked in. count: value reached the target. frequency: the week reached its target."},"week":{"allOf":[{"$ref":"#/components/schemas/WeekProgress"},{"type":["object","null"]}]},"message":{"type":"string","description":"A plain sentence for a Shortcut to show or speak: \"Glasses of water: 4/8 today\", \"Gym: 2/3 this week\", \"Water before coffee: done\".","example":"Glasses of water: 4/8 today"}},"required":["habit_id","day","type","value","target","done","week","message"]},"TodayWeekDay":{"type":"object","properties":{"day":{"type":"string","format":"date"},"value":{"type":"integer"},"target":{"type":"integer"},"scheduled":{"type":"boolean"},"paused":{"type":"boolean"}},"required":["day","value","target","scheduled","paused"]},"TodayHabit":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"group_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"type":{"$ref":"#/components/schemas/HabitType"},"unit":{"type":["string","null"]},"icon":{"type":"string"},"colour":{"type":"integer"},"schedule_days":{"type":"array","items":{"$ref":"#/components/schemas/Weekday"}},"value":{"type":"integer","description":"The value on the day; 0 when not checked in."},"target":{"type":"integer","description":"The target in force on the day."},"scheduled":{"type":"boolean","description":"A daily habit off its schedule that day is shown but not counted."},"paused":{"type":"boolean","description":"Paused that day: shown but not counted."},"counted":{"type":"boolean","description":"Whether it counts in done/total."},"done":{"type":"boolean","description":"yes/no: checked in. count: value reached the target. frequency: checked in that day, or the week already reached its target."},"week_progress":{"allOf":[{"$ref":"#/components/schemas/WeekProgress"},{"type":["object","null"]}]},"week_days":{"type":"array","items":{"$ref":"#/components/schemas/TodayWeekDay"},"description":"The Monday-Sunday week of the day, for the this-week grid."}},"required":["id","group_id","name","type","unit","icon","colour","schedule_days","value","target","scheduled","paused","counted","done","week_progress","week_days"]},"TodayGroup":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"collapsed":{"type":"boolean"},"done":{"type":"integer"},"total":{"type":"integer"},"habits":{"type":"array","items":{"$ref":"#/components/schemas/TodayHabit"},"description":"In habit order."}},"required":["id","name","collapsed","done","total","habits"]},"Today":{"type":"object","properties":{"day":{"type":"string","format":"date","description":"The day shown."},"today":{"type":"string","format":"date","description":"The caller's logical today."},"editable":{"type":"boolean","description":"Whether the day can still be checked in (within the last 7 days)."},"time_zone":{"type":"string"},"day_cutoff_minutes":{"type":"integer"},"week":{"type":"array","items":{"type":"string","format":"date"},"description":"The Monday-Sunday week of the day."},"done":{"type":"integer"},"total":{"type":"integer","description":"Habits counted that day: paused and unscheduled ones are excluded."},"groups":{"type":"array","items":{"$ref":"#/components/schemas/TodayGroup"},"description":"Groups with at least one active habit, in group order."}},"required":["day","today","editable","time_zone","day_cutoff_minutes","week","done","total","groups"]},"StatsRate":{"type":"object","properties":{"numerator":{"type":"integer","description":"Days done, or weeks met."},"denominator":{"type":"integer","description":"Days or weeks judged; 0 when none yet."},"percent":{"type":"integer","description":"numerator / denominator, rounded; 0 over 0."},"unit":{"type":"string","enum":["days","weeks","times"],"description":"`days` for yes/no and count habits; frequency habits count `times` this week and `weeks` met over a month or all time."}},"required":["numerator","denominator","percent","unit"],"example":{"numerator":3,"denominator":7,"percent":43,"unit":"days"}},"StatsRates":{"type":"object","properties":{"week":{"allOf":[{"$ref":"#/components/schemas/StatsRate"},{"description":"Done over the scheduled, unpaused days of the whole Monday-Sunday week (3/7 on a Wednesday), so it fills up through the week. Frequency: check-ins against the target."}]},"month":{"allOf":[{"$ref":"#/components/schemas/StatsRate"},{"description":"Done over the judged days elapsed this calendar month; today counts once it is done. Frequency: weeks met over the weeks ending this month."}]},"all_time":{"allOf":[{"$ref":"#/components/schemas/StatsRate"},{"description":"The same since the habit was created. Paused and unscheduled days are never judged."}]}},"required":["week","month","all_time"],"description":"Count habits judge each day against the target in force that day. Days before the habit was created are not judged."},"StatsStreak":{"type":"object","properties":{"current":{"type":"integer"},"best":{"type":"integer"},"unit":{"type":"string","enum":["days","weeks"],"description":"Consecutive judged days done, or for frequency habits consecutive weeks met. Pauses and unscheduled days never break a streak, nor does an open today."}},"required":["current","best","unit"]},"StatsGridDay":{"type":"object","properties":{"day":{"type":"string","format":"date"},"level":{"type":"string","enum":["none","some","most","met"],"description":"The share of the target in force reached: none (0), some (under half), most (half or more), met. yes/no and frequency days are met or none."},"value":{"type":"integer","description":"The check-in value; 0 when none."},"target":{"type":"integer","description":"The target in force that day."},"paused":{"type":"boolean"},"unscheduled":{"type":"boolean","description":"Not a scheduled weekday of the habit."},"future":{"type":"boolean"},"untracked":{"type":"boolean","description":"Before the habit was created."}},"required":["day","level","value","target","paused","unscheduled","future","untracked"]},"StatsMonth":{"type":"object","properties":{"month":{"type":"string","example":"2026-09","description":"YYYY-MM."},"done":{"type":"integer"},"judged":{"type":"integer"},"paused":{"type":"integer","description":"Paused days."}},"required":["month","done","judged","paused"]},"HabitStats":{"type":"object","properties":{"habit_id":{"type":"string","format":"uuid"},"type":{"$ref":"#/components/schemas/HabitType"},"unit":{"type":["string","null"]},"today":{"type":"string","format":"date","description":"The caller's logical today."},"rates":{"$ref":"#/components/schemas/StatsRates"},"streak":{"$ref":"#/components/schemas/StatsStreak"},"days":{"type":"array","items":{"$ref":"#/components/schemas/StatsGridDay"},"description":"The heatmap: 52 Monday-first weeks (364 days) ending on the Sunday of the current week."},"months":{"type":"array","items":{"$ref":"#/components/schemas/StatsMonth"},"description":"Per calendar month of the grid, oldest first: a text summary of the heatmap."}},"required":["habit_id","type","unit","today","rates","streak","days","months"]},"StatsWeekCell":{"type":"object","properties":{"start":{"type":"string","format":"date","description":"The Monday."},"level":{"type":"string","enum":["none","some","most","met","paused","untracked"],"description":"The share of the week done (met: every judged day, or the frequency target). paused: 4 or more paused days. untracked: nothing to judge (not scheduled, or before the habit existed)."}},"required":["start","level"]},"StatsHabit":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"group_id":{"type":"string","format":"uuid"},"name":{"type":"string"},"type":{"$ref":"#/components/schemas/HabitType"},"unit":{"type":["string","null"]},"icon":{"type":"string"},"colour":{"type":"integer"},"schedule_days":{"type":"array","items":{"$ref":"#/components/schemas/Weekday"}},"target":{"type":"integer","description":"The target in force today."},"paused":{"type":"boolean","description":"Paused today."},"rates":{"$ref":"#/components/schemas/StatsRates"},"streak":{"$ref":"#/components/schemas/StatsStreak"},"weeks":{"type":"array","items":{"$ref":"#/components/schemas/StatsWeekCell"},"description":"The last 52 weeks, oldest first; the last is the current week."}},"required":["id","group_id","name","type","unit","icon","colour","schedule_days","target","paused","rates","streak","weeks"]},"StatsOverview":{"type":"object","properties":{"today":{"type":"string","format":"date"},"week":{"type":"object","properties":{"start":{"type":"string","format":"date"},"end":{"type":"string","format":"date"},"number":{"type":"integer","description":"The ISO week number."}},"required":["start","end","number"]},"today_progress":{"type":"object","properties":{"done":{"type":"integer"},"total":{"type":"integer"},"percent":{"type":"integer"}},"required":["done","total","percent"],"description":"Today's habits done over counted (paused and unscheduled ones excluded)."},"week_progress":{"type":"object","properties":{"done":{"type":"integer"},"total":{"type":"integer"}},"required":["done","total"],"description":"This week's check-ins: every habit's week rate, summed."},"groups":{"type":"array","items":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string"},"habits":{"type":"array","items":{"$ref":"#/components/schemas/StatsHabit"},"description":"In habit order."}},"required":["id","name","habits"]},"description":"Groups with at least one active habit, in group order."}},"required":["today","week","today_progress","week_progress","groups"]},"HabitStreak":{"type":"object","properties":{"habit_id":{"type":"string","format":"uuid"},"unit":{"type":"string","enum":["day","week"],"description":"yes/no and count habits run in days; frequency habits in Monday-Sunday weeks."},"current":{"type":"integer","description":"The current run of met days (or weeks). Today, and the current week, never break it; paused days freeze it; unscheduled days are skipped."},"best":{"type":"integer","description":"The longest run over all time."}},"required":["habit_id","unit","current","best"]},"Profile":{"type":"object","properties":{"id":{"type":"string"},"email":{"type":"string","format":"email"},"name":{"type":"string"}},"required":["id","email","name"]},"Health":{"type":"object","properties":{"ok":{"type":"boolean"},"db":{"type":"boolean"}},"required":["ok","db"]},"Pause":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"habit_id":{"type":["string","null"],"format":"uuid","description":"The paused habit, or null for a pause of every habit."},"start_date":{"type":"string","format":"date","description":"The first paused day (inclusive)."},"end_date":{"type":"string","format":"date","description":"The last paused day (inclusive)."},"created_at":{"type":"string","format":"date-time"}},"required":["id","habit_id","start_date","end_date","created_at"]},"CreatePauseInput":{"type":"object","properties":{"habit_id":{"type":["string","null"],"format":"uuid","description":"The habit to pause. Omit it (or send null) to pause every habit."},"start_date":{"type":"string","format":"date","description":"The first paused day. At most 7 days before the caller's logical today; the future is fine."},"end_date":{"type":"string","format":"date","description":"The last paused day, on or after the start."}},"required":["start_date","end_date"],"additionalProperties":false,"description":"Paused days freeze streaks: they neither break nor extend them, and Today shows the habit as paused and does not count it."},"PausesPage":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/Pause"},"description":"Newest first."},"next_cursor":{"type":["string","null"],"description":"Pass as `cursor` for the next page; null on the last page. Opaque."}},"required":["data","next_cursor"]},"Settings":{"type":"object","properties":{"time_zone":{"type":"string","description":"IANA time zone name."},"day_cutoff_minutes":{"type":"integer"},"today":{"type":"string","format":"date","description":"The logical day right now, with the time zone and cutoff applied."}},"required":["time_zone","day_cutoff_minutes","today"]},"UpdateSettingsInput":{"type":"object","properties":{"time_zone":{"type":"string","minLength":1,"maxLength":64,"description":"An IANA time zone name, e.g. \"Europe/London\".","example":"UTC"},"day_cutoff_minutes":{"type":"integer","minimum":0,"maximum":360,"description":"When the habit day rolls over, in minutes after local midnight: 0-360 in steps of 30 (180 = 03:00).","example":180}}},"AccessToken":{"type":"object","properties":{"id":{"type":"string","format":"uuid"},"name":{"type":"string","minLength":1,"maxLength":100},"prefix":{"type":"string"},"created_at":{"type":"string","format":"date-time"},"last_used_at":{"type":["string","null"],"format":"date-time"},"revoked_at":{"type":["string","null"],"format":"date-time"}},"required":["id","name","prefix","created_at","last_used_at","revoked_at"]},"CreatedAccessToken":{"allOf":[{"$ref":"#/components/schemas/AccessToken"},{"type":"object","properties":{"token":{"type":"string","description":"The secret. Shown once; only its hash is stored."}},"required":["token"]}]},"AccessTokensList":{"type":"object","properties":{"data":{"type":"array","items":{"$ref":"#/components/schemas/AccessToken"}}},"required":["data"]},"CreateAccessTokenInput":{"type":"object","properties":{"name":{"type":"string","minLength":1,"maxLength":100}},"required":["name"]}},"parameters":{}},"paths":{"/api/v1/export/checkins.csv":{"get":{"summary":"Every check-in of the caller as CSV (RFC 4180), oldest first: date, habit, type, value, target in force that day, unit, group","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"responses":{"200":{"description":"The CSV, streamed, as an attachment (Content-Disposition names the file)","headers":{"content-disposition":{"schema":{"type":"string","example":"attachment; filename=\"1.01-checkins-2026-03-10.csv\""},"required":true}},"content":{"text/csv":{"schema":{"type":"string"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/v1/groups/{id}":{"get":{"summary":"Get one of the caller's groups","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The group","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Group"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No such group for the caller","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"patch":{"summary":"Rename one of the caller's groups, or collapse it on Today","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateGroupInput"}}}},"responses":{"200":{"description":"The updated group","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Group"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No such group for the caller","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"A group with this name exists","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"summary":"Delete one of the caller's groups, if it has no habits","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Deleted"},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No such group for the caller","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"The group still has habits (archived ones included)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/v1/groups":{"get":{"summary":"List the caller's groups, in order","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"Every group. A new user starts with Morning, Evening and Anytime.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GroupsList"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"summary":"Create a group, last in the order","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Dedupe key (1-255 chars): retrying a create with the same key returns the original result."},"required":false,"description":"Dedupe key (1-255 chars): retrying a create with the same key returns the original result.","name":"idempotency-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateGroupInput"}}}},"responses":{"201":{"description":"The created group","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Group"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"A group with this name exists, or the Idempotency-Key was reused","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/v1/groups/reorder":{"post":{"summary":"Reorder the caller's groups","description":"Pass every group exactly once, in the new order. A partial list or a repeat is a 422.","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReorderGroupsInput"}}}},"responses":{"200":{"description":"Every group, in the new order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/GroupsList"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No such group for the caller","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/v1/habits/{id}":{"get":{"summary":"Get one of the caller's habits, with its target history","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The habit and every target version","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HabitDetail"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No such habit for the caller","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"patch":{"summary":"Update one of the caller's habits","description":"A new `target` is written as a version effective today and never rewrites the past. The type cannot change.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateHabitInput"}}}},"responses":{"200":{"description":"The updated habit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Habit"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No such habit (or group) for the caller","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"summary":"Delete one of the caller's habits, with all its check-ins, targets and pauses","description":"Irreversible. To keep the history, archive the habit instead.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"Deleted"},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No such habit for the caller","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/v1/habits/{id}/archive":{"post":{"summary":"Archive a habit: hide it from Today, keep its history","description":"Idempotent: archiving an archived habit keeps its original archived_at.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The archived habit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Habit"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No such habit for the caller","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/v1/habits/{id}/checkins":{"post":{"summary":"Check in on one of the caller's habits","description":"Sets or changes the value for a day (the logical today by default). yes/no and frequency take `value` 1 or 0; count takes a `value` or a `delta`, floored at 0. An empty body (or none) logs once: yes/no and frequency set 1, count adds 1 -- so an iOS Shortcut can log with no JSON. Days more than 7 days back and future days are a 422. The response carries a plain `message` for the Shortcut to show.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Dedupe key (1-255 chars): retrying a create with the same key returns the original result."},"required":false,"description":"Dedupe key (1-255 chars): retrying a create with the same key returns the original result.","name":"idempotency-key","in":"header"}],"requestBody":{"required":false,"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckinInput"}}}},"responses":{"200":{"description":"The day after the check-in, with a message","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CheckinResult"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No such habit for the caller","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"The Idempotency-Key was used with a different request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"summary":"Remove the check-in for a day on one of the caller's habits","description":"Clears the day (the logical today by default). Within the last 7 days only.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"},{"schema":{"type":"string","format":"date","description":"Defaults to the logical today."},"required":false,"description":"Defaults to the logical today.","name":"day","in":"query"}],"responses":{"204":{"description":"The day has no check-in"},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No such habit for the caller","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/v1/habits/{id}/stats":{"get":{"summary":"One habit's completion rates, streak and 12-month heatmap","description":"Rates for this week, this month and all time as numerator, denominator and percent. Scheduled days done over scheduled days, excluding paused days and days before the habit was created; count habits judge each day against the target in force; frequency habits give weeks met over weeks. This week is over the whole Monday-Sunday week; this month and all time are over the days elapsed, with today counted once it is done. Also the 52-week daily grid for the heatmap (level, paused and unscheduled flags, value and target) and a per-month summary of it.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The habit's stats","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HabitStats"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No such habit for the caller","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/v1/habits/{id}/streak":{"get":{"summary":"The current and best streak of one of the caller's habits","description":"Days for yes/no and count habits (a count day is met when it reaches the target in force that day), Monday-Sunday weeks for frequency habits. Today and the current week never break a streak, unscheduled days are skipped and paused days freeze it. Archived habits keep their streak as it was when archived.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The current and best streak","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HabitStreak"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No such habit for the caller","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/v1/habits/{id}/unarchive":{"post":{"summary":"Unarchive a habit: back on Today, in its old place","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The habit, active again","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Habit"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No such habit for the caller","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/v1/habits":{"get":{"summary":"List the caller's habits, in group order and then position","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","enum":["true","false"],"description":"Include archived habits. Default false."},"required":false,"description":"Include archived habits. Default false.","name":"include_archived","in":"query"},{"schema":{"type":"string","format":"uuid"},"required":false,"name":"group_id","in":"query"}],"responses":{"200":{"description":"Every matching habit. Archived habits only with include_archived=true.","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HabitsList"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"summary":"Create a habit","description":"Its first target version is effective today (in the caller time zone, after the day cutoff). It goes last in its group.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Dedupe key (1-255 chars): retrying a create with the same key returns the original result."},"required":false,"description":"Dedupe key (1-255 chars): retrying a create with the same key returns the original result.","name":"idempotency-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateHabitInput"}}}},"responses":{"201":{"description":"The created habit","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Habit"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No such group for the caller","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"Idempotency-Key reused with a different body","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/v1/habits/reorder":{"post":{"summary":"Reorder the habits within one group","description":"Pass every habit in the group (archived ones too) exactly once, in the new order. A partial list, a repeat or a habit from another group is a 422.","security":[{"bearerAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/ReorderHabitsInput"}}}},"responses":{"200":{"description":"The habits of the group, archived ones included, in the new order","content":{"application/json":{"schema":{"$ref":"#/components/schemas/HabitsList"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No such group or habit for the caller","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/v1/health":{"get":{"summary":"Liveness plus a database round trip. No authentication.","responses":{"200":{"description":"Serving; the database answered","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Health"}}}},"503":{"description":"The database did not answer","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/v1/me":{"get":{"summary":"The caller's own profile -- API parity with the UI's account header","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The caller profile","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Profile"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"delete":{"summary":"Delete the caller's account and all its data, for good (session cookie only). Export first: GET /api/v1/export/checkins.csv","security":[{"cookieAuth":[]}],"responses":{"204":{"description":"The account and everything in it are deleted"},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/v1/pauses":{"get":{"summary":"List the caller's pauses, newest first","description":"Cursor-paginated. With `habit_id`, only the pauses that apply to that habit: its own and the all-habit ones.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string"},"required":false,"name":"cursor","in":"query"},{"schema":{"type":"integer","minimum":1,"maximum":100,"default":20},"required":false,"name":"limit","in":"query"},{"schema":{"type":"string","format":"uuid","description":"Only the pauses that apply to this habit: its own and the all-habit ones."},"required":false,"description":"Only the pauses that apply to this habit: its own and the all-habit ones.","name":"habit_id","in":"query"}],"responses":{"200":{"description":"A page of pauses","content":{"application/json":{"schema":{"$ref":"#/components/schemas/PausesPage"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"summary":"Pause one habit, or every habit, for a range of days","description":"Paused days freeze streaks: they neither break nor extend them. The start can be at most 7 days before the logical today (a 422 otherwise); the end is on or after the start.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","minLength":1,"maxLength":255,"description":"Dedupe key (1-255 chars): retrying a create with the same key returns the original result."},"required":false,"description":"Dedupe key (1-255 chars): retrying a create with the same key returns the original result.","name":"idempotency-key","in":"header"}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatePauseInput"}}}},"responses":{"201":{"description":"The created pause","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Pause"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No such habit for the caller","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"409":{"description":"The Idempotency-Key was used with a different request","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/v1/pauses/{id}":{"delete":{"summary":"Remove one of the caller's pauses","description":"The paused days count again: a streak they froze is judged on them.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"204":{"description":"The pause is gone"},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No such pause for the caller","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/v1/settings":{"get":{"summary":"The caller's time zone and day cutoff, and the logical day they give now","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"responses":{"200":{"description":"The settings (defaults until changed)","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Settings"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"patch":{"summary":"Change the time zone and/or the day cutoff. The new logical day applies from the next request; stored check-ins keep their day.","security":[{"bearerAuth":[]},{"cookieAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/UpdateSettingsInput"}}}},"responses":{"200":{"description":"The saved settings","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Settings"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/v1/stats":{"get":{"summary":"The caller's stats overview: today's progress and this week per habit","description":"Today's progress (done over counted habits, as a percent), this week's check-ins, and for every active habit in group and habit order its current and best streak, its rates for this week, this month and all time, and a 52-week strip (one level per week).","security":[{"bearerAuth":[]}],"responses":{"200":{"description":"The overview","content":{"application/json":{"schema":{"$ref":"#/components/schemas/StatsOverview"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/v1/today":{"get":{"summary":"The caller's day: every habit with its check-in, target and progress","description":"The logical today by default (the caller's time zone and day cutoff), or `day`. Every active habit in group and habit order with its type, value, the target in force, weekly progress for frequency habits and its group, plus done/total. Paused and unscheduled habits are shown but not counted. A future day is a 422.","security":[{"bearerAuth":[]}],"parameters":[{"schema":{"type":"string","format":"date","description":"Show another day (YYYY-MM-DD): any past day can be read; only the last 7 are editable. Defaults to the logical today."},"required":false,"description":"Show another day (YYYY-MM-DD): any past day can be read; only the last 7 are editable. Defaults to the logical today.","name":"day","in":"query"}],"responses":{"200":{"description":"The day","content":{"application/json":{"schema":{"$ref":"#/components/schemas/Today"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/v1/tokens":{"get":{"summary":"List the caller's personal access tokens (session cookie only)","security":[{"cookieAuth":[]}],"responses":{"200":{"description":"Tokens, newest first","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccessTokensList"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}},"post":{"summary":"Create a personal access token (session cookie only). The secret is returned once.","security":[{"cookieAuth":[]}],"requestBody":{"content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreateAccessTokenInput"}}}},"responses":{"201":{"description":"The token, including its secret","content":{"application/json":{"schema":{"$ref":"#/components/schemas/CreatedAccessToken"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}},"/api/v1/tokens/{id}":{"delete":{"summary":"Revoke one of the caller's personal access tokens (session cookie only)","security":[{"cookieAuth":[]}],"parameters":[{"schema":{"type":"string","format":"uuid"},"required":true,"name":"id","in":"path"}],"responses":{"200":{"description":"The revoked token","content":{"application/json":{"schema":{"$ref":"#/components/schemas/AccessToken"}}}},"401":{"description":"Authentication required","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"403":{"description":"Forbidden","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"404":{"description":"No such token for the caller","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}},"500":{"description":"Internal error","content":{"application/json":{"schema":{"$ref":"#/components/schemas/ApiError"}}}}}}}},"webhooks":{}}