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

# Consumptions with load curve

> The service returns the electrical consumption of a given site between two specified dates at the requested step, only by using load curve data.



## OpenAPI

````yaml /api-reference/energy-consumption.yaml get /v2/sites/{site-id}/consumptions/load-curve
openapi: 3.1.0
info:
  title: Energy consumption
  termsOfService: TODO
  contact:
    email: api@datanumia.com
  version: 2.0.0
servers:
  - url: https://api.home.datanumia.com/api
    description: Production Server
security: []
paths:
  /v2/sites/{site-id}/consumptions/load-curve:
    get:
      tags:
        - Electric energy consumptions
      summary: Consumptions with load curve
      description: >-
        The service returns the electrical consumption of a given site between
        two specified dates at the requested step, only by using load curve
        data.
      operationId: getLoadCurveComputedConsumption
      parameters:
        - name: site-id
          in: path
          description: The site identifier
          required: true
          schema:
            type: string
        - name: beginTs
          in: query
          description: |-
            The starting timestamp to calculate the consumption from.
               Accepted format:
               - YYYY-MM-DDThh:mm:ss
               - YYYY-MM-DDThh:mm:ssZ
               - YYYY-MM-DDThh:mm:ss+XX:XX
          required: true
          schema:
            type: string
            format: date-time
          example: |-
            - '2022-01-01T00:00:00'
            - '2021-01-01T23:00:00Z'
            - '2023-01-01T00:00:00+01:00'
        - name: endTs
          in: query
          description: >-
            The ending timestamp (excluded) until which to calculate the
            consumption.
             Accepted format:
             - YYYY-MM-DDThh:mm:ss
             - YYYY-MM-DDThh:mm:ssZ
             - YYYY-MM-DDThh:mm:ss+XX:XX
          required: true
          schema:
            type: string
            format: date-time
          example: |-
            - '2023-01-01T00:00:00'
            - '2022-01-01T23:00:00Z'
            - '2023-01-01T00:00:00+01:00'
        - name: stepUnit
          in: query
          description: >-
            Step unit in which consumption will be returned, global consumption
            will be returned if this field is not provided
          required: false
          schema:
            type: string
            enum:
              - YEARS
              - MONTHS
              - DAYS
              - HOURS
              - MINUTES
        - name: stepValue
          in: query
          description: Step value in which consumption will be returned.
          required: false
          schema:
            type: integer
            format: int64
            default: 1
          example: >-
            For example, if the stepUnit is MONTHS and the stepValue is 2, the
            consumption will be returned in a step of 2 months.
      responses:
        '200':
          description: 'OK - return computed Consumptions for site-id '
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/LoadCurveComputedConsumptionsDto'
              example:
                period:
                  startTime: '2022-01-01T00:00:00+01:00'
                  endTime: '2023-01-01T00:00:00+01:00'
                step: P1M
                units:
                  cost: EUR
                  energyMeter: KWH
                consumptions:
                  - period:
                      startTime: '2023-02-01T00:00:00+01:00'
                      endTime: '2023-03-01T00:00:00+01:00'
                    energyMeter:
                      total: 453.232
                      byTariffHeading:
                        HP: 289.226
                        HC: 164.006
                    cost:
                      total: 87.12537060000002
                      standingCharge: 12.15250000000001
                      standingChargeByComponents: {}
                      byTariffHeading:
                        HP: 52.668054600000005
                        HC: 22.304816000000002
                    quality: 1
                    errorFlags: []
                    indexNatures: []
                    status: COMPLETE
                    nature: REAL
                    aggregated: true
                    usingLoadCurve: true
        '400':
          description: |-
            Functional error. Possible values:

            Error code | Error case 
            ---------|----------
             INCONSISTENT_PERIOD | Start date (beginTs) more recent than the end date (endTs)
             INVALID_DATE_FORMAT | Incorrect date format (beginTs and/or endTs)
             INVALID STEP UNIT | Invalid time step unit (not part of the list: DAYS, MONTHS, YEARS, etc.)
             MISSING_MANDATORY_FIELD | Mandatory field not filled in
             OUT_OF_CALCULATION_PERIOD | Requested period is outside the 3-year consumption history
             INVALID_REQUEST | Site must have elec

            This list can be expanded over time.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '404':
          description: Site not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiError'
        '500':
          description: Unexpected error
