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

# Get KPI values



## OpenAPI

````yaml api-reference/swagger.yaml get /api/v1/kpis/{id}/values
openapi: 3.0.3
info:
  title: FactoryPulse API
  version: 1.0.0
  description: API documentation for FactoryPulse application
  license:
    name: MIT
    url: https://opensource.org/licenses/MIT
servers:
  - url: '{protocol}://{host}'
    variables:
      protocol:
        enum:
          - http
          - https
        default: https
      host:
        default: lean.factorypulse.app
  - url: /api/v1
    description: API V1
security: []
paths:
  /api/v1/kpis/{id}/values:
    get:
      tags:
        - KPIs
      summary: Get KPI values
      operationId: getKPIValues
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
        - name: date_from
          in: query
          required: true
          description: Start date for KPI values (YYYY-MM-DD)
          schema:
            type: string
            format: date
        - name: date_to
          in: query
          required: true
          description: End date for KPI values (YYYY-MM-DD)
          schema:
            type: string
            format: date
        - name: org_id
          in: query
          required: true
          description: Organization ID to fetch values for
          schema:
            type: integer
      responses:
        '200':
          description: KPI values found
          content:
            application/json:
              schema:
                type: object
                properties:
                  kpi:
                    $ref: '#/components/schemas/KPI'
                  values:
                    type: array
                    items:
                      $ref: '#/components/schemas/KPIValue'
        '401':
          description: Unauthorized
        '403':
          description: Forbidden - Invalid subscription
        '404':
          description: KPI not found
        '422':
          description: Invalid date format
      security:
        - BearerAuth: []
components:
  schemas:
    KPI:
      type: object
      properties:
        id:
          type: integer
          example: 1
        name:
          type: string
          example: Production Rate
        description:
          type: string
          nullable: true
          example: Units produced per hour
        unit:
          type: string
          enum:
            - units
            - hours
            - percentage
            - count
            - kg
            - g
            - l
            - ml
            - pcs
            - doses
          example: units
        data_type:
          type: string
          enum:
            - number
            - currency
          example: number
        frequency:
          type: string
          enum:
            - shiftly
            - daily
            - weekly
            - monthly
          example: daily
        direction:
          type: string
          enum:
            - higher
            - lower
          example: higher
        aggregation:
          type: string
          enum:
            - sum
            - average
            - min
            - max
          example: sum
      required:
        - id
        - name
        - data_type
        - frequency
        - direction
    KPIValue:
      type: object
      properties:
        date:
          type: string
          format: date
          example: '2024-03-14'
        actual:
          type: number
          format: float
          nullable: true
          example: 95.5
        target:
          type: number
          format: float
          nullable: true
          example: 100
        metadata:
          type: object
          example: {}
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT

````