openapi: 3.0.0
info:
  title: Solar Evaluation API
  version: v1
  x-logo:
    url: https://developer.accurassi.com/assets/logo.png
    backgroundColor: '#FFFFFF'
    altText: Accurassi logo
  description: >-
    Solar Evaluation Tool provides an instant evaluation including payback
    period, energy bill cost savings, carbon impact metrics and a recommended
    solar system. The tool uses Accurassi’s patent AI technology to identify the
    optimal roof space on customer’s property and augment solar panels on the
    property image. 
servers:
  - url: https://solarserver.accurassi.com
paths:
  /analysis:
    post:
      summary: /analysis
      description: >-
        Analyse a property for solar evaluation. For most accurate results a
        base64 encoded PDF should be passed in the body of the endpoint. This
        allows the user's consumption and payments to be used in the solar
        evaluation. Instead of a bill an address can be passed. This will use
        distributor benchmark data for household yearly consumption and spend.
      parameters:
        - name: clientCode
          in: header
          description: This value will be provided by Accurassi during on-boarding.
          required: true
          style: simple
          explode: false
          schema:
            type: string
        - name: clientID
          in: header
          description: >-
            This value will be provided by Accurassi during on-boarding. The
            clientID is paired with clientCode and used for authentication. This
            value should never be published on a public facing site.
          required: true
          style: simple
          explode: false
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AnalysisRequest'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AnalysisResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Failed authorisation
        '500':
          description: Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /quote:
    post:
      summary: /quote
      description: >-
        Creates quotes for configurable solar installation sizes based on the
        available roof space.
      parameters:
        - name: clientCode
          in: header
          description: This value will be provided by Accurassi during on-boarding.
          required: true
          style: simple
          explode: false
          schema:
            type: string
        - name: clientID
          in: header
          description: >-
            This value will be provided by Accurassi during on-boarding. The
            clientID is paired with clientCode and used for authentication. This
            value should never be published on a public facing site.
          required: true
          style: simple
          explode: false
          schema:
            type: string
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/QuoteRequest'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/QuoteResponse'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Failed authorisation
        '500':
          description: Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
  /image/{correlationId}/{quoteId}:
    get:
      summary: /image
      description: Returns image of the analysed roof
      parameters:
        - name: correlationId
          in: path
          schema:
            type: string
          required: true
          description: CorrelationId returned in analysis
        - name: quoteId
          in: path
          schema:
            type: string
          required: true
          description: QuoteId returned in quote
      responses:
        '200':
          description: Success
          content:
            text/plain:
              schema:
                type: string
                description: base64 string of roof image
                example: iVBORw0KGgoAAAANSUhEUgAABAAAAAQACAY...
            image/png:
              schema:
                type: string
                format: binary
                description: Binary image of roof image
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '401':
          description: Failed authorisation
        '500':
          description: Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
