openapi: 3.0.0
info:
  version: '1.8'
  title: SRECTrade API
  description: >

    Access data from your SRECTrade account using API calls.

    You can generate an API key for your user on SRECTrade’s <a
    href="https://www.srectrade.com/app/api_access/manage">API Access page</a>.
    The API key is linked to a user and an account, and has the same rights as
    the user on the account.

    When calling SRECTrade API use that API key to set the Bearer Token
    authentication header.
  contact:
    email: developers@srectrade.com
servers:
  - url: https://www.srectrade.com/app/api/v1
security:
  - BearerAuth: []
tags:
  - name: Market
    description: Operations related to market data and pricing
  - name: Facilities
    description: Operations related to facilities registration.
  - name: Clean Transportation
    description: Operations related to Clean Transportation.
paths:
  /market_pricing:
    get:
      tags:
        - Market
      summary: Market Pricing
      operationId: searchMarket
      description: >-
        Get market pricing. The data available depends on the Insight
        subscription and is the same than the one available on Insight page on
        SRECTrade.com.
      parameters:
        - in: query
          name: state
          description: |
            Search market pricing by state
            Example: PA
          required: false
          schema:
            type: string
        - in: query
          name: product
          description: |
            Search market pricing by product
            Example: PA2018
          required: false
          style: form
          explode: false
          schema:
            type: array
            items:
              type: string
        - in: query
          name: type
          description: |
            Search market pricing by type bid or offer
              - bid
              - offer
          required: false
          schema:
            type: string
        - in: query
          name: start_date
          description: |
            Search market pricing after that date
            Example: 2017-10-01
          required: false
          schema:
            type: string
        - in: query
          name: end_date
          description: |
            Search market pricing before that date
            Example: 2017-12-01
          required: false
          schema:
            type: string
        - in: query
          name: page
          description: Indicate which page will be returned if the result is paginated
          required: false
          schema:
            type: integer
      responses:
        '200':
          description: >-
            List of market pricing available for the user and matching search
            criteria
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/MarketPricingItem'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/response401'
  /facilities/{facility_id}:
    get:
      summary: Facility
      description: >-
        Retrieve detailed information about a facility by its ID, including
        owner, installer, and certification data.
      operationId: getFacilityById
      tags:
        - Facilities
      parameters:
        - name: facility_id
          in: path
          required: true
          description: ID of the facility to retrieve
          schema:
            type: integer
      responses:
        '200':
          description: Facility data retrieved successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FacilityResponse'
        '400':
          description: Invalid facility ID provided or facility not found
          content:
            application/json:
              schema:
                type: object
                properties:
                  url:
                    type: string
                    example: /app/api/v1/facilities/13023522
                  date:
                    type: string
                    format: date-time
                    example: 2024-09-17 07:07:53 EDT
                  code:
                    type: integer
                    example: 404
                  elements:
                    type: integer
                    example: 0
                  page:
                    type: string
                    example: 1 of 1
                  data:
                    type: object
                    properties:
                      error:
                        type: string
                        example: error
                      message:
                        type: string
                        example: facility not found
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/response401'
  /facilities:
    get:
      operationId: getFacilityListForAccount
      tags:
        - Facilities
      summary: Facilities
      description: >-
        Retrieve the list of facilities in your SRECTrade account with
        pagination.
      parameters:
        - name: per_page
          in: query
          description: >-
            Number of facilities to display per page. If a value greater than
            1000 is provided, it will be coerced to 1000.
          required: false
          schema:
            type: integer
            default: 50
            minimum: 1
            maximum: 1000
        - name: page
          in: query
          description: The current page number
          required: false
          schema:
            type: integer
            default: 1
            minimum: 1
      responses:
        '200':
          description: Successfully retrieved facilities
          content:
            application/json:
              schema:
                type: object
                properties:
                  url:
                    type: string
                    example: app/api/v1/facilities?per_page=2&page=2
                  date:
                    type: string
                    format: date-time
                    example: 2024-10-04 05:23:08 EDT
                  code:
                    type: integer
                    example: 200
                  elements:
                    type: integer
                    description: Number of elements on the current page
                    example: 2
                  page:
                    type: integer
                    description: Current page number
                    example: 2
                  pagination:
                    $ref: '#/components/schemas/Pagination'
                  data:
                    type: array
                    items:
                      $ref: '#/components/schemas/FacilityListDetails'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/response401'
    post:
      operationId: createFacility
      tags:
        - Facilities
      summary: Facilities
      description: Create new facility.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/postFacilityCreate'
        required: true
      responses:
        '200':
          description: Facility created successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/postFacilityCreateResponse200'
        '400':
          description: Bad request - authorization or validation errors
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/response400'
        '403':
          description: Internal error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/response403'
        '500':
          description: Internal error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/response500'
  /facilities/{facility_id}/state_eligibilities:
    get:
      operationId: getFacilityStateEligibilities
      tags:
        - Facilities
      summary: State Eligibilities
      description: Retrieve the state eligibility information for a facility.
      parameters:
        - name: facility_id
          in: path
          required: true
          description: The ID of the facility to fetch eligibility details for.
          schema:
            type: integer
            example: 130240
      responses:
        '200':
          description: Successful response with state eligibility details.
          content:
            application/json:
              schema:
                type: object
                properties:
                  url:
                    type: string
                    example: /app/api/v1/state_eligibilities/facility/130240
                  date:
                    type: string
                    format: date-time
                    example: 2024-06-20 07:11:26 EDT
                  code:
                    type: integer
                    example: 200
                  elements:
                    type: integer
                    example: 2
                  page:
                    type: string
                    example: 1 of 1
                  data:
                    type: object
                    properties:
                      status:
                        type: string
                        example: success
                      data:
                        type: array
                        items:
                          type: object
                          properties:
                            state:
                              type: string
                              example: PA
                            is_eligible:
                              type: boolean
                              example: true
                            product_type:
                              type: string
                              example: Tier-I
                            documents:
                              type: array
                              items:
                                type: object
                                properties:
                                  name:
                                    type: string
                                    example: Photo of Solar Meter
                                  required:
                                    type: boolean
                                    example: true
                                  filetype:
                                    type: string
                                    example: png|gif|jpg|pdf|jpeg
                            errors:
                              type: array
                              items:
                                type: string
                                example: >-
                                  A revenue grade meter is required to be
                                  eligible in this state
        '400':
          description: Bad Request - The request was invalid or cannot be otherwise served.
          content:
            application/json:
              schema:
                type: object
                properties:
                  url:
                    type: string
                    example: /app/api/v1/state_eligibilities/facility
                  date:
                    type: string
                    format: date-time
                    example: 2024-06-20 07:29:48 EDT
                  code:
                    type: integer
                    example: 400
                  elements:
                    type: integer
                    example: 0
                  page:
                    type: string
                    example: 1 of 1
                  data:
                    type: object
                    properties:
                      error:
                        type: string
                        example: error
                      message:
                        type: string
                        example: missing facility_id parameter
        '404':
          description: Not Found - The requested facility was not found.
          content:
            application/json:
              schema:
                type: object
                properties:
                  url:
                    type: string
                    example: /app/api/v1/state_eligibilities/facility/130240
                  date:
                    type: string
                    format: date-time
                    example: 2024-06-20 07:28:33 EDT
                  code:
                    type: integer
                    example: 404
                  elements:
                    type: integer
                    example: 0
                  page:
                    type: string
                    example: 1 of 1
                  data:
                    type: object
                    properties:
                      error:
                        type: string
                        example: error
                      message:
                        type: string
                        example: wrong facility_id parameter
  /facilities/{facility_id}/state_applications:
    post:
      operationId: createFacilityStateApplication
      tags:
        - Facilities
      summary: State Application
      description: Apply to a new state to be certified to generate RECs.
      parameters:
        - name: facility_id
          in: path
          required: true
          description: The ID of the facility linked to the new application.
          schema:
            type: integer
            example: 130240
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - state
              properties:
                state:
                  type: string
                  maxLength: 2
                  example: PA
        required: true
      responses:
        '200':
          description: State application created successfully for the given state
          content:
            application/json:
              schema:
                type: object
                properties:
                  url:
                    type: string
                    example: /app/api/v1/facilities/1234/state_applications
                  date:
                    type: string
                    example: 2024-04-30 10:02:28 EDT
                  code:
                    type: integer
                    example: 200
                  elements:
                    type: integer
                    example: 0
                  page:
                    type: string
                    example: 1 of 1
                  data:
                    type: object
                    properties:
                      application_id:
                        type: integer
                        example: 12345
        '400':
          description: Bad request - authorization or validation errors
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/response400'
        '500':
          description: Internal error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/response500'
  /facilities/{facility_id}/state_certifications:
    post:
      operationId: addFacilityStateCertification
      tags:
        - Facilities
      summary: State Certifications
      description: >-
        Add state certificates to a facility. This endpoint is accessible for
        certain user only. If you want to use it, please contact SRECTrade.
      parameters:
        - name: facility_id
          in: path
          required: true
          description: The ID of the facility linked to the state certification.
          schema:
            type: integer
            example: 130240
      requestBody:
        content:
          application/json:
            schema:
              type: object
              required:
                - state
              properties:
                certificates:
                  type: array
                  items:
                    minItems: 1
                    type: object
                    required:
                      - state
                      - state_certification_number
                    properties:
                      state:
                        type: string
                        maxLength: 2
                        example: PA
                      state_certification_number:
                        type: string
                        example: PA-1234567-SUN-I
        required: true
      responses:
        '200':
          description: State certification created successfully for the given state
          content:
            application/json:
              schema:
                type: object
                properties:
                  url:
                    type: string
                    example: /app/api/v1/facilities/1234/state_applications
                  date:
                    type: string
                    example: 2024-04-30 10:02:28 EDT
                  code:
                    type: integer
                    example: 200
                  elements:
                    type: integer
                    example: 0
                  page:
                    type: string
                    example: 1 of 1
                  data:
                    type: object
                    properties: {}
        '400':
          description: Bad request - authorization or validation errors
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/response400'
        '500':
          description: Internal error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/response500'
  /facilities/{facility_id}/documents:
    post:
      operationId: uploadFacilityDocuments
      tags:
        - Facilities
      summary: Facilities Documents
      description: Upload documents related to a facility.
      parameters:
        - name: facility_id
          in: path
          required: true
          schema:
            type: string
          description: The ID of the facility
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                state:
                  type: string
                  description: >-
                    The state of the application. If post documents are related
                    to a state application, please provide the state of the
                    application. If the facility is already certified and the
                    post documents are not related to a state application then
                    the state parameter should not be set.
                schedule_a:
                  type: string
                  format: binary
                  description: Schedule A document
              additionalProperties:
                type: string
                format: binary
                description: Files with dynamic keys
              example:
                state: OH
                photo_of_solar_meter: file content
                schedule_a: file content
                certificate_of_completion: file content
      responses:
        '200':
          description: Documents uploaded successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/uploadFacilityDocumentsResponse'
              examples:
                example-1:
                  value:
                    url: app/api/v1/facilities/130375/documents
                    date: 2024-07-18 04:04:33 EDT
                    code: 200
                    elements: 2
                    page: 1 of 1
                    data:
                      status: success
                      data:
                        uploaded: 3
                        errors: []
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/response401'
  /ct/assets:
    post:
      operationId: createAsset
      tags:
        - Clean Transportation
      summary: Create asset
      description: Create new Asset.
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/postAssetCreate'
        required: true
      responses:
        '201':
          description: Asset created successfully
          content:
            application/json:
              schema:
                type: object
                properties:
                  url:
                    type: string
                    example: /app/api/v1/ct/assets
                  date:
                    type: string
                    example: 2025-08-30 10:02:28 EDT
                  code:
                    type: integer
                    example: 201
                  elements:
                    type: integer
                    example: 0
                  page:
                    type: string
                    example: 1 of 1
                  data:
                    type: object
                    properties:
                      status:
                        type: string
                        example: asset created
        '400':
          description: Bad Request - Invalid input data
          content:
            application/json:
              schema:
                type: object
                properties:
                  url:
                    type: string
                    example: /app/api/v1/ct/assets
                  date:
                    type: string
                    example: 2025-08-30 10:02:28 EDT
                  code:
                    type: integer
                    example: 400
                  elements:
                    type: integer
                    example: 0
                  page:
                    type: string
                    example: 1 of 1
                  data:
                    type: object
                    properties: {}
                    additionalProperties:
                      type: string
                      description: Error message for the field.
                    example:
                      asset_fse_id: The asset_fse_id FSE12345EE6 already exists.
                      reporting_method_id: The reporting_method_id field is required.
                      address_latitude: >-
                        The address_latitude value is not valid within United
                        States limits. It should be within the range of 7.2 and
                        83.7.
              examples:
                validation-error-1:
                  value:
                    url: /app/api/v1/ct/assets
                    date: 2025-08-30 10:02:28 EDT
                    code: 400
                    elements: 0
                    page: 1 of 1
                    data:
                      asset_fse_id: The asset_fse_id FSE12345EE6 already exists.
                      reporting_method_id: The reporting_method_id field is required.
                validation-error-2:
                  value:
                    url: /app/api/v1/ct/assets
                    date: 2025-08-30 10:03:45 EDT
                    code: 400
                    elements: 0
                    page: 1 of 1
                    data:
                      address_latitude: >-
                        The address_latitude value is not valid within United
                        States limits. It should be within the range of 7.2 and
                        83.7.
                      asset_serial_number: The asset_serial_number field is required.
                error:
                  value:
                    url: /app/api/v1/ct/assets
                    date: 2025-08-30 10:03:45 EDT
                    code: 400
                    elements: 0
                    page: 1 of 1
                    data:
                      error: error
                      message: Error when creating new asset
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  url:
                    type: string
                    format: uri
                    example: /app/api/v1/ct/assets
                  date:
                    type: string
                    example: 2024-08-30 10:02:28 EDT
                  code:
                    type: integer
                    example: 401
                  elements:
                    type: integer
                  page:
                    type: string
                    example: 1 of 1
                  data:
                    type: object
                    properties:
                      error:
                        type: string
                        example: connection_failed
                      message:
                        type: string
                        example: Authentication error
        '500':
          description: Internal error
          content:
            application/json:
              schema:
                type: object
                properties:
                  url:
                    type: string
                    example: /app/api/v1/ct/assets
                  date:
                    type: string
                    example: 2024-08-30 10:02:28 EDT
                  code:
                    type: integer
                    example: 500
                  elements:
                    type: integer
                    example: 0
                  page:
                    type: string
                    example: 1 of 1
                  data:
                    type: object
                    properties:
                      error:
                        type: string
                        example: internal_error
                      message:
                        type: string
                        example: Error description
  /ct/company_entities:
    get:
      operationId: getCompanyEntities
      tags:
        - Clean Transportation
      summary: Company Entities
      description: Retrieve list of company entities.
      responses:
        '200':
          description: List of company entities
          content:
            application/json:
              schema:
                type: object
                properties:
                  url:
                    type: string
                    example: /app/api/v1/ct/company_entities
                  date:
                    type: string
                    example: 2025-08-25 07:51:26 EDT
                  code:
                    type: integer
                    example: 200
                  elements:
                    type: integer
                    example: 1
                  page:
                    type: string
                    example: 1 of 1
                  data:
                    type: array
                    items:
                      type: object
                      properties:
                        entity_id:
                          type: string
                          example: '172'
                        entity_name:
                          type: string
                          example: Example entity name
                        entity_fein:
                          type: string
                          example: '123456789'
                        entity_agreement:
                          type: string
                          example: 6363fac17cfaf0_1234567.pdf
                        address:
                          type: object
                          properties:
                            address_id:
                              type: integer
                              example: 18353
                            address_street:
                              type: string
                              example: 1234 Shattuck Avenue
                            address_city:
                              type: string
                              example: Berkeley
                            address_zip:
                              type: string
                              example: '94704'
                            address_state:
                              type: string
                              example: CA
                            address_country:
                              type: string
                              example: US
                        contact:
                          type: object
                          properties:
                            contact_id:
                              type: string
                              example: '12345'
                            contact_name:
                              type: string
                              example: John Doe
                            contact_email:
                              type: string
                              example: test.address@example.com
                            contact_phone:
                              type: string
                              example: '123456789'
                            contact_date_created:
                              type: string
                              example: '2024-10-26 13:30:24'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                type: object
                properties:
                  url:
                    type: string
                    format: uri
                    example: /app/api/v1/ct/company_entities
                  date:
                    type: string
                    example: 2025-08-30 10:02:28 EDT
                  code:
                    type: integer
                    example: 401
                  elements:
                    type: integer
                  page:
                    type: string
                    example: 1 of 1
                  data:
                    type: object
                    properties:
                      error:
                        type: string
                        example: connection_failed
                      message:
                        type: string
                        example: Authentication error
        '500':
          description: Internal error
          content:
            application/json:
              schema:
                type: object
                properties:
                  url:
                    type: string
                    example: /app/api/v1/ct/company_entities
                  date:
                    type: string
                    example: 2025-08-30 10:02:28 EDT
                  code:
                    type: integer
                    example: 500
                  elements:
                    type: integer
                    example: 0
                  page:
                    type: string
                    example: 1 of 1
                  data:
                    type: object
                    properties:
                      error:
                        type: string
                        example: internal_error
                      message:
                        type: string
                        example: Error description
