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

# Gets the target reference

> returns the target reference (default target) from past consumptions or similar homes



## OpenAPI

````yaml /api-reference/targets.yaml get /v1/sites/{site-id}/energy-target/reference
openapi: 3.0.3
info:
  title: Targets lifecycle
  description: >
    Target key concepts:

    - A target is applicable for 12 months and spans from the start of the year
    to its end.

    - A target can either be a cost in euros or a consumption in kWh. The value
    of the target can be updated but not its unit type.
  termsOfService: TODO
  contact:
    email: api@datanumia.com
  version: 2.0.0
servers:
  - url: https://api.home.datanumia.com/api
    description: Production Server
security: []
paths:
  /v1/sites/{site-id}/energy-target/reference:
    get:
      tags:
        - targets
      summary: Gets the target reference
      description: >-
        returns the target reference (default target) from past consumptions or
        similar homes
      operationId: getTargetReference
      parameters:
        - name: site-id
          in: path
          required: true
          schema:
            type: string
          example: d8a9b286-d7c0-493c-9610-403747687023_01
        - name: fluid
          in: query
          description: fluid type
          required: true
          schema:
            type: string
            enum:
              - ELEC
              - GAS
      responses:
        '200':
          description: successful operation
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ConsumptionTargetReference'
        '400':
          description: >
            Functional Error.

            Error cases:

            - SITE_NOT_FOUND when the site referenced in the path doesn't exist

            - FLUID_NOT_SUPPORTED_EXCEPTION when the fluid type isn't ELEC

            - NOT_ENOUGH_DATA_EXCEPTION when either energy or cost data is
            missing, meaning no target reference can be set
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
              example:
                errorCode: SITE_NOT_FOUND
                errorDescription: Unknown site
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponseUnauthorized'
        '403':
          description: Forbidden
          content: {}
        '404':
          description: Not Found
          content: {}
        '500':
          description: Server error
          content: {}
      security:
        - Bearer:
            - home:consumption-targets:target-reference:read
components:
  schemas:
    ConsumptionTargetReference:
      type: object
      required:
        - energy
        - cost
        - source
      properties:
        energy:
          description: The consumption reference (KWH)
          type: integer
          example: 12000
        cost:
          description: The cost reference (EURO)
          type: number
          example: 3000
        source:
          type: string
          example: SIMILAR_HOME
          enum:
            - PROJECTION
            - YEARLY_CONSUMPTION
            - SIMILAR_HOME
    ErrorResponse:
      required:
        - errorCode
        - errorDescription
      type: object
      properties:
        errorCode:
          description: The error code.
          type: string
          example: SITE_NOT_FOUND
        errorDescription:
          type: string
          description: The error description
          example: Unknown site
      description: ErrorResponse
    ErrorResponseUnauthorized:
      required:
        - errorCode
        - errorDescription
      type: object
      properties:
        errorCode:
          description: The error code.
          type: string
          example: INVALID_AUTHORIZATION_HEADER_VALUE
        errorDescription:
          type: string
          description: The error description
          example: The Authorization header is invalid
      description: ErrorResponse
  securitySchemes:
    Bearer:
      type: http
      scheme: bearer

````