components:
  schemas:
    Point:
      type: array
      description: 2 numbers representing a position in 2D coordinate space
      items:
        type: integer
        example:
          - 123
          - 456
    Roof:
      type: object
      properties:
        bounds:
          type: array
          description: Array of 2D points describing the bounds of the roof
          items:
            $ref: '#/components/schemas/Point'
        orientation:
          type: integer
          example: -30.256437163529263
          description: >-
            Orientation of roof panel with respect to north. Value ranges
            between 0 and 360.
        area:
          type: integer
          example: 100
          description: Area of the roof in meters squared
        panels:
          type: integer
          example: 4
          description: The number of panels that can fit on this roof
        annualProductionOfSinglePanel:
          type: integer
          example: 426
          description: >-
            The estimated energy production in kWh that a single panel on this
            roof could generate in a year based on its orientation and climate
            zone.
    AnalysisRequest:
      type: object
      properties:
        ebillBase64:
          type: string
          description: Base64 Encoded native PDF Australian Domestic Electricity Bill
        address:
          type: string
          description: Australian residential property address
        minPanelGroup:
          type: number
          description: Minimum size allowed for a group of panels
          example: 4
          default: 4
        maxPanelGroup:
          type: number
          description: Mamimum size allowed for a group of panels
          example: 24
          default: Infinity
        panel:
          type: object
          description: Solar panel properties
          properties:
            width:
              type: number
              description: Width of the solar panel in meters
              example: 1
              default: 1
            height:
              type: number
              description: Height of the solar panel in meters
              example: 1.7
              default: 1.7
            tilt:
              type: number
              description: Angle/Tilt the solar panels are installed at
              example: 31
              default: 31
            gap:
              type: number
              description: Gap between the solar panels in meters
              example: 0.15
              default: 0.15
            minPercentageOnRoof:
              type: number
              description: >-
                Normaised percentage of solar panel that has to overlap the roof
                for the panel to be allowed. The output of the netural network
                isn't pixel perfect. This parameters allows some wiggle room
                when placing panels.
              example: 0.9
              default: 0.9
        continueIfPropertyDetailsFail:
          type: boolean
          description: >-
            The solar tool uses a number of data layers to provide an accurate
            evaluation. One of those data layers provides details on the
            property. If this layer fails it is possible to continue however the
            roof analysis may not be as accurate.
          default: false
        ignoreRoofsFacing:
          type: object
          description: >-
            Removes roof panels from consideration if they are facing a cardinal
            direction
          properties:
            north:
              type: boolean
              description: >-
                Remove north facing panels north. (Orientation >= 135 and <=
                225)
              example: false
              default: false
            south:
              type: boolean
              description: Remove north facing panels south. (Orientation <= 45 and >= 315)
              example: true
              default: true
            east:
              type: boolean
              description: Remove north facing panels east. (Orientation >= 225 and <= 315)
              example: false
              default: false
            west:
              type: boolean
              description: Remove north facing panels west. (Orientation >= 45 and <= 135)
              example: false
              default: false
    AnalysisResponse:
      required:
        - correlationId
        - roofs
        - propertyDetails
      type: object
      properties:
        correlationId:
          type: string
          description: The correlationId value passed into the request
        roofs:
          type: array
          items:
            $ref: '#/components/schemas/Roof'
          description: Roof panel analysis results
        propertyDetails:
          type: object
          required:
            - buildings
            - swimmingPool
            - address
            - postCode
          properties:
            buildings:
              type: array
              items:
                type: object
                properties:
                  area:
                    type: number
                    description: Area of the building
                    example: 100
                  averageEaveHeight:
                    type: number
                    description: Average height of the eave of the property
                    example: 3.2
                  estimatedLevels:
                    type: number
                    description: Estimated levels/stories of the property
                    example: 1
                  maximumRoofHeight:
                    type: number
                    description: Estimated minimum roof height of the property
                    example: 3.89
                  overhangingTrees:
                    type: boolean
                    description: Does the property have over hanging trees
                    example: false
                  roofMaterial:
                    type: string
                    description: What material is the roof made from
                    example: Tile
                  solarPanels:
                    type: boolean
                    description: Does the property have existing solar panels
                    example: true
            swimmingPool:
              type: boolean
              description: Does the property have a swimming pool
              example: true
            address:
              type: string
              description: Property address
              example: 23 Some Street, Some Suburb, NSW 2076
            postCode:
              type: string
              description: Property postcode
              example: '2000'
        propertyDetailsFailed:
          type: boolean
          description: >-
            If accessing the property details data layer failed but processing
            continued (due to the continueIfPropertyDetailsFail being set in the
            request) this flag will be true.
    QuoteRequest:
      required:
        - correlationId
      type: object
      properties:
        correlationId:
          type: string
          description: correlationId returned from valid/analysis
          example: e3c989bc-fac5-47ac-b9a7-71111111111
        panelOutput:
          type: number
          description: Output of the panel in kWh
          example: 0.35
          default: 0.35
        installationCost:
          type: number
          description: Installation cost independent of panels.
          example: 3000
          default: 3000
        stcPrice:
          type: number
          description: STC price
          example: 36
          default: 36
        feedInTariff:
          type: number
          description: >-
            Feed in tariff, in dollars, to apply to solar generation that is not
            consumed by the user
          example: 0.1
          default: 0.1
        solarPanelCost:
          type: number
          description: The cost, in dollars, of each solar panel
          example: 250
          default: 250
        consumption:
          type: number
          description: Percentage of generated power that the user will consume.
          example: 0.42
          default: 0.42
          minimum: 0
          maximum: 1
        installStaticSize:
          type: number
          description: >-
            Size, in kWh, of a static sized system to try and install on the
            roof.
          example: 6.6
        installPercentageOfConsumption:
          type: number
          description: Max fit the installation of a percentage of the user's consumption.
          minimum: 0
          maximum: 1
          example: 0.8
        fallbackSystem:
          type: array
          description: >-
            If the analysis stage failed, it is still possible to generate a
            quote using a passed in system configuration
          items:
            type: object
            required:
              - count
              - orientation
            description: Solar system description
            properties:
              count:
                type: number
                description: The number of solar panels that can fit in this group.
                example: 22
              orientation:
                type: number
                description: >-
                  Orientation of the solar panel group, with respect to due
                  north, in degrees
        billData:
          type: object
          description: >-
            For address entry some high level consumption and cost data can be
            passed to the quote. This data will be ignored if a bill was
            uploaded.
          properties:
            estimatedAnnualConsumption:
              type: number
              description: Estimated Annual Consumption in kWH
              example: 12589
            estimatedAnnualCost:
              type: number
              description: Estimated Annual Cost in dollars
              example: 4589.36
    QuoteResponse:
      required:
        - correlationId
        - quoteId
        - systemProduction
        - system
        - consumption
        - cost
        - panelCount
        - payback
        - installationSize
        - coalAvoided
        - stcCount
      type: object
      properties:
        correlationId:
          type: string
          description: The correlationId value passed into the request
        quoteId:
          type: string
          description: Unique ID for this quote
        systemProduction:
          required:
            - annualTotal
            - monthlyAverages
          type: object
          properties:
            annualTotal:
              type: integer
              example: 1906
            monthlyAverages:
              type: array
              example:
                - 27.228685015290523
                - 23.451315345699836
                - 18.906989247311817
                - 13.477428571428572
                - 9.10499231950845
                - 7.828079365079367
                - 8.569093701996932
                - 11.76125960061445
                - 15.88904761904764
                - 20.64552995391706
                - 23.19853968253966
                - 25.260752688172026
              description: Jan - Dec monthly average production
              items:
                type: integer
        system:
          type: array
          description: Solar system to be installed
          items:
            type: object
            required:
              - id
              - count
              - orientation
              - efficiency
            properties:
              id:
                type: string
                description: Unique Id for roof area
              count:
                type: number
                description: Number of solar panels to be installed on this roof area
                example: 12
              orientation:
                type: number
                description: >-
                  Orientation of roof area, with respect to due north, in
                  degrees
              efficiency:
                type: number
                description: Efficiency of the system
        consumption:
          type: object
          required:
            - annualConsumption
            - selfConsumption
          properties:
            annualConsumption:
              type: integer
            selfConsumption:
              type: integer
        cost:
          type: object
          required:
            - subtotal
            - gst
            - stc
            - annualBillSavings
            - netMonthlyCost
            - monthlyInstallments
          properties:
            subtotal:
              type: integer
              description: Cost of the solar system
              example: 2452.44
            gst:
              type: integer
              description: GST cost of the solar system
              example: 254.24
            stc:
              type: integer
              description: Cost of the STC's
              example: 547.56
            annualBillSavings:
              type: integer
              description: >-
                Savings user would have on uploaded bill if the solar system was
                installed
              example: 1200
        panelCount:
          type: integer
          description: Number of panels installed
          example: 4
        payback:
          type: integer
          example: 4.1
          description: Payback period in years & months based on the user's bill spend
        installationSize:
          type: integer
          example: 1.56
          description: Installation size in Watts
        coalAvoided:
          type: integer
          example: 2.5
          description: Tonnes of coal avoided
        stcCount:
          type: integer
          description: Number of STC's
          example: 14.1
    ErrorResponse:
      required:
        - errorCode
        - errorMessage
      type: object
      properties:
        errorCode:
          type: number
          description: >
            * `1000` - Property already has solar

            * `1001` - This service is not currently available in the
            ${DISTRIBUTOR} network

            * `1100` - Cannot find weather station

            * `1101` - Error finding closest weather station

            * `1102` - Error finding closest major city

            * `1200` - Invalid address

            * `1201` - Invalid Postcode

            * `1202` - Invalid property type

            * `1203` - No building data found for address

            * `1300` - Failed to retrieve bill details

            * `1301` - Failed to retrieve quote

            * `1302` - Failed to retrieve analysis

            * `1303` - Failed to retrieve satellite photograph

            * `1304` - Failed to retrieve arial photograph

            * `1305` - Failed to generate quote

            * `1400` - Error extracting bill

            * `1401` - Does not seem to be domestic

            * `1402` - This is a gas bill

            * `1500` - Netural Network error
          enum:
            - 1000
            - 1001
            - 1100
            - 1101
            - 1102
            - 1200
            - 1201
            - 1202
            - 1203
            - 1300
            - 1301
            - 1302
            - 1303
            - 1304
            - 1305
            - 1400
            - 1401
            - 1402
            - 1500
          example: 1000
        errorMessage:
          type: string
          description: Error text
