> ## 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.

# Get sites forecast consumptions

> This API estimates energy (gas or electricity) consumption according to the chosen calculation strategy over a given input period. It returns:
- estimated consumption
- consumption cost
- units used for energy and cost

Two strategies are supported:
- ESTIMATION_AFTER_REAL:
  - This strategy estimates energy (gas or electricity) consumption from the called date until the end of the period passed as a parameter. 
  - It needs a 15 days + X days of actual energy consumption before the called date. (The X variable is configured by the marketer).  
  - It returns the sum of actual and estimated energy consumption and the cost over the requested period.
- ESTIMATION_FOR_FULL_PERIOD:
  - This strategy makes it possible to estimate energy consumption over the period passed as a parameter. 
  - It needs a 15 days + X days of actual energy consumption before the start date of the period. (The X variable is configured by the marketer). 
  - It returns the estimated consumption and the cost over the requested period.




## OpenAPI

````yaml /api-reference/forecast.yaml get /sites/{site-id}/forecast-consumptions
openapi: 3.0.3
info:
  title: Forecast consumptions lifecycle
  description: API of forecast system
  termsOfService: ''
  version: 1.0.x
servers:
  - url: https://api.home.datanumia.com/api/v2
security: []
paths:
  /sites/{site-id}/forecast-consumptions:
    get:
      tags:
        - Forecast consumptions
      description: >
        This API estimates energy (gas or electricity) consumption according to
        the chosen calculation strategy over a given input period. It returns:

        - estimated consumption

        - consumption cost

        - units used for energy and cost


        Two strategies are supported:

        - ESTIMATION_AFTER_REAL:
          - This strategy estimates energy (gas or electricity) consumption from the called date until the end of the period passed as a parameter. 
          - It needs a 15 days + X days of actual energy consumption before the called date. (The X variable is configured by the marketer).  
          - It returns the sum of actual and estimated energy consumption and the cost over the requested period.
        - ESTIMATION_FOR_FULL_PERIOD:
          - This strategy makes it possible to estimate energy consumption over the period passed as a parameter. 
          - It needs a 15 days + X days of actual energy consumption before the start date of the period. (The X variable is configured by the marketer). 
          - It returns the estimated consumption and the cost over the requested period.
      operationId: getForecastConsumptions
      parameters:
        - name: site-id
          in: path
          description: The site identifier
          required: true
          schema:
            type: string
        - name: fluid
          in: query
          description: The type of consumption (electricity or gas)
          required: true
          schema:
            type: string
            enum:
              - ELEC
              - GAS
        - name: strategy
          in: query
          description: >
            The specific strategy to be selected to calculate the forecasted
            energy consumption
          schema:
            type: string
            enum:
              - ESTIMATION_FOR_FULL_PERIOD
              - ESTIMATION_AFTER_REAL
        - name: beginDate
          in: query
          description: The starting date to estimate the consumption from
          required: true
          schema:
            type: string
          example: '2014-01-01'
        - name: endDate
          in: query
          description: >-
            The ending date (excluded) until which to estimate the energy
            consumption
          required: true
          schema:
            type: string
          example: '2014-02-01'
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetForecastConsumptionResponse'
        '400':
          description: Functional Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '500':
          description: Technical Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '503':
          description: Algorithm Ineligibility Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    GetForecastConsumptionResponse:
      required:
        - cost
        - energy
        - units
      type: object
      properties:
        energy:
          type: number
          description: The energy estimated
          example: 1056.38742032702
        cost:
          type: number
          description: The consumption cost
          example: 159.2361759474585
        units:
          $ref: '#/components/schemas/Units'
    ErrorResponse:
      required:
        - errorCode
        - errorDescription
      type: object
      properties:
        errorCode:
          type: string
          description: The error code
        errorDescription:
          type: string
          description: The error description
      description: ErrorResponse
    Units:
      required:
        - cost
        - energy
      type: object
      properties:
        energy:
          type: string
          description: Energy unit
          example: KWH
        cost:
          type: string
          description: Cost unit
          example: EUR

````