> ## Documentation Index
> Fetch the complete documentation index at: https://developer.energy-hub.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Link PV inverters

> Connects the provided list of PV inverters from the vendor account to the Energy Hub.



## OpenAPI

````yaml post /v1.0.0/link/users/{userId}/vendor-accounts/{vendorAccountId}/pv-inverters
openapi: 3.0.1
info:
  description: A service used for battery and pv inverter devices
  title: home-power-service
  version: 1.0.0
servers:
  - description: Generated server url
    url: https://api.energy-hub.io
security: []
paths:
  /v1.0.0/link/users/{userId}/vendor-accounts/{vendorAccountId}/pv-inverters:
    post:
      tags:
        - Home Power Link Controller
      summary: Link PV inverters
      description: >-
        Connects the provided list of PV inverters from the vendor account to
        the Energy Hub.
      operationId: linkPvInvertersToVendorAccount
      parameters:
        - schema:
            type: string
          in: path
          name: userId
          description: User ID
          required: true
        - schema:
            format: uuid
            type: string
          in: path
          name: vendorAccountId
          description: Vendor account ID
          required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PvInvertersAddingRequest'
        required: true
      responses:
        '201':
          description: Created
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/PvInverterLinkDto'
        '400':
          description: Bad request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ValidationErrorMessageDto'
              examples:
                BAD_REQUEST:
                  $ref: '#/components/examples/BAD_REQUEST'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessageDto'
              examples:
                UNAUTHORIZED:
                  $ref: '#/components/examples/UNAUTHORIZED'
        '402':
          description: Payment required
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessageDto'
              examples:
                DEVICE_LIMIT_REACHED:
                  $ref: '#/components/examples/DEVICE_LIMIT_REACHED'
        '404':
          description: Not found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessageDto'
              examples:
                PV_INVERTER_NOT_FOUND:
                  $ref: '#/components/examples/PV_INVERTER_NOT_FOUND'
                VENDOR_ACCOUNT_NOT_FOUND:
                  $ref: '#/components/examples/VENDOR_ACCOUNT_NOT_FOUND'
        '503':
          description: Service Unavailable
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorMessageDto'
              examples:
                VENDOR_ACCOUNT_IS_DISCONNECTED:
                  $ref: '#/components/examples/VENDOR_ACCOUNT_IS_DISCONNECTED'
                VENDOR_COMMUNICATION_ERROR:
                  $ref: '#/components/examples/VENDOR_COMMUNICATION_ERROR'
                VENDOR_AUTHENTICATION_ERROR:
                  $ref: '#/components/examples/VENDOR_AUTHENTICATION_ERROR'
                VENDOR_CONNECTION_ERROR:
                  $ref: '#/components/examples/VENDOR_CONNECTION_ERROR'
      security:
        - API_Key: []