components:
  schemas:
    LoadCurveComputedConsumptionsDto:
      properties:
        period:
          $ref: '#/components/schemas/ComputedConsumptionsPeriodDto'
        step:
          type: string
          format: ISO-8601
          description: The step in which the consumption is returned.
        units:
          $ref: '#/components/schemas/LoadCurveComputedConsumptionsUnitsDto'
        consumptions:
          type: array
          items:
            $ref: '#/components/schemas/LoadCurveConsumptionDto'
      required:
        - consumptions
        - period
        - step
        - units
    ApiError:
      type: object
      properties:
        errorCode:
          type: string
        errorDescription:
          type: string
    ComputedConsumptionsPeriodDto:
      description: The requested period.
      properties:
        startTime:
          description: 'Always in format: YYYY-MM-DDThh:mm:ss+XX:XX'
          type: string
          format: date-time
        endTime:
          description: 'Always in format: YYYY-MM-DDThh:mm:ss+XX:XX'
          type: string
          format: date-time
      required:
        - startTime
        - endTime
    LoadCurveComputedConsumptionsUnitsDto:
      properties:
        cost:
          type: string
          format: ISO-4217
        energyMeter:
          type: string
      required:
        - cost
        - energyMeter
    LoadCurveConsumptionDto:
      properties:
        period:
          $ref: '#/components/schemas/ConsumptionPeriodDto'
          description: The period of each consumption
        energyMeter:
          $ref: '#/components/schemas/ConsumptionEnergyMeterDto'
          description: energyMeter
        cost:
          $ref: '#/components/schemas/LoadCurveConsumptionCostDto'
          description: cost
        quality:
          type: number
          format: float
          description: >-
            Number between 0 (poor quality) and 1 (optimal quality). Quality
            level decreases when the indexes used for consumption calculation
            are interpolated from indexes that are distant in time.
        errorFlags:
          type: array
          description: >
            Indicates if an error has been encountered in the consumption
            calculation.


            **BAD_INDEX_INFORMATION_OR_CONTRACT_CHANGE_MISSING**: We have
            incoherent information in the contracts or indexes associated to the
            site.


            **ABERRANT_CONSUMPTION**: The calculated consumption is above the
            aberrancy threshold.
          items:
            type: string
            enum:
              - BAD_INDEX_INFORMATION_OR_CONTRACT_CHANGE_MISSING
              - ABERRANT_CONSUMPTION
          uniqueItems: true
        indexNatures:
          type: string
          description: >-
            Natures of the indexes that have been used to calculate the
            consumption, always EMPTY
        status:
          type: string
          description: >
            Indicates if the consumption has been calculated on the whole
            requested period or not.


            **EMPTY**: No consumption is calculated.


            **INCOMPLETE**: The period over which the consumption is actually
            calculated is shorter than the requested period, due to missing
            indexes.


            **COMPLETE**: The consumption is calculated over the whole requested
            period.
          enum:
            - EMPTY
            - INCOMPLETE
            - COMPLETE
        nature:
          type: string
          description: >
            Indicates the type of data that has been used for the consumption
            calculation.


            **REAL**: The consumption has been calculated without interpolation,
            without using estimated data and without data from sensors.


            **ESTIMATED**: The consumption has been calculated with index
            interpolation and/or by using estimated data.


            **SENSOR**: The consumption has been calculated with data from
            sensors.


            **EMPTY**: No consumption is calculated.
          enum:
            - REAL
            - ESTIMATED
            - SENSOR
            - EMPTY
        aggregated:
          type: boolean
          description: >-
            Indicates if the consumption has been calculated by aggregating at
            least 2 points of load curve data.
        usingLoadCurve:
          type: boolean
          description: >-
            Indicates whether consumption is calculated using load curve data to
            calculate interpolation weights and/or by aggregating load curve
            data.
      required:
        - aggregated
        - cost
        - energyMeter
        - errorFlags
        - indexNatures
        - nature
        - period
        - quality
        - status
        - usingLoadCurve
    ConsumptionPeriodDto:
      description: The period of each consumption
      properties:
        startTime:
          description: 'Always in format: YYYY-MM-DDThh:mm:ss+XX:XX'
          type: string
          format: date-time
        endTime:
          description: 'Always in format: YYYY-MM-DDThh:mm:ss+XX:XX'
          type: string
          format: date-time
      required:
        - startTime
        - endTime
    ConsumptionEnergyMeterDto:
      properties:
        total:
          type: number
          description: Total of the energy consumption.
        byTariffHeading:
          type: object
          additionalProperties:
            type: number
          description: Energy consumption broken down by tariff headings.
      required:
        - byTariffHeading
        - total
    LoadCurveConsumptionCostDto:
      properties:
        total:
          type: number
          description: Total cost of the energy consumption on the period.
        standingCharge:
          type: number
          description: Total cost of the standing charge on the period.
        standingChargeByComponents:
          type: object
          additionalProperties:
            type: number
          description: >-
            Standing charge broken down by components (if standing charge
            components are defined for the tenant).
        byTariffHeading:
          type: object
          additionalProperties:
            type: number
          description: Energy cost broken down by tariff headings.
      required:
        - byTariffHeading
        - standingCharge
        - standingChargeByComponents
        - total

````