> ## Documentation Index
> Fetch the complete documentation index at: https://docs.habitify.me/llms.txt
> Use this file to discover all available pages before exploring further.

# Update a habit

> Update the properties of an existing habit. Only the fields provided in the request body are updated; omitted fields remain unchanged.



## OpenAPI

````yaml https://static.habitify.me/Habitify%20API%20v2.json put /habits/{habitId}
openapi: 3.1.1
info:
  title: Habitify API v2
  description: >
    Welcome to our REST API. Use it to programmatically access your habit
    tracking data, build integrations, and automate workflows.


    ## Authentication

    All endpoints require authentication using an API key passed in the
    `X-API-Key` header.


    To generate your API key, open our app and go to **Settings > API**. Only
    one API key can be active at a time — generating a new key automatically
    revokes the previous one.


    > **Note:** API access requires a paid subscription and is not available on
    the free plan.


    ### Example Request

    ```

    curl -X GET https://api.habitify.me/v2/habits \
      -H "X-API-Key: YOUR_API_KEY"
    ```


    ## Rate Limiting

    We enforce a rate limit of **500 requests per minute** per account. If you
    exceed this limit, we will respond with a `429 Too Many Requests` status
    code. Wait for the rate limit window to reset before making additional
    requests.


    ## Versioning

    This is version 2 of our API. All endpoints are prefixed with `/v2`.
  version: 2.0.0
  contact:
    name: Habitify API Support
    url: https://habitify.me
  license:
    name: Proprietary
    url: https://habitify.me/terms
servers:
  - url: https://api.habitify.me/v2
    description: Production server
security:
  - ApiKeyTokenAuth: []
  - AccessTokenAuth: []
  - IdTokenAuth: []
tags:
  - name: Habits
    description: Manage your habits — create, update, archive, and delete them
    x-scalar-order:
      - habitify-api-v2/tag/habits/GET/habits
      - habitify-api-v2/tag/habits/POST/habits
      - habitify-api-v2/tag/habits/GET/habits/journal
      - habitify-api-v2/tag/habits/GET/habits/{habitId}
      - habitify-api-v2/tag/habits/PUT/habits/{habitId}
      - habitify-api-v2/tag/habits/DELETE/habits/{habitId}
      - habitify-api-v2/tag/habits/POST/habits/{habitId}/archive
      - habitify-api-v2/tag/habits/GET/habits/{habitId}/statistics
  - name: Habit Logs
    description: >-
      Track your progress by logging completions, failures, skips, and measured
      values
    x-scalar-order:
      - habitify-api-v2/tag/habit-logs/POST/habits/{habitId}/logs
      - habitify-api-v2/tag/habit-logs/DELETE/habits/{habitId}/logs/{logId}
      - habitify-api-v2/tag/habit-logs/POST/habits/{habitId}/logs/complete
      - habitify-api-v2/tag/habit-logs/POST/habits/{habitId}/logs/failed
      - habitify-api-v2/tag/habit-logs/POST/habits/{habitId}/logs/skipped
      - habitify-api-v2/tag/habit-logs/POST/habits/{habitId}/logs/undo
  - name: Habit Notes
    description: Attach notes with text, mood levels, and photos to your habits
    x-scalar-order:
      - habitify-api-v2/tag/habit-notes/GET/habits/{habitId}/notes
      - habitify-api-v2/tag/habit-notes/POST/habits/{habitId}/notes
      - habitify-api-v2/tag/habit-notes/PUT/habits/{habitId}/notes/{noteId}
      - habitify-api-v2/tag/habit-notes/DELETE/habits/{habitId}/notes/{noteId}
  - name: Areas
    description: Organize your habits into areas for grouping and categorization
    x-scalar-order:
      - habitify-api-v2/tag/areas/GET/areas
      - habitify-api-v2/tag/areas/POST/areas
      - habitify-api-v2/tag/areas/GET/areas/{areaId}
      - habitify-api-v2/tag/areas/PUT/areas/{areaId}
      - habitify-api-v2/tag/areas/DELETE/areas/{areaId}
