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

# Daily Statistics

> This endpoint returns daily statistics calculated based on the data available for a specific time period. The data is aggregated for each day based on the user's local timezone.

<Note>
Refer to the different statistics types in the [Statistics Types](/technical-references/statistics_matrix) section for more information on how the data is aggregated for each type.
</Note>

#### User's Local Timezone

The `/statistics/daily` endpoint uses the user's local timezone for all its calculations. This approach ensures that the data reflects the user's actual daily activity patterns, providing a more personalized view. By using the local timezone, the API tailors the data to the user's specific context, which is particularly useful for applications that focus on individual user experiences. This approach contrasts with the `/statistics/interval` endpoint, which uses Coordinated Universal Time (UTC) for calculations, offering a standardized global view.




## OpenAPI

````yaml get /queries/statistics/daily
openapi: 3.1.0
info:
  title: Application user API
  version: 3.0.2
servers:
  - url: https://app-api.spikeapi.com/v3
security: []
paths:
  /queries/statistics/daily:
    get:
      tags:
        - Queries / Statistics
      summary: Daily Statistics
      description: >
        This endpoint returns daily statistics calculated based on the data
        available for a specific time period. The data is aggregated for each
        day based on the user's local timezone.


        <Note>

        Refer to the different statistics types in the [Statistics
        Types](/technical-references/statistics_matrix) section for more
        information on how the data is aggregated for each type.

        </Note>


        #### User's Local Timezone


        The `/statistics/daily` endpoint uses the user's local timezone for all
        its calculations. This approach ensures that the data reflects the
        user's actual daily activity patterns, providing a more personalized
        view. By using the local timezone, the API tailors the data to the
        user's specific context, which is particularly useful for applications
        that focus on individual user experiences. This approach contrasts with
        the `/statistics/interval` endpoint, which uses Coordinated Universal
        Time (UTC) for calculations, offering a standardized global view.
      operationId: getQueriesStatisticsDaily
      parameters:
        - description: >-
            Start time of the query range in user's local timezone according to
            the provider, inclusive
          example: '2006-01-02'
          explode: false
          in: query
          name: from_date
          required: true
          schema:
            description: >-
              Start time of the query range in user's local timezone according
              to the provider, inclusive
            examples:
              - '2006-01-02'
            format: date
        - description: >-
            End time of the query range in user's local timezone according to
            the provider, inclusive
          example: '2006-01-02'
          explode: false
          in: query
          name: to_date
          required: true
          schema:
            description: >-
              End time of the query range in user's local timezone according to
              the provider, inclusive
            examples:
              - '2006-01-02'
            format: date
        - description: Exclude manual metrics from the statistics
          explode: false
          in: query
          name: exclude_manual
          schema:
            default: false
            description: Exclude manual metrics from the statistics
            type: boolean
        - explode: false
          in: query
          name: types
          required: true
          schema:
            items:
              enum:
                - sleep_score
                - stress_score
                - recovery_score
                - activity_score
                - steps
                - distance_total
                - distance_walking
                - distance_cycling
                - distance_running
                - calories_burned_basal
                - calories_burned_active
                - calories_burned_total
                - sleep_duration_total
                - heartrate
                - heartrate_max
                - heartrate_min
                - heartrate_resting
                - sleep_skin_temperature_deviation
                - hrv_rmssd
                - hrv_sdnn
                - duration_low_intensity
                - duration_moderate_intensity
                - duration_high_intensity
              type: string
            minItems: 1
            type: array
        - explode: false
          in: query
          name: providers
          schema:
            items:
              description: Provider slugs
              examples:
                - strava
                - omron_eu
                - omron_us
                - health_connect
                - fitbit
                - garmin
                - huawei
                - dexcom
                - whoop
                - withings
                - suunto
                - apple
                - freestyle_libre
                - oura
                - polar
                - coros
                - ultrahuman
                - samsung_health_data
                - luna
              type: string
            type: array
        - description: Whether to include the record IDs in the response
          explode: false
          in: query
          name: include_record_ids
          schema:
            default: false
            description: Whether to include the record IDs in the response
            type: boolean
        - description: Device types to include in the statistics
          explode: false
          in: query
          name: device_types
          schema:
            description: Device types to include in the statistics
            items:
              enum:
                - unknown
                - phone
                - watch
                - scale
                - ring
                - head_mounted
                - fitness_band
                - chest_strap
                - smart_display
                - accessory
              type: string
            type: array
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/StatisticsDailyQueryOutput'
          description: OK
        '400':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Bad Request
        '401':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Unauthorized
        '404':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Not Found
        '422':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Unprocessable Entity
        '500':
          content:
            application/problem+json:
              schema:
                $ref: '#/components/schemas/ErrorModel'
          description: Internal Server Error
      security:
        - bearer: []
