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

# Update activity (PUT)

> Fully update an activity



## OpenAPI

````yaml /api-reference/openapi.yaml put /users/{user_id}/activities/{activity_id}
openapi: 3.1.0
info:
  title: ONVY Health API
  description: >-
    AI-powered holistic health services API with data merging and metrics
    calculation
  version: 1.0.0
  contact:
    name: ONVY Support
    email: support@onvy.health
    url: https://onvy.health
  license:
    name: Proprietary
    url: https://onvy.health/terms
servers:
  - url: https://api.onvy.health
    description: Public API
security:
  - bearerAuth: []
tags:
  - name: static
    description: Static configuration endpoints
  - name: users
    description: User management
  - name: baselines
    description: User baseline metrics
  - name: daily-records
    description: Daily health records
  - name: chat
    description: AI chat completions
  - name: facts
    description: User facts for individualization
  - name: activities
    description: User activities (workouts and mindfulness sessions)
  - name: ai-summaries
    description: |
      AI-generated summaries. This is how ONVY exposes domain-specific
      insights such as meal nutrition analysis, sleep insights, workouts,
      and daily, weekly, nutrition, trend, and impact analysis. Most
      summary types are system-generated; the public create surface
      currently accepts `type=meal`.
  - name: custom-records
    description: Custom records and types
  - name: meals
    description: Nutrition meal tracking
paths:
  /users/{user_id}/activities/{activity_id}:
    put:
      tags:
        - activities
      summary: Update activity (PUT)
      description: Fully update an activity
      operationId: updateActivityPut
      parameters:
        - $ref: '#/components/parameters/UserIdParam'
        - name: activity_id
          in: path
          description: Activity ID
          required: true
          schema:
            type: string
      requestBody:
        description: Activity data
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateActivityRequest'
      responses:
        '200':
          description: Activity updated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Activity'
        '400':
          $ref: '#/components/responses/BadRequest'
        '404':
          $ref: '#/components/responses/NotFound'
        '500':
          $ref: '#/components/responses/InternalError'