paths:
  /habits/{habitId}:
    put:
      tags:
        - Habits
      summary: Update a habit
      description: >-
        Update the properties of an existing habit. Only the fields provided in
        the request body are updated; omitted fields remain unchanged.
      parameters:
        - name: habitId
          in: path
          required: true
          schema:
            type: string
          description: The unique identifier of the habit to update
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
              properties:
                name:
                  type: string
                  description: New display name for the habit
                description:
                  type: string
                  description: New description for the habit
                occurrence:
                  description: >
                    Defines the recurrence schedule for a habit. A habit can
                    occur daily, on specific days of the week, on specific days
                    of the month, or at a fixed interval of days.
                  oneOf:
                    - type: object
                      description: The habit occurs every day.
                      required:
                        - type
                      properties:
                        type:
                          type: string
                          enum:
                            - daily
                          description: Indicates the habit occurs every day
                    - type: object
                      description: The habit occurs on specific days of the week.
                      required:
                        - type
                        - days
                      properties:
                        type:
                          type: string
                          enum:
                            - weekDays
                          description: Indicates the habit occurs on selected weekdays
                        days:
                          type: array
                          items:
                            type: integer
                            minimum: 0
                            maximum: 6
                            description: >-
                              Day of the week (0 = Sunday, 1 = Monday, ..., 6 =
                              Saturday)
                          minItems: 1
                          maxItems: 7
                          uniqueItems: true
                          description: List of weekday numbers when the habit should occur
                    - type: object
                      description: The habit occurs on specific days of the month.
                      required:
                        - type
                        - days
                      properties:
                        type:
                          type: string
                          enum:
                            - monthDays
                          description: >-
                            Indicates the habit occurs on selected days of the
                            month
                        days:
                          type: array
                          items:
                            type: integer
                            minimum: 1
                            maximum: 31
                            description: Day of the month (1-31)
                          minItems: 1
                          maxItems: 31
                          uniqueItems: true
                          description: >-
                            List of month day numbers when the habit should
                            occur
                    - type: object
                      description: >-
                        The habit occurs at a fixed interval (e.g., every 3
                        days).
                      required:
                        - type
                        - interval
                      properties:
                        type:
                          type: string
                          enum:
                            - intervalDays
                          description: Indicates the habit occurs at a fixed day interval
                        interval:
                          type: integer
                          minimum: 1
                          description: Number of days between each occurrence
                  discriminator:
                    propertyName: type
                startDate:
                  type: string
                  format: date
                  description: New start date for the habit (YYYY-MM-DD format)
                icon:
                  type: string
                  description: New icon identifier
                colorHex:
                  type: string
                  description: New hex color code
                customUnitName:
                  type: string
                  description: New custom unit name for measurable habits
                areaIds:
                  type: array
                  items:
                    type: string
                  description: >-
                    Area IDs to assign the habit to (replaces existing
                    assignments)
                timeOfDayIds:
                  type: array
                  items:
                    type: string
                  description: >-
                    Time-of-day period IDs to assign the habit to (replaces
                    existing assignments)
                goal:
                  description: Goal to set for the habit
                  type: object
                  required:
                    - periodicity
                    - value
                    - unit
                  properties:
                    periodicity:
                      description: >
                        The time period over which a goal is measured. -
                        `daily`: Goal resets every day. - `weekly`: Goal resets
                        every week. - `monthly`: Goal resets every month. -
                        `yearly`: Goal resets every year.
                      type: string
                      enum:
                        - daily
                        - weekly
                        - monthly
                        - yearly
                    value:
                      type: number
                      description: Target value to achieve within the specified period
                    unit:
                      description: >
                        Symbol representing the unit of measurement for habit
                        goals and logs. Covers distance, volume, time, weight,
                        energy, and count-based units.
                      type: string
                      enum:
                        - m
                        - kM
                        - ft
                        - yd
                        - mi
                        - floor
                        - L
                        - mL
                        - fl oz
                        - cup
                        - sec
                        - min
                        - hr
                        - ms
                        - kg
                        - g
                        - mg
                        - oz
                        - lb
                        - mcg
                        - J
                        - kJ
                        - kCal
                        - cal
                        - rep
                        - step
                reminders:
                  description: Reminders to set for the habit
                  type: object
                  properties:
                    timeTriggers:
                      type: array
                      description: List of time-based reminder triggers to set
                      items:
                        type: object
                        properties:
                          time:
                            description: >-
                              Represents a time of day using 24-hour format with
                              hour and minute components.
                            type: object
                            required:
                              - hour
                              - minute
                            properties:
                              hour:
                                type: integer
                                minimum: 0
                                maximum: 23
                                description: Hour component in 24-hour format (0-23)
                              minute:
                                type: integer
                                minimum: 0
                                maximum: 59
                                description: Minute component (0-59)
                          occurrenceFilter:
                            type: object
                            description: >-
                              Optional filter to restrict which days the
                              reminder fires
                            properties:
                              weekDays:
                                type: array
                                description: Days of the week when the reminder should fire
                                items:
                                  type: integer
                                  enum:
                                    - 1
                                    - 2
                                    - 3
                                    - 4
                                    - 5
                                    - 6
                                    - 7
                                  description: >-
                                    Day of the week (1 = Sunday, 2 = Monday,
                                    ..., 7 = Saturday)
                          showLiveActivity:
                            type: boolean
                            description: >-
                              Whether to show a live activity notification (iOS
                              only)
                          showAsAlarm:
                            type: boolean
                            description: >-
                              Whether to display the reminder as an alarm-style
                              notification
                        required:
                          - time
                    habitStacks:
                      type: array
                      description: >-
                        Habit stacking rules that trigger this habit based on
                        another habit's status
                      items:
                        type: object
                        properties:
                          conditionHabitId:
                            type: string
                            description: >-
                              The ID of the habit whose status triggers this
                              stack
                          type:
                            type: string
                            enum:
                              - completed
                              - skipped
                              - failed
                              - reminder
                            description: >-
                              The status of the condition habit that activates
                              this stack
                          timerType:
                            type: string
                            enum:
                              - immediately
                              - after
                            description: >-
                              When to trigger the stack (immediately or after a
                              delay)
                          timerDelaySecs:
                            type: integer
                            description: >-
                              Delay in seconds before triggering (required when
                              timerType is "after")
                        required:
                          - conditionHabitId
                          - type
                          - timerType
                endCondition:
                  description: End condition to set for the habit
                  type: object
                  discriminator:
                    propertyName: type
                    mapping:
                      date: ./EndConditionSpecificDateInput.yaml
                      streak: ./EndConditionStreakInput.yaml
                      successPeriods: ./EndConditionSuccessPeriodsInput.yaml
                      totalLogValue: ./EndConditionTotalLogValueInput.yaml
                  oneOf:
                    - description: Input payload for creating a date-based end condition.
                      type: object
                      required:
                        - type
                        - date
                      properties:
                        type:
                          type: string
                          enum:
                            - date
                          description: >-
                            Discriminator value indicating this is a date-based
                            end condition
                        date:
                          type: string
                          format: date
                          description: >-
                            The date on which the habit should end (YYYY-MM-DD
                            format)
                    - description: Input payload for creating a streak-based end condition.
                      type: object
                      required:
                        - type
                        - streakLength
                      properties:
                        type:
                          type: string
                          enum:
                            - streak
                          description: >-
                            Discriminator value indicating this is a
                            streak-based end condition
                        streakLength:
                          type: integer
                          description: >-
                            Number of consecutive successful periods required to
                            end the habit
                    - description: >-
                        Input payload for creating a success-periods-based end
                        condition.
                      type: object
                      required:
                        - type
                        - totalPeriods
                      properties:
                        type:
                          type: string
                          enum:
                            - successPeriods
                          description: >-
                            Discriminator value indicating this is a
                            success-periods-based end condition
                        totalPeriods:
                          type: integer
                          description: >-
                            Total number of successful periods required to end
                            the habit
                    - description: >-
                        Input payload for creating a total-log-value-based end
                        condition.
                      type: object
                      required:
                        - type
                        - totalLogValue
                      properties:
                        type:
                          type: string
                          enum:
                            - totalLogValue
                          description: >-
                            Discriminator value indicating this is a
                            total-log-value-based end condition
                        totalLogValue:
                          type: number
                          description: >-
                            Cumulative log value that must be reached to end the
                            habit
      responses:
        '200':
          description: Habit updated successfully
        '400':
          description: Bad request - invalid input data
        '401':
          description: Unauthorized - missing or invalid authentication
        '404':
          description: Habit not found
        '422':
          description: Validation error - input data failed validation
components:
  securitySchemes:
    ApiKeyTokenAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: >-
        API key generated from our app (Settings > API). Only one key can be
        active at a time.
    AccessTokenAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Access token acquired from OAuth2
    IdTokenAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: ID token from Firebase Auth

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.