PublicHabits

PATCH /api/v1/habits/{habitId}

Request

  • Base URL
    https://api.habitpocket.io (the document declares no server; this is the origin it was published from)
  • URL
    https://api.habitpocket.io/api/v1/habits/{habitId}
  • Auth
    API key in header X-API-KEY

Path parameters

habitIdstring uuid required

Request body

namestring nullable

New name. Can't be blank or null.

descriptionstring nullable

New description, or null to remove it.

colorstring nullable

New hex color, e.g. "#16a34a". Can't be null — a habit always has a color.

unitstring nullable

metric habits only: unit label, e.g. "km". Null removes it.

targetnumber double nullable

metric habits only: daily goal. Null removes it.

timeTargetstring nullable

time habits only: ideal time of day, "HH:mm". Null removes it.

goalOperatorstring nullable

metric/time habits only: "above" (at least), "exact", or "below" (at most). Null resets to the default.

excludedDaysinteger[] nullable

Days of week the habit doesn't apply (0=Sun … 6=Sat). Empty or null means every day.

conditionalStylingEnabledboolean nullable

metric/time habits only: turn conditional styling on or off. Can't be null. Turning it on needs at least one band.

avoidSincestring nullable

boolean/metric habits only: "YYYY-MM-DD" makes this an avoid habit — days with nothing logged from that date on count as clean days, and a done entry (or a metric value above the target, 0 when there is none) is a slip. On a metric habit the target becomes a daily limit and goalOperator becomes "below". Null makes it a normal habit again.

sectionIdstring uuid nullable

Moves the habit into that section. Must be one of yours; can't be null.

Response

OK

idstring uuid
namestring nullable
descriptionstring nullable
typestring nullable
colorstring nullable
unitstring nullable
targetnumber double nullable
timeTargetstring nullable
goalOperatorstring nullable
isMultiSelectboolean
excludedDaysinteger[] nullable
conditionalStylingEnabledboolean
avoidSincestring date nullable
currentStreakinteger
bestStreakinteger
createdAtstring date-time

Changes

No recorded changes to this operation across all 1 revision of this API.