components:
  schemas:
    PvInvertersAddingRequest:
      description: >-
        Object for PV inverters IDs request that should be added to the Energy
        Hub.
      type: object
      required:
        - externalPvInverters
      properties:
        externalPvInverters:
          uniqueItems: true
          description: List of external IDs of PV inverters to be linked to the Energy Hub.
          type: array
          items:
            description: >-
              List of external IDs of PV inverters to be linked to the Energy
              Hub.
            type: string
            example: '["8413731391660801"]'
          example:
            - '8413731391660801'
    PvInverterLinkDto:
      description: Object of PV inverter for linking process.
      type: object
      required:
        - externalId
        - id
        - isLinked
        - name
        - vendor
      properties:
        isLinked:
          description: Indicates if the PV inverter is linked to the Energy Hub.
          type: boolean
        vendor:
          description: The vendor of the PV inverter.
          type: string
          enum:
            - FRONIUS
            - TESLA
            - HUAWEI
            - SMA
        name:
          description: The display name of the PV inverter.
          type: string
          example: My PV inverter
        externalId:
          description: ID of the PV inverter in external vendor system.
          type: string
          example: '8413731391660801'
        siteName:
          description: The site name of the home energy device.
          type: string
          example: My Home
        id:
          format: uuid
          description: The ID of the PV inverter.
          type: string
    ValidationErrorMessageDto:
      allOf:
        - $ref: '#/components/schemas/ErrorMessageDto'
        - type: object
          properties:
            errorCode:
              description: The error code
              type: string
              example: EXAMPLE_ERROR_CODE
            validationErrors:
              description: List of validation errors
              type: array
              items:
                $ref: '#/components/schemas/ValidationError'
            id:
              format: uuid
              description: The error identifier
              type: string
              example: 7958818d-64d2-4ede-b12b-4786dd2f348b
            message:
              description: The error message
              type: string
              example: Example error message
      type: object
      required:
        - errorCode
        - id
        - message
    ErrorMessageDto:
      type: object
      required:
        - errorCode
        - id
        - message
      properties:
        errorCode:
          description: The error code
          type: string
          example: EXAMPLE_ERROR_CODE
        id:
          format: uuid
          description: The error identifier
          type: string
          example: 7958818d-64d2-4ede-b12b-4786dd2f348b
        message:
          description: The error message
          type: string
          example: Example error message
    ValidationError:
      type: object
      properties:
        field:
          description: Affected field
          type: string
        message:
          description: Validation message
          type: string
  examples:
    BAD_REQUEST:
      value:
        errorCode: BAD_REQUEST
        validationErrors:
          - field: Affected field
            message: Validation message
        id: 57da008b-bd4d-442e-b8f8-584cb9058e29
        message: Bad request
    UNAUTHORIZED:
      value:
        errorCode: UNAUTHORIZED
        id: 57da008b-bd4d-442e-b8f8-584cb9058e29
        message: Unauthorized
    DEVICE_LIMIT_REACHED:
      value:
        errorCode: DEVICE_LIMIT_REACHED
        id: 57da008b-bd4d-442e-b8f8-584cb9058e29
        message: Device limit reached
    PV_INVERTER_NOT_FOUND:
      value:
        errorCode: PV_INVERTER_NOT_FOUND
        id: 57da008b-bd4d-442e-b8f8-584cb9058e29
        message: '[PV_INVERTER] Requested PV inverter not found'
    VENDOR_ACCOUNT_NOT_FOUND:
      value:
        errorCode: VENDOR_ACCOUNT_NOT_FOUND
        id: 57da008b-bd4d-442e-b8f8-584cb9058e29
        message: '[VENDOR_ACCOUNT] Requested vendor account is not found.'
    VENDOR_ACCOUNT_IS_DISCONNECTED:
      value:
        errorCode: VENDOR_ACCOUNT_IS_DISCONNECTED
        id: 57da008b-bd4d-442e-b8f8-584cb9058e29
        message: '[VENDOR_ACCOUNT] Vendor account is disconnected'
    VENDOR_COMMUNICATION_ERROR:
      value:
        errorCode: VENDOR_COMMUNICATION_ERROR
        id: 57da008b-bd4d-442e-b8f8-584cb9058e29
        message: '[VENDOR API] Communication error with Vendor API'
    VENDOR_AUTHENTICATION_ERROR:
      value:
        errorCode: VENDOR_AUTHENTICATION_ERROR
        id: 57da008b-bd4d-442e-b8f8-584cb9058e29
        message: '[VENDOR API] Authentication error with Vendor API'
    VENDOR_CONNECTION_ERROR:
      value:
        errorCode: VENDOR_CONNECTION_ERROR
        id: 57da008b-bd4d-442e-b8f8-584cb9058e29
        message: '[VENDOR API] Connection cannot be established with Vendor API'
  securitySchemes:
    API_Key:
      in: header
      name: X-API-KEY
      description: API key used for authorization and authentication.
      type: apiKey

````