components:
  schemas:
    StatisticsDailyQueryOutput:
      additionalProperties: false
      properties:
        from_date:
          description: Calendar date in user's local timezone according to the provider
          examples:
            - '2006-01-02'
          format: date
        statistics:
          items:
            $ref: '#/components/schemas/StatisticsDailyQueryOutputValue'
          type:
            - array
            - 'null'
        to_date:
          description: Calendar date in user's local timezone according to the provider
          examples:
            - '2006-01-02'
          format: date
      required:
        - from_date
        - to_date
        - statistics
      type: object
    ErrorModel:
      additionalProperties: false
      properties:
        detail:
          description: >-
            A human-readable explanation specific to this occurrence of the
            problem.
          examples:
            - Property foo is required but is missing.
          type: string
        errors:
          description: Optional list of individual error details
          items:
            $ref: '#/components/schemas/ErrorDetail'
          type:
            - array
            - 'null'
        instance:
          description: >-
            A URI reference that identifies the specific occurrence of the
            problem.
          examples:
            - https://example.com/error-log/abc123
          format: uri
          type: string
        status:
          description: HTTP status code
          examples:
            - 400
          format: int64
          type: integer
        title:
          description: >-
            A short, human-readable summary of the problem type. This value
            should not change between occurrences of the error.
          examples:
            - Bad Request
          type: string
        type:
          default: about:blank
          description: A URI reference to human-readable documentation for the error.
          examples:
            - https://example.com/errors/example
          format: uri
          type: string
      type: object
    StatisticsDailyQueryOutputValue:
      additionalProperties: false
      properties:
        date:
          description: Calendar date in user's local timezone according to the provider
          examples:
            - '2006-01-02'
          format: date
        record_ids:
          items:
            description: Unique identifier for a record.
            examples:
              - 12345678-1234-abcd-4321-abcdef123456
            format: uuid
            type: string
          type:
            - array
            - 'null'
        values:
          description: Statistics values
          properties:
            activity_score:
              description: activity_score in count
              examples:
                - 83
              type: number
            calories_burned_active:
              description: calories_burned_active in kcal
              examples:
                - 1020.0991
              type: number
            calories_burned_basal:
              description: calories_burned_basal in kcal
              examples:
                - 2000.1242
              type: number
            calories_burned_total:
              description: calories_burned_total in kcal
              examples:
                - 3020.2233
              type: number
            distance_cycling:
              description: distance_cycling in meters
              examples:
                - 20091.0022
              type: number
            distance_running:
              description: distance_running in meters
              examples:
                - 12000.1014
              type: number
            distance_total:
              description: distance_total in meters
              examples:
                - 5880.7021
              type: number
            distance_walking:
              description: distance_walking in meters
              examples:
                - 1200.7022
              type: number
            duration_high_intensity:
              description: duration_high_intensity in ms
              examples:
                - 1200000
              type: number
            duration_low_intensity:
              description: duration_low_intensity in ms
              examples:
                - 9000000
              type: number
            duration_moderate_intensity:
              description: duration_moderate_intensity in ms
              examples:
                - 2400000
              type: number
            heartrate:
              description: heartrate in bpm
              examples:
                - 100
              type: number
            heartrate_max:
              description: heartrate_max in bpm
              examples:
                - 120
              type: number
            heartrate_min:
              description: heartrate_min in bpm
              examples:
                - 60
              type: number
            heartrate_resting:
              description: heartrate_resting in bpm
              examples:
                - 60
              type: number
            hrv_rmssd:
              description: hrv_rmssd in ms
              examples:
                - 45
              type: number
            hrv_sdnn:
              description: hrv_sdnn in ms
              examples:
                - 52
              type: number
            recovery_score:
              description: recovery_score in count
              examples:
                - 83
              type: number
            sleep_duration_total:
              description: sleep_duration_total in ms
              examples:
                - 3600000
              type: number
            sleep_score:
              description: sleep_score in count
              examples:
                - 70
              type: number
            sleep_skin_temperature_deviation:
              description: sleep_skin_temperature_deviation in celsius
              examples:
                - -0.13
              type: number
            steps:
              description: steps in count
              examples:
                - 10000
              type: number
            stress_score:
              description: stress_score in count
              examples:
                - 70
              type: number
          type: object
      required:
        - date
        - values
      type: object
    ErrorDetail:
      additionalProperties: false
      properties:
        location:
          description: >-
            Where the error occurred, e.g. 'body.items[3].tags' or
            'path.thing-id'
          type: string
        message:
          description: Error message text
          type: string
        value:
          description: The value at the given location
      type: object
  securitySchemes:
    bearer:
      bearerFormat: JWT
      scheme: bearer
      type: http

````