{
  "openapi": "3.0.0",
  "info": {
    "title": "V3 Portal API",
    "description": "Integration API Exposed by V3 Portal",
    "version": "1.0.0"
  },
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "paths": {
    "/api/updateStatus": {
      "post": {
        "summary": "Update the status of a contract on the portal",
        "description": "This endpoint is used by suppliers to update the status of a contract created on the portal.\nThe status change could relate to an internal workflow stage such as manual validation\nand auditing or part of the registration flow as the meter moves to the new supplier.\n \n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/UpdateStatusRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "type": "array",
                  "items": {
                    "$ref": "#/components/schemas/UpdateStatusResponse"
                  }
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/UpdateStatusResponse"
                }
              }
            }
          }
        }
      }
    },
    "/api/dataExport": {
      "get": {
        "summary": "Retrieve a data export from the portal",
        "description": "This export is used to extract data based on a predefined data template. This is used\nprimarily for retrieving data on recent contract submissions so they can be exported\nto a supplier via SFTP. Alternatively the supplier can call this endpoint directly to \npull the data themselves.\n \n",
        "parameters": [
          {
            "name": "dataTemplate",
            "in": "query",
            "description": "The name of the dataTemplate to return data from. This may vary by supplier depending\non if there are different data templates for gas/elec and acquisition/renewal.\n",
            "required": false,
            "schema": {
              "type": "string",
              "enum": [
                "SubmittedAcquisitionElecContractsAwaitingExport",
                "SubmittedAcquisitionGasContractsAwaitingExport",
                "SubmittedRenewalElecContractsAwaitingExport",
                "SubmittedRenewalGasContractsAwaitingExport"
              ]
            }
          },
          {
            "name": "showTestSites",
            "in": "query",
            "description": "Test sites added via POWWR will be visible if set to true\n",
            "required": false,
            "schema": {
              "type": "boolean"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/inline_response_200"
                }
              }
            }
          },
          "204": {
            "description": "No data available"
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "UpdateStatusRequest": {
        "type": "object",
        "properties": {
          "meterIdentifierType": {
            "type": "string",
            "description": "This signifies  the type of the provided meter identifier. \nSiteSupplyId and ContractId are both identifies created and \nowned by the POWWR Portal and can be sent to the suppier \nduring the submission of the contract. If the contract is \nmultisite, and ContractId is used, this will change the\nstatus of all meters on the contract.\n",
            "example": "SiteSupplyId",
            "enum": [
              "SiteSupplyId",
              "ContractId",
              "Mpan",
              "Mprn"
            ]
          },
          "meterIdentifier": {
            "type": "string",
            "example": "1234"
          },
          "newStatus": {
            "type": "string",
            "description": "This is the supplier's own status code or name. The complete \nlist of all status codes used should be provided to POWWR during \nthe setup phase to ensure they can be accurately \n  mapped to a POWWR status group.\n",
            "example": "ValidationFailed"
          },
          "message": {
            "type": "string",
            "description": "Provides an optional additional message relating to the status change\nTypically used for error states or objections/rejection to include the\nreason.\n",
            "example": "The provided consumption was outside of expected range"
          }
        }
      },
      "UpdateStatusResponse": {
        "type": "object",
        "properties": {
          "errorMessage": {
            "type": "string",
            "example": "Failed to update one or more site supply statueses. Either the sitesupply could not be located from the provided information or the current status of the site supply cannot be changed to the requested state. Meter Identifier Type: SiteSupplyId, Meter Identifier 223082, Status From: Saved, Status To: Savedd, Valid Statuses Are:  Saved, ExperianReferralAwaitingUpdate, ExperianReferralDecisionMade, Submitted"
          },
          "actionData": {
            "$ref": "#/components/schemas/UpdateStatusRequest"
          },
          "success": {
            "type": "boolean",
            "example": false
          }
        }
      },
      "DataExportYuEnergyResponse": {
        "properties": {
          "UniqueID": {
            "type": "string"
          },
          "ExternalCustomerReference": {
            "type": "string"
          },
          "ExperianCreditRef": {
            "type": "string"
          },
          "YUECustomerReference": {
            "type": "string"
          },
          "CompanyName": {
            "type": "string"
          },
          "CustomerClass": {
            "type": "string"
          },
          "CompanyRegistrationNumber": {
            "type": "string"
          },
          "CreditScore": {
            "type": "string"
          },
          "BusinessType": {
            "type": "string"
          },
          "BusinessStartDate": {
            "type": "string"
          },
          "Industry": {
            "type": "string"
          },
          "CompanyStatus": {
            "type": "string"
          },
          "RegisteredAddress1": {
            "type": "string"
          },
          "RegisteredAddress2": {
            "type": "string"
          },
          "RegisteredAddress3": {
            "type": "string"
          },
          "RegisteredAddress4": {
            "type": "string"
          },
          "RegisteredAddress5": {
            "type": "string"
          },
          "RegisteredPostCode": {
            "type": "string"
          },
          "DirectorTitle": {
            "type": "string"
          },
          "DirectorFirstName": {
            "type": "string"
          },
          "DirectorSurname": {
            "type": "string"
          },
          "DirectorJobTitle": {
            "type": "string"
          },
          "DirectorAddress1": {
            "type": "string"
          },
          "DirectorAddress2": {
            "type": "string"
          },
          "DirectorAddress3": {
            "type": "string"
          },
          "DirectorAddress4": {
            "type": "string"
          },
          "DirectorAddress5": {
            "type": "string"
          },
          "DirectorPostCode": {
            "type": "string"
          },
          "DirectorPhoneNumber": {
            "type": "string"
          },
          "DirectorMobileNumber": {
            "type": "string"
          },
          "DirectorYearsAtAddress": {
            "type": "string"
          },
          "NumberOfPartners": {
            "type": "string"
          },
          "CharityName": {
            "type": "string"
          },
          "CharityNumber": {
            "type": "string"
          },
          "ContactType": {
            "type": "string"
          },
          "ContactSurname": {
            "type": "string"
          },
          "ContactFirstname": {
            "type": "string"
          },
          "ContactTitle": {
            "type": "string"
          },
          "ContactEmailAddress": {
            "type": "string"
          },
          "ContactDateOfBirth": {
            "type": "string"
          },
          "ContactPrimaryTelephoneNumber": {
            "type": "string"
          },
          "ContactSecondaryTelephoneNumber": {
            "type": "string"
          },
          "BillDeliveryMethod": {
            "type": "string"
          },
          "CommunicationDeliveryMethod": {
            "type": "string"
          },
          "IsPrimaryContact": {
            "type": "string"
          },
          "Address1": {
            "type": "string"
          },
          "Address2": {
            "type": "string"
          },
          "Address3": {
            "type": "string"
          },
          "Address4": {
            "type": "string"
          },
          "Address5": {
            "type": "string"
          },
          "AddressPostcode": {
            "type": "string"
          },
          "AgreementStartDate": {
            "type": "string"
          },
          "AgreementEndDate": {
            "type": "string"
          },
          "AgreementTerm": {
            "type": "string"
          },
          "Uplift": {
            "type": "string"
          },
          "ProductBundleRef": {
            "type": "string"
          },
          "DayUsage": {
            "type": "string",
            "description": "Only used for electricity contracts, empty otherwise"
          },
          "NightUsage": {
            "type": "string",
            "description": "Only used for electricity contracts, empty otherwise"
          },
          "EveningWeekendUsage": {
            "type": "string",
            "description": "Only used for electricity contracts, empty otherwise"
          },
          "AllPeriodsUsage": {
            "type": "string",
            "description": "Only used for electricity contracts, empty otherwise"
          },
          "AnnualUsage": {
            "type": "string",
            "description": "Only used for gas contracts, empty otherwise"
          },
          "BrokerCode": {
            "type": "string"
          },
          "BrokerName": {
            "type": "string"
          },
          "BrokerAgentReference": {
            "type": "string"
          },
          "BrokerReference": {
            "type": "string"
          },
          "AgentName": {
            "type": "string"
          },
          "DateOfSale": {
            "type": "string"
          },
          "PaymentMethod": {
            "type": "string"
          },
          "BillingFrequency": {
            "type": "string"
          },
          "NumberOfBills": {
            "type": "string"
          },
          "NumberOfMeterReadings": {
            "type": "string"
          },
          "BankAccountName": {
            "type": "string"
          },
          "BankSortCode": {
            "type": "string"
          },
          "BankAccountNumber": {
            "type": "string"
          },
          "DirectDebitPaymentDay": {
            "type": "string"
          },
          "BankName": {
            "type": "string"
          },
          "VATDeclaration": {
            "type": "string"
          },
          "MeterPointIdentifier": {
            "type": "string"
          },
          "Fuel": {
            "type": "string",
            "enum": [
              "Electricity - Electricity Meter Point",
              "Gas - Gas Meter Point"
            ]
          },
          "ProfileClass": {
            "type": "string",
            "description": "Only used for electricity contracts, empty otherwise"
          },
          "SerialNumber": {
            "type": "string"
          },
          "TopLine": {
            "type": "string",
            "description": "Only used for electricity contracts, empty otherwise"
          },
          "MeterType": {
            "type": "string",
            "description": "Only used for electricity contracts, empty otherwise"
          },
          "MeasurementClass": {
            "type": "string",
            "description": "Only used for electricity contracts, empty otherwise"
          },
          "AssetContactType": {
            "type": "string"
          },
          "Available247": {
            "type": "string"
          },
          "AssetContactDescription": {
            "type": "string"
          },
          "AssetContactSurname": {
            "type": "string"
          },
          "AssetContactFirstname": {
            "type": "string"
          },
          "AssetContactInitials": {
            "type": "string"
          },
          "AssetContactTitle": {
            "type": "string"
          },
          "AssetContactEmailAddress": {
            "type": "string"
          },
          "AssetContactTelephoneNumber1": {
            "type": "string"
          },
          "AssetContactTelephoneNumber2": {
            "type": "string"
          },
          "AssetContactTelephoneNumber3": {
            "type": "string"
          },
          "PropertyContactType": {
            "type": "string"
          },
          "PropertySurname": {
            "type": "string"
          },
          "PropertyFirstname": {
            "type": "string"
          },
          "PropertyTitle": {
            "type": "string"
          },
          "PropertyEmailAddress": {
            "type": "string"
          },
          "PropertyTelephoneNumber": {
            "type": "string"
          },
          "PropertySecondaryTelephoneNumber": {
            "type": "string"
          },
          "PropertySietName": {
            "type": "string"
          },
          "PropertyAddress1": {
            "type": "string"
          },
          "PropertyAddress2": {
            "type": "string"
          },
          "PropertyAddress3": {
            "type": "string"
          },
          "PropertyAddress4": {
            "type": "string"
          },
          "PropertyAddress5": {
            "type": "string"
          },
          "PropertyAddressPostcode": {
            "type": "string"
          },
          "SupplyCapacity": {
            "type": "string",
            "description": "Only used for electricity contracts, empty otherwise"
          },
          "CurrentSupplier": {
            "type": "string"
          },
          "CurrentContractEndDate": {
            "type": "string"
          },
          "SalesType": {
            "type": "string",
            "enum": [
              "Acquisition",
              "Renewal"
            ]
          },
          "COTFlag": {
            "type": "string"
          },
          "COTDate": {
            "type": "string"
          },
          "ConsentQuote": {
            "type": "string"
          },
          "ConsentMarketingPost": {
            "type": "string"
          },
          "PrivacyPolicy": {
            "type": "string"
          },
          "Rates": {
            "$ref": "#/components/schemas/DataExportYuEnergyResponse_Rates"
          },
          "Contract Type": {
            "type": "string"
          },
          "Product Name": {
            "type": "string"
          },
          "Renewable": {
            "type": "string"
          }
        }
      },
      "inline_response_200": {
        "oneOf": [
          {
            "$ref": "#/components/schemas/DataExportYuEnergyResponse"
          }
        ]
      },
      "DataExportYuEnergyResponse_Rates_Rate": {
        "type": "object",
        "properties": {
          "ProductItemReference": {
            "type": "string",
            "enum": [
              "ENERGY",
              "STANDING-CHARGE"
            ]
          },
          "RateName": {
            "type": "string",
            "enum": [
              "Standard",
              "Day",
              "Night",
              "Evening/Weekend",
              "Standing Charge"
            ]
          },
          "Rate": {
            "type": "string"
          },
          "AnnualConsumption": {
            "type": "string"
          }
        }
      },
      "DataExportYuEnergyResponse_Rates": {
        "type": "object",
        "properties": {
          "Rate": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/DataExportYuEnergyResponse_Rates_Rate"
            }
          }
        }
      }
    },
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "name": "apiKey",
        "in": "header"
      }
    }
  }
}