components:
  schemas:
    MarketPricingItem:
      type: object
      required:
        - product
        - date
      properties:
        product:
          type: string
          example: PA2018
        date:
          type: string
          example: '2017-10-20'
        bid_price:
          type: number
          example: 5.5
        offer_price:
          type: number
          example: 6.5
    Pagination:
      type: object
      properties:
        total:
          type: integer
          description: Total number of facilities
          example: 7
        per_page:
          type: integer
          description: Number of facilities per page
          example: 2
        current_page:
          type: integer
          description: Current page number
          example: 2
        last_page:
          type: integer
          description: The last available page number
          example: 4
    FacilityResponse:
      type: object
      properties:
        url:
          type: string
          example: /app/api/v1/facilities/130235
        date:
          type: string
          format: date-time
          example: 2024-09-17 04:26:39 EDT
        code:
          type: integer
          example: 200
        elements:
          type: integer
          example: 2
        page:
          type: string
          example: 1 of 1
        data:
          type: array
          items:
            $ref: '#/components/schemas/FacilityDetails'
    FacilityDetails:
      type: object
      properties:
        facility_id:
          type: integer
          example: 130235
        name:
          type: string
          nullable: true
          example: test API facility name
        energy_type:
          type: string
          nullable: true
          example: Solar Photovoltaic
        facility_size:
          type: number
          format: float
          nullable: true
          example: 1.5713
        facility_type:
          type: string
          nullable: true
          example: RES
        facility_type_long:
          type: string
          nullable: true
          example: Residential
        usable_energy:
          type: number
          format: float
          example: 12.34
        system_cost:
          nullable: true
          type: number
          format: float
          example: 12345
        is_battery_backup:
          type: boolean
          example: false
        system_leased:
          type: boolean
          example: false
        referrer_company:
          type: string
          nullable: true
          example: test - Bayer, Jast and Champlin
        registry:
          $ref: '#/components/schemas/Registry'
        address:
          $ref: '#/components/schemas/Address'
        owner:
          $ref: '#/components/schemas/Owner'
        installer:
          $ref: '#/components/schemas/Installer'
        panels:
          type: array
          items:
            $ref: '#/components/schemas/Panel'
        inverters:
          type: array
          items:
            $ref: '#/components/schemas/Inverter'
        meter:
          $ref: '#/components/schemas/Meter'
        state_certifications:
          type: array
          items:
            $ref: '#/components/schemas/StateCertification'
    FacilityListDetails:
      type: object
      properties:
        facility_id:
          type: integer
          example: 130235
        name:
          type: string
          nullable: true
          example: test API facility name
        energy_type:
          type: string
          nullable: true
          example: Solar Photovoltaic
        facility_size:
          type: number
          format: float
          nullable: true
          example: 1.5713
        facility_type:
          type: string
          nullable: true
          example: RES
        facility_type_long:
          type: string
          nullable: true
          example: Residential
        usable_energy:
          type: number
          format: float
          example: 12.34
        system_cost:
          nullable: true
          type: number
          format: float
          example: 12345
        is_battery_backup:
          type: boolean
          example: false
        system_leased:
          type: boolean
          example: false
        referrer_company:
          type: string
          nullable: true
          example: test - Bayer, Jast and Champlin
        registry:
          $ref: '#/components/schemas/Registry'
        address:
          $ref: '#/components/schemas/Address'
        owner:
          $ref: '#/components/schemas/Owner'
        installer:
          $ref: '#/components/schemas/Installer'
    Address:
      type: object
      properties:
        street:
          type: string
          nullable: true
          example: 492 Darby Rd
        apartment:
          type: string
          nullable: true
          example: null
        city:
          type: string
          nullable: true
          example: Yorktown
        county:
          type: string
          nullable: true
          example: null
        state:
          type: string
          nullable: true
          example: VA
        zip:
          type: string
          nullable: true
          example: 23693
    Owner:
      type: object
      properties:
        first_name:
          type: string
          nullable: true
          example: Isaac
        last_name:
          type: string
          nullable: true
          example: Doe
        email:
          type: string
          nullable: true
          example: test@example.com
        phone:
          type: string
          nullable: true
          example: 122-223-3321
        company_name:
          type: string
          nullable: true
          example: test name Towne Inc
        address:
          $ref: '#/components/schemas/Address'
    Installer:
      type: object
      properties:
        company:
          type: string
          nullable: true
          example: test - Conn - Kulas
        first_name:
          type: string
          nullable: true
          example: Leola
        last_name:
          type: string
          nullable: true
          example: Doe
        email:
          type: string
          nullable: true
          example: Josue59@example.com
        phone:
          type: string
          nullable: true
          example: 987-223-7611
        address:
          $ref: '#/components/schemas/Address'
    Panel:
      type: object
      properties:
        array_id:
          type: integer
          example: 189624
        location:
          type: string
          nullable: true
          example: Roof
        tracking:
          type: string
          nullable: true
          example: Fixed
        array_orientation_azimuth:
          type: number
          format: float
          nullable: true
          example: 320
        array_tilt:
          type: number
          format: float
          nullable: true
          example: 80
        number_of_panels:
          type: integer
          nullable: true
          example: 3
        manufacturer:
          type: string
          nullable: true
          example: null
        model_type:
          type: string
          nullable: true
          example: test
        rating_dc:
          type: number
          format: float
          nullable: true
          example: 230.1
    Inverter:
      type: object
      properties:
        id:
          type: integer
          example: 107060
        number_of_inverters:
          type: integer
          nullable: true
          example: 2
        manufacturer:
          type: string
          nullable: true
          example: Agepower Limit
        model_type:
          type: string
          nullable: true
          example: >-
            Agepower AP 20000 TL3-US (20000W (277Vac) Utility Interactive
            Inverter)
        inverter_capacity_kw:
          type: number
          format: float
          nullable: true
          example: 2.23
    Meter:
      type: object
      properties:
        id:
          type: integer
          nullable: true
          example: 113521
        accuracy:
          type: string
          nullable: true
          example: standard
        serial_number:
          type: string
          nullable: true
          example: SE704
        model_type:
          type: string
          nullable: true
          example: Test
        manufacturer:
          type: string
          nullable: true
          example: Test2
        operation_start:
          type: string
          format: date
          nullable: true
          example: '2024-03-01'
        last_date_certification:
          type: string
          format: date
          nullable: true
          example: '2024-02-10'
        utility_name:
          type: string
          nullable: true
          example: Virginia Electric & Power Co
        utility_account_number:
          type: string
          nullable: true
          example: 234567
        reading_at_interconnection:
          type: number
          format: float
          nullable: true
          example: 2
        utility_interconnection_date:
          type: string
          format: date
          nullable: true
          example: '2024-03-01'
        current_production_reading:
          type: number
          format: float
          nullable: true
          example: 12.321
        date_of_production_reading:
          type: string
          format: date
          nullable: true
          example: '2024-05-14'
        remote_data_collector:
          type: string
          nullable: true
          example: enphase
        online_monitoring_api_id:
          type: string
          nullable: true
          example: 234567
    Registry:
      type: object
      properties:
        registry:
          type: string
          nullable: true
          example: GATS
        registry_id_number:
          type: string
          nullable: true
          example: NON00220
    StateCertification:
      type: object
      properties:
        id:
          type: integer
          example: 181904
        state_abbreviation:
          type: string
          example: DC
        certification_number:
          type: string
          nullable: true
          example: DC-426425-SUN-I
    postAssetCreate:
      type: object
      required:
        - entity_id
        - asset_name
        - address_street
        - address_city
        - address_zip
        - address_state
        - address_country
        - address_latitude
        - address_longitude
        - class_type_id
        - asset_serial_number
        - charging_type_id
        - manufacturer_name
        - asset_fse_id
        - asset_registration_upload_id
        - reporting_method_id
        - asset_start_date
        - asset_end_date
        - electricity_source_id
      properties:
        entity_id:
          type: string
          description: Unique identifier for the entity
          example: '150'
        asset_name:
          type: string
          description: Name of the asset; can include dynamic placeholders
          example: Test asset
        address_street:
          type: string
          description: Street address of the asset
          example: 40270 GLENALDER PLACE
        address_city:
          type: string
          description: City where the asset is located
          example: Squamish
        address_zip:
          type: string
          description: ZIP or postal code
          example: '12345'
        address_state:
          type: string
          description: State or province
          example: CA
        address_country:
          type: string
          description: Country code (ISO format)
          example: US
        address_latitude:
          type: string
          description: Latitude coordinate; can include dynamic placeholders
          example: '55.391234'
        address_lonegitude:
          type: string
          description: Longitude coordinate; can include dynamic placeholders
          example: '-92.75123'
        class_type_id:
          type: array
          items:
            type: integer
          description: List of class type IDs associated with the asset
          example:
            - 3
        asset_serial_number:
          type: string
          description: Serial number for the asset; can include dynamic placeholders
          example: '2025410189123'
        charging_type_id:
          type: integer
          description: Identifier for the charging type
          example: 3
        manufacturer_name:
          type: string
          description: Name of the manufacturer
          example: ABCD company
        asset_status_id:
          type: string
          description: Status ID of the asset
          example: '4'
        asset_fse_id:
          type: string
          description: FSE ID
          example: FSE413000EE2
        asset_fse_code:
          type: string
          description: Code representing the FSE
          example: Test FSE code
        asset_registration_upload_id:
          type: string
          description: Unique registration upload ID; can include placeholders
          example: RUZ-781234
        asset_method_of_kwh:
          type: string
          description: Method used to measure kWh
          example: akhdkajh
        asset_charging_data_source:
          type: string
          description: Source of charging data
          example: Test
        reporting_method_id:
          type: string
          description: ID of the reporting method
          example: '2'
        asset_lcfs_lff_id:
          type: string
          description: LCFS (Low Carbon Fuel Standard) LFF ID
          example: '1'
        asset_lcfs_facility_name:
          type: string
          description: Name of the LCFS facility
          example: test
        asset_start_date:
          type: string
          format: date
          description: Asset start date in YYYY-MM-DD format
          example: '2021-07-01'
        asset_end_date:
          type: string
          format: date
          description: Asset end date in YYYY-MM-DD format
          example: '2026-11-02'
        asset_rp_name:
          type: string
          description: Reporting party or responsible person/entity name
          example: test
        electricity_source_id:
          type: integer
          description: ID representing the source of electricity
          example: 3
    postFacilityCreate:
      type: object
      required:
        - name
        - i_am_owner
        - i_have_solar_production_meter
        - facility_type
        - facility_size
        - street
        - city
        - county
        - zip
        - state
        - installer_company
        - referrer_company
        - owner_first_name
        - owner_last_name
        - owner_street
        - owner_city
        - owner_state
        - owner_zip
        - owner_phone
        - owner_county
        - system_cost
        - meter_manufacturer
        - meter_model_type
        - utility_interconnection_date
        - utility_name
        - utility_account_number
      properties:
        name:
          type: string
          maxLength: 80
          example: Facility name
        i_am_owner:
          type: integer
          enum:
            - 0
            - 1
          example: 1
        i_have_solar_production_meter:
          type: integer
          enum:
            - 0
            - 1
          example: 1
        facility_type:
          type: string
          enum:
            - RES
            - COM
            - MUNI
            - CMTY
          example: RES
          description: |
            Possible values are:
            - RES (Residential)
            - COM (Commercial)
            - MUNI (Municipal)
            - CMTY (Community Solar)
        facility_size:
          description: Facility size (DC kW)
          type: number
          multipleOf: 0.000001
          minimum: 0.000001
          example: 5.657
        is_battery_backup:
          type: integer
          enum:
            - 0
            - 1
          default: 0
          example: 1
        usable_energy:
          type: number
          multipleOf: 0.000001
          minimum: 0.000001
          example: 2.36
        street:
          type: string
          maxLength: 80
          example: 7312 Random Street
        apartment_suite:
          type: string
          maxLength: 80
        city:
          type: string
          maxLength: 80
          example: Yorktown
        county:
          type: string
          maxLength: 80
          example: York County
        zip:
          type: string
          example: 24567
        state:
          type: string
          example: VA
        installer_company:
          type: string
          maxLength: 100
          example: Installer company name
        installer_first_name:
          type: string
          maxLength: 80
          example: John
        installer_last_name:
          type: string
          maxLength: 80
          example: Doe
        installer_email:
          type: string
          maxLength: 100
          example: contact@email.com
        installer_phone:
          type: string
          example: 123-123-1234
        installer_street:
          type: string
          maxLength: 80
          example: 7312 Random Street
        installer_apartment_suite:
          type: string
          maxLength: 80
        installer_city:
          type: string
          maxLength: 80
          example: Yorktown
        installer_county:
          type: string
          maxLength: 80
          example: York County
        installer_state:
          type: string
          example: VA
        installer_zip:
          type: string
          example: 23693
        referrer_company:
          type: string
          maxLength: 100
          example: Referrer company name
        system_leased:
          type: integer
          enum:
            - 0
            - 1
          example: 0
        hostname:
          type: string
          maxLength: 80
          example: Host name
        owner_first_name:
          type: string
          example: John
        owner_last_name:
          type: string
          example: Doe
        owner_company_name:
          type: string
          example: Owner company name
        owner_email:
          type: string
          maxLength: 100
          example: owner@email.com
        owner_street:
          type: string
          maxLength: 80
          example: 7312 Random Street
        owner_apartment_suite:
          type: string
          maxLength: 80
        owner_city:
          type: string
          maxLength: 80
          example: Yorktown
        owner_state:
          type: string
          example: VA
        owner_zip:
          type: string
          example: 23693
        owner_phone:
          type: string
          example: 122-223-3321
        owner_county:
          type: string
          maxLength: 80
          example: York County
        registry_id_number:
          type: string
          minLength: 4
          maxLength: 10
          example: 122-2234
        system_cost:
          type: integer
          minimum: 1
          example: 12345
        facility_location_type:
          type: string
          enum:
            - Rooftop
            - Parking canopy
            - Brownfield
            - Other
          example: Rooftop
        aggregate_net_metering:
          type: boolean
          example: true
        colocated_facility:
          type: boolean
          example: true
        cmty_application_number:
          type: string
          maxLength: 100
        meter_manufacturer:
          type: string
          example: AstroPower
        meter_model_type:
          type: string
          example: GTY-7676
        meter_accuracy:
          type: string
          enum:
            - revenue
            - standard
          example: revenue
          description: |
            - 'revenue' if the meter is a Revenue Grade Meter
            - 'standard' if the meter is not a Revenue Grade Meter
        meter_serial_number:
          type: string
          maxLength: 50
          example: 12345
        meter_last_date_certification:
          type: string
          example: '2016-08-02T00:00:00.000Z'
        meter_remote_data_collector:
          type: string
          example: Enphase
        online_monitoring_api_id:
          type: string
          example: 123456
        operation_start_date:
          type: string
          example: '2018-10-17T00:00:00.000Z'
        utility_interconnection_date:
          type: string
          example: '2018-10-17T00:00:00.000Z'
        reading_at_interconnection:
          type: number
          maxLength: 11
          minimum: 0
          example: 39.95
        current_production_reading:
          type: number
          minimum: 0
          example: 39.95
        date_of_production_reading:
          type: string
          example: '2018-10-17T00:00:00.000Z'
        comment_box:
          type: string
        utility_name:
          type: string
          description: Should be a valid utility for the county
        utility_account_number:
          type: string
          maxLength: 50
        panels:
          type: array
          items:
            $ref: '#/components/schemas/postPanelCreate'
        inverters:
          type: array
          items:
            $ref: '#/components/schemas/postInverterCreate'
    postPanelCreate:
      type: object
      required:
        - number_of_panels
        - panel_location
        - panel_rating_dc
        - panel_manufacturer
        - panel_model_type
        - tracking
        - array_tilt
        - array_orientation_azimuth
      properties:
        number_of_panels:
          type: number
          example: 5
        panel_location:
          type: string
          enum:
            - Ground
            - Roof
          example: Roof
        panel_rating_dc:
          type: number
          example: 240
          description: >-
            This is the wattage of each solar panel in W (DC). Most PV panels
            have a DC rating of between 250-400W. Numbers with up to 3 decimal
            points.
        panel_manufacturer:
          type: string
          example: Solartech Energy
        panel_model_type:
          type: string
          example: ASC-6M-72-295-3BB (295W Monocrystalline Module)
        tracking:
          type: string
          enum:
            - Fixed
            - '1'
            - '2'
          example: '1'
          description: >-
            Fixed for a stationary solar panel facility; 1 if single-axis
            tracking; 2 if double-axis tracking
        array_tilt:
          type: number
          example: 160
          description: >-
            Enter only numbers representing directional degrees, for example
            North = 0°, East = 90°, South = 180°, West = 270° Array orientation
            values typically fall between 90° and 270°
        array_orientation_azimuth:
          type: number
          example: 35
          description: >-
            Enter only numbers representing directional degrees where Horizontal
            = 0°, Vertical = 90° Array tilt values typically fall between 15°
            and 40°
    postInverterCreate:
      type: object
      required:
        - number_of_inverters
        - inverter_capacity_kw
        - inverter_manufacturer
        - inverter_model_type
      properties:
        number_of_inverters:
          type: number
          example: 5
        inverter_capacity_kw:
          type: number
          example: 4.6
          description: >-
            Max AC output of each inverter in kW (AC). Numbers with up to 6
            decimal points.
        inverter_manufacturer:
          type: string
          example: SunPower
        inverter_model_type:
          type: string
          example: SPR-4600 (4600W (208Vac) Utility Interactive Inverter)
    postFacilityCreateResponse200:
      type: object
      properties:
        url:
          type: string
          example: /app/api/v1/facilities
        date:
          type: string
          example: 2024-04-30 10:02:28 EDT
        code:
          type: integer
          example: 200
        elements:
          type: integer
          example: 0
        page:
          type: string
          example: 1 of 1
        data:
          type: object
          properties:
            facility_id:
              type: integer
              example: 12345
            facility_data:
              $ref: '#/components/schemas/FacilityDetails'
    uploadFacilityDocumentsResponse:
      type: object
      properties:
        url:
          type: string
          example: /app/api/v1/facilities/130375/documents
        date:
          type: string
          example: 2024-07-18 04:04:33 EDT
        code:
          type: integer
          example: 200
        elements:
          type: integer
          example: 2
        page:
          type: string
          example: 1 of 1
        data:
          type: object
          properties:
            status:
              type: string
              example: success
            data:
              type: object
              properties:
                uploaded:
                  type: integer
                  example: 3
                errors:
                  type: array
                  items:
                    type: string
                  example: []
    response400:
      type: object
      properties:
        url:
          type: string
          example: /app/api/v1/facilities
        date:
          type: string
          example: 2024-04-30 10:02:28 EDT
        code:
          type: integer
          example: 400
        elements:
          type: integer
          example: 0
        page:
          type: string
          example: 1 of 1
        data:
          type: object
          properties:
            error:
              type: string
              example: validation_error
            message:
              type: string
              example: Errors when validating data
            data:
              type: object
              properties:
                name:
                  type: string
                  example: The name field is required.
                contact_phone:
                  type: string
                  example: 321 is not a valid US Phone number format.
                registry_id_number:
                  type: string
                  example: >-
                    The registry_id_number field must be at least 4 characters
                    in length.
    response401:
      type: object
      properties:
        url:
          type: string
          format: uri
        date:
          type: string
          format: date-time
        code:
          type: integer
          example: 401
        elements:
          type: integer
        page:
          type: string
          example: 1 of 1
        data:
          type: object
          properties:
            error:
              type: string
              example: connection_failed
            message:
              type: string
              example: Authentication error
    response403:
      type: object
      properties:
        url:
          type: string
          format: uri
        date:
          type: string
          format: date-time
        code:
          type: integer
          example: 403
        elements:
          type: integer
        page:
          type: string
        data:
          type: object
          properties:
            error:
              type: string
              example: access forbidden
            message:
              type: string
              example: Authentication error
    response500:
      type: object
      properties:
        url:
          type: string
          example: /app/api/v1/facilities
        date:
          type: string
          example: 2024-04-30 10:02:28 EDT
        code:
          type: integer
          example: 500
        elements:
          type: integer
          example: 0
        page:
          type: string
          example: 1 of 1
        data:
          type: object
          properties:
            error:
              type: string
              example: internal_error
            message:
              type: string
              example: Error description
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