components:
  parameters:
    UserIdParam:
      name: user_id
      in: path
      required: true
      description: User ID (e.g., google_104940819145861640201)
      schema:
        type: string
  schemas:
    CreateActivityRequest:
      title: CreateActivityRequest
      oneOf:
        - title: CreateWorkoutActivityRequest
          type: object
          properties:
            type:
              type: string
              enum:
                - workout
              description: Type of activity
            start_datetime:
              type: string
              format: date-time
              description: Start time of the workout in ISO 8601 format
            end_datetime:
              type: string
              format: date-time
              description: End time of the workout in ISO 8601 format
            data_source:
              type: string
              description: Source of the workout data
            duration_seconds:
              type: integer
              minimum: 0
              description: Duration of the workout in seconds
            type_name:
              type: string
              description: Name/type of the workout
            tss:
              type: number
              format: float
              description: Training Stress Score
            used_ftp:
              type: number
              format: float
              description: Used Functional Threshold Power
            guessed_ftp:
              type: number
              format: float
              description: Estimated Functional Threshold Power
            is_breakthrough_ftp:
              type: boolean
              description: Whether this workout represents an FTP breakthrough
            zone_power:
              type: string
              description: Power zone distribution
            normalized_power:
              type: number
              format: float
              description: Normalized power for the workout
            variability_index:
              type: number
              format: float
              description: Variability index of power
            intensity_factor:
              type: number
              format: float
              description: Intensity factor
            tss_power:
              type: number
              format: float
              description: TSS calculated from power
            average_hr:
              type: number
              format: float
              description: Average heart rate
            average_power:
              type: number
              format: float
              description: Average power
            zone_hr:
              type: string
              description: Heart rate zone distribution
            used_lthr:
              type: number
              format: float
              description: Used Lactate Threshold Heart Rate
            guessed_lthr:
              type: number
              format: float
              description: Estimated Lactate Threshold Heart Rate
            guessed_mhr:
              type: number
              format: float
              description: Estimated Maximum Heart Rate
            is_breakthrough_lthr:
              type: boolean
              description: Whether this workout represents an LTHR breakthrough
            tss_hr:
              type: number
              format: float
              description: TSS calculated from heart rate
            peak_duration_hr:
              type: number
              format: float
              description: Time spent in peak heart rate zone
            cardio_duration_hr:
              type: number
              format: float
              description: Time spent in cardio heart rate zone
            fatburn_duration_hr:
              type: number
              format: float
              description: Time spent in fat burn heart rate zone
            light_duration_hr:
              type: number
              format: float
              description: Time spent in light heart rate zone
            hr_series:
              type: string
              description: Heart rate series data
            hr_series_sampling_rate:
              type: string
              description: Sampling rate for heart rate series
            peak_threshold_hr:
              type: number
              format: float
              description: Peak heart rate threshold
            cardio_threshold_hr:
              type: number
              format: float
              description: Cardio heart rate threshold
            fatburn_threshold_hr:
              type: number
              format: float
              description: Fat burn heart rate threshold
            calories:
              type: number
              format: float
              description: Calories burned during workout
            max_hr:
              type: number
              format: float
              description: Maximum heart rate during workout
            hr_zone_durations_seconds:
              type: array
              items:
                type: integer
              description: Time spent in each heart rate zone (seconds)
            hr_zone_thresholds:
              type: array
              items:
                type: integer
              description: Heart rate zone thresholds
            power_zone_durations_seconds:
              type: array
              items:
                type: integer
              description: Time spent in each power zone (seconds)
            power_zone_thresholds:
              type: array
              items:
                type: integer
              description: Power zone thresholds
            activity_score_before:
              type: integer
              description: Activity score before workout
            activity_score_after:
              type: integer
              description: Activity score after workout
            group_id:
              type: integer
              description: Group identifier for related workouts
            selected:
              type: boolean
              description: Whether this workout is selected for analysis
            created_at:
              type: string
              format: date-time
              description: When the mindfulness activity was created
            updated_at:
              type: string
              format: date-time
              description: When the mindfulness activity was last updated
          required:
            - type
            - start_datetime
            - end_datetime
            - data_source
            - duration_seconds
            - type_name
            - tss
            - created_at
            - updated_at
        - title: CreateMindfulnessActivityRequest
          type: object
          properties:
            start_datetime:
              type: string
              format: date-time
              description: Start time of the mindfulness session in ISO 8601 format
            end_datetime:
              type: string
              format: date-time
              description: End time of the mindfulness session in ISO 8601 format
            provider:
              type: string
              description: Provider of the mindfulness session
            data_source:
              type: string
              description: Source of the mindfulness data
            type_name:
              type: string
              description: Type/name of the mindfulness session
            duration_seconds:
              type: integer
              minimum: 0
              description: Duration of the mindfulness session in seconds
            guided_breathing_id:
              type: string
              description: Identifier for guided breathing session
            session_score:
              type: integer
              minimum: 0
              maximum: 100
              description: Score for the mindfulness session
            interbeat_intervals:
              type: string
              description: Interbeat intervals data
            created_at:
              type: string
              format: date-time
              description: When the mindfulness activity was created
            updated_at:
              type: string
              format: date-time
              description: When the mindfulness activity was last updated
          required:
            - start_datetime
            - end_datetime
            - provider
            - type_name
            - duration_seconds
            - guided_breathing_id
            - session_score
            - created_at
            - updated_at
    Activity:
      title: Activity
      oneOf:
        - title: WorkoutActivity
          type: object
          properties:
            id:
              type: string
              description: Unique identifier for the workout
            project_id:
              type: string
              description: Project identifier
            user_id:
              type: string
              description: User identifier
            type:
              type: string
              enum:
                - workout
              description: Type of activity
            start_datetime:
              type: string
              format: date-time
              description: Start time of the workout in ISO 8601 format
            end_datetime:
              type: string
              format: date-time
              description: End time of the workout in ISO 8601 format
            data_source:
              type: string
              description: Source of the workout data
            duration_seconds:
              type: integer
              minimum: 0
              description: Duration of the workout in seconds
            type_name:
              type: string
              description: Name/type of the workout
            tss:
              type: number
              format: float
              description: Training Stress Score
            used_ftp:
              type: number
              format: float
              description: Used Functional Threshold Power
            guessed_ftp:
              type: number
              format: float
              description: Estimated Functional Threshold Power
            is_breakthrough_ftp:
              type: boolean
              description: Whether this workout represents an FTP breakthrough
            zone_power:
              type: string
              description: Power zone distribution
            normalized_power:
              type: number
              format: float
              description: Normalized power for the workout
            variability_index:
              type: number
              format: float
              description: Variability index of power
            intensity_factor:
              type: number
              format: float
              description: Intensity factor
            tss_power:
              type: number
              format: float
              description: TSS calculated from power
            average_hr:
              type: number
              format: float
              description: Average heart rate
            average_power:
              type: number
              format: float
              description: Average power
            zone_hr:
              type: string
              description: Heart rate zone distribution
            used_lthr:
              type: number
              format: float
              description: Used Lactate Threshold Heart Rate
            guessed_lthr:
              type: number
              format: float
              description: Estimated Lactate Threshold Heart Rate
            guessed_mhr:
              type: number
              format: float
              description: Estimated Maximum Heart Rate
            is_breakthrough_lthr:
              type: boolean
              description: Whether this workout represents an LTHR breakthrough
            tss_hr:
              type: number
              format: float
              description: TSS calculated from heart rate
            peak_duration_hr:
              type: number
              format: float
              description: Time spent in peak heart rate zone
            cardio_duration_hr:
              type: number
              format: float
              description: Time spent in cardio heart rate zone
            fatburn_duration_hr:
              type: number
              format: float
              description: Time spent in fat burn heart rate zone
            light_duration_hr:
              type: number
              format: float
              description: Time spent in light heart rate zone
            hr_series:
              type: string
              description: Heart rate series data
            hr_series_sampling_rate:
              type: string
              description: Sampling rate for heart rate series
            peak_threshold_hr:
              type: number
              format: float
              description: Peak heart rate threshold
            cardio_threshold_hr:
              type: number
              format: float
              description: Cardio heart rate threshold
            fatburn_threshold_hr:
              type: number
              format: float
              description: Fat burn heart rate threshold
            calories:
              type: number
              format: float
              description: Calories burned during workout
            max_hr:
              type: number
              format: float
              description: Maximum heart rate during workout
            hr_zone_durations_seconds:
              type: array
              items:
                type: integer
              description: Time spent in each heart rate zone (seconds)
            hr_zone_thresholds:
              type: array
              items:
                type: integer
              description: Heart rate zone thresholds
            power_zone_durations_seconds:
              type: array
              items:
                type: integer
              description: Time spent in each power zone (seconds)
            power_zone_thresholds:
              type: array
              items:
                type: integer
              description: Power zone thresholds
            activity_score_before:
              type: integer
              description: Activity score before workout
            activity_score_after:
              type: integer
              description: Activity score after workout
            group_id:
              type: integer
              description: Group identifier for related workouts
            selected:
              type: boolean
              description: Whether this workout is selected for analysis
            created_at:
              type: string
              format: date-time
              description: When the workout was created
            updated_at:
              type: string
              format: date-time
              description: When the workout was last updated
          required:
            - user_id
            - project_id
            - type
            - start_datetime
            - end_datetime
            - data_source
            - duration_seconds
            - type_name
            - tss
        - title: MindfulnessActivity
          type: object
          properties:
            id:
              type: string
              description: Unique identifier for the mindfulness activity
            project_id:
              type: string
              description: Project identifier
            user_id:
              type: string
              description: User identifier
            type:
              type: string
              enum:
                - mindfulness
              description: Type of activity
            start_datetime:
              type: string
              format: date-time
              description: Start time of the mindfulness session in ISO 8601 format
            end_datetime:
              type: string
              format: date-time
              description: End time of the mindfulness session in ISO 8601 format
            provider:
              type: string
              description: Provider of the mindfulness session
            data_source:
              type: string
              description: Source of the mindfulness data
            type_name:
              type: string
              description: Type/name of the mindfulness session
            duration_seconds:
              type: integer
              minimum: 0
              description: Duration of the mindfulness session in seconds
            guided_breathing_id:
              type: string
              description: Identifier for guided breathing session
            session_score:
              type: integer
              minimum: 0
              maximum: 100
              description: Score for the mindfulness session
            interbeat_intervals:
              type: string
              description: Interbeat intervals data
            group_id:
              type: integer
              description: Group identifier for related sessions
            selected:
              type: boolean
              description: Whether this session is selected for analysis
            created_at:
              type: string
              format: date-time
              description: When the mindfulness activity was created
            updated_at:
              type: string
              format: date-time
              description: When the mindfulness activity was last updated
          required:
            - user_id
            - project_id
            - type
            - start_datetime
            - end_datetime
            - provider
            - type_name
            - duration_seconds
            - guided_breathing_id
            - session_score
    ValidationError:
      type: object
      title: ValidationError
      required:
        - error
      properties:
        error:
          type: string
          minLength: 1
      additionalProperties: false
  responses:
    BadRequest:
      description: Bad request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationError'
    NotFound:
      description: Resource not found
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationError'
    InternalError:
      description: Internal server error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ValidationError'
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: OAuth bearer token for Health API authentication

````