{
  "openapi": "3.0.0",
  "info": {
    "title": "Connected API for POWWR UK Supplier Portals",
    "description": "---\nSupports creating, validating and submitting new deals to UK Suppliers via POWWR Supplier Portals.\n\n**Typical Usage**\n1. Obtain an OAuth token from the POWWR Auth Server\n2. Call `/CreateDeal` passing customer, meter and rate data\n3. Add Supporting documentation via `/addDocument`\n4. Validate the quote data provide by calling `/performQuote`\n5. Credit check the customer by calling `/performCreditCheck`\n6. Submit the new deal to the supplier with `/submitDeal`\n\n---\nVersion History\n\n5.6.0\n+ Added SmartInstallationDateAndTime\n\n5.5.0\n+ Added PayeeDetails (Bank Account Type, Joint Account, Company Registration No) to the paymentDetails\n\n5.4.0\n+ Added supplierUplift to ElecPriceComponent and GasPriceComponent\n+ Updated description of uplift to clarify the distinction between the two uplift types\n+ Added ignoreInvalidData to DealRequest\n\n5.3.0\n+ Added dateOfQuote to smeElectricity and smeGas\n\n5.2.0\n+ Added replaceExisting flag to addDocumentRequest \n\n5.1.0\n+ Added EnrichmentNotAvailable enum value\n+ Allow 5 digit SIC codes\n+ Removed pattern for telephone numbers\n\n\n5.0.0 \n* Fixed spelling of dateOfIncorporation property (Breaking)\n\n4.1.7\n+ Added additional Enums to Entity property in Issue object\n+ Added 400 response to /submitDeal\n\n4.1.6\n+ Add credit check override result to /performCreditCheck\n\n4.1.5\n* Various bug fixes\n\n4.1.4\n+ Added elecRates to performQuote response\n+ Added gasRates to performQuote response\n- Removed pricesReturned flag from performQuote response\n---\nVersion History\n4.1.3\n+ Add Elec Meter Last Reading\n+ Add Gas Meter Last Reading\n---\nVersion History\n4.1.2\n* Renamed udStatusGroup to powwrStatusGroup\n- Removed PencePerMonth from rateTypes\n---\n4.1.1\n+ Fix response type to json so examples are shown in Swagger for all endpoints\n+ Set version number to match code version\n---\n4.1.0\n+ Added isGreen flag to elec and gas (needed for pricing)\n+ Added standingChargeType enum to elec and gas (needed for pricing)\n+ Added hasCustomMeteringService to elec (needed for pricing)\n+ Added halfHourlyNumberOfRates\n+ fixed spelling on UnnecessaryProperty enum\n+ bespoke prices flag in CAPI on performQuote\n+ Added strictValidation flag to createDeal\n---\n4.0.0\n- Removed success flag from all responses as ProblemDetails used for failure\n* Renamed Basket to Deal throughout\n* Merged Enrichments with Warnings, added specifics for warnings\n* Fix non camelCased UtilityBaseType properties (BillingDetails, DealDetails and Address)\n* Changed UdId to PowwrId\n* PowwrId is mandatory when specifying a supplier/brokerage/agent\n+ Added format definition for 400 response to use ProblemDetail response\n---\n3.0.0 \n- Removed cclVat from AddDocument DocumentType enum as this is covered already\nby cclException (Breaking change)\n- Removed DocuSign document types from add document\n+ Added endpoint /AddDocuSignDocument with Request/Response\n+ Add minimum of 0 to uplift\n+ Made brokerage and agent mandatory on createbasket request\n---\n2.2.5\n+ Added Message to CreditCheckResponse\n---\n2.2.4\n+ Added Enrichments to CreateBasketResponse to return data added/changed\n  from lookups\n---\n2.2.3\n+ Added Get Portal Link endpoint\n---\n2.2.2\n+ Added ContractSignedDate to ContractDetails\n---\n2.2.1\n+ Added CclVat to the AddDocument DocumentType enum\n---\n2.2.0\n+ Removed Water\n---\n2.1.0\n+ Removed CashOrCheque (same as receipt of bill)\n---\n2.0.0 (Breaking change)\n* Renamed UtilityStatus.Status to UtilityStatus.supplierStatus\n+ Added UtilityStatus.UdStatusGroup\n---\n1.14.0\n+ Make MPAN required\n---\n1.13.0\n+ Add Webhook for basket updates\n---\n1.12.0\n+ Add UpdateBasket endpoint\n---\n1.11.0\n+ Remove EveningAndWeekend rates\n---\n1.10.0\n+ Add in extra credit check responses\n---\n1.9.0\n+ Add error reporting to quotation\n+ Modify quote response\n---\n1.8.0\n+ Add error reporting to submit endpoint\n---\n1.7.0\n+ Add submit endpoint\n---\n1.6.0\n+ Add perform credit check endpoint\n+ Flip Request/Respone on quote endpoint as incorrect\n---\n1.5.0\n+ Add field sale to contract type\n---\n1.4.0\n+ Add endpoint to automatically generate a quote (/performQuote)\n+ Add format uuid to basketId throughout\n---\n1.3.0\n+ Add endpoint to retrieve statuses for each utility in a basket\n+ Remove unused schemas around submit bakset\n+ Reorder schemas\n---\n1.2.2\n+ Add Sandbox authorisation\n---\n1.2.1\n+ Align document types with the V2 Portals\n---\n1.2.0\n+ Removed the submitBasket endpoint as not yet required.\n---\n1.1.1\n+ Add Product to contract details, needed for quote\n+ Add Pricebook to contract details, needed for quote\n---\n1.1.0\n+ Change usages from array to object (breaking change)\n+ Add brokeragePaymentTerm to ContractDetails\n+ Added commercialUsagePercentage to ContractDetails\n---\n1.0.6\n+ Add contact to site\n---\n1.0.5\n+ Added Smart Meter marketing to SME Gas and SME Electric\n",
    "version": "5.6.0"
  },
  "security": [
    {
      "ApiKeyAuth": []
    }
  ],
  "paths": {
    "/createDeal": {
      "post": {
        "summary": "Create a new contract deal on a supplier portal.",
        "description": "This endpoint is used to create a new contract deal on the designated supplier portal. The portal the deal will be routed to is specified here:\n```\nsites[x].utilties[x].contractDetails.newSupplier.powwrId\n```\nThis must be a PowwrID and not a supplier name. A full list of PowwrIDs for all suppliers will be included your onboarding pack. Currently the API only supports deals for a single supplier.\n\nYou can provide as much or as little data as you have available. Any missing data can be added directly on the portal.\n\nAs a minimum you must provide a site name:\n\n```\nsites[x].siteName\n```\n\n The following data is returned in the response:\n + A unique DealId\n + An http link which takes you directly to the newly created deal on the portal\n + Any warnings related to the data provided\n \n",
        "requestBody": {
          "description": "the data to import",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DealRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DealResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetailsRfc7807"
                }
              }
            }
          }
        }
      }
    },
    "/updateDeal": {
      "post": {
        "summary": "Send an updated set of data to a supplier portal for a deal",
        "description": "This endpoint is used to update a contract deal previously created via the API.\nYou must supply the DealId returned by the `/createDeal` call.\n\nThis will delete the original deal on the portal and recreate it with the provided data. This means the data provided should be complete and not just the properties you wish to update.\n\nThe response format is identical to the `/CreateDeal` endpoint.\n",
        "requestBody": {
          "description": "the data to import",
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/DealRequest"
              }
            }
          },
          "required": true
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/DealResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetailsRfc7807"
                }
              }
            }
          }
        }
      }
    },
    "/addDocument": {
      "post": {
        "summary": "Attach a document to a previously created Deal",
        "description": "Different supplier portals will have different requirements for which documents need to be provided. Generally this will be a copy of the energy contract and a Letter of Authority (LOA).\n\nIf you would like a DocuSign contract to be generated for you and sent to the customer, you can use the `/addDocuSignDocument` endpoint.\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddDocumentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddDocumentResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetailsRfc7807"
                }
              }
            }
          }
        }
      }
    },
    "/addDocuSignDocument": {
      "post": {
        "summary": "Send a DocuSign contract for the supplier",
        "description": "This endpoint is optional and is used if you do not have a signed contract document available already for the deal that you can upload via the `/addDocument` endpoint. This endpoint will generate a contract document for the relevant supplier prepopulated with all the deal information and send it via DocuSign to the customer. \n\nThe API only currently supports generating a contract document type.\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/AddDocuSignDocumentRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/AddDocuSignDocumentResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetailsRfc7807"
                }
              }
            }
          }
        }
      }
    },
    "/performQuote": {
      "post": {
        "summary": "Request that a quotation is performed on a deal",
        "description": "This endpoint will peform a quote using the POWWR Matrix pricing API and verify that the rates provided in the `/createDeal` request are valid and current. If the rates do not match, the mismatches will be provided in the response so the deal can be updated via the `/updateDeal` endpoint.\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/QuotationRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/QuotationResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetailsRfc7807"
                }
              }
            }
          }
        }
      }
    },
    "/performCreditCheck": {
      "post": {
        "summary": "Request that a credit check is performed on a deal",
        "description": "Different supplier portals have different requirements for credit checking a customer. Calling this endpoint will run the relevant credit check (if required) and return the result. \n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/CreditCheckRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/CreditCheckResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetailsRfc7807"
                }
              }
            }
          }
        }
      }
    },
    "/getUtilityStatuses": {
      "post": {
        "summary": "Get the status of each utility in a previously created deal",
        "description": "Status updates will be sent back via the webhook automatically, however this endpoint allows the current status to be request on demand. It will return the status of each meter in the original deal.\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/GetUtilityStatusesRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetUtilityStatusesResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetailsRfc7807"
                }
              }
            }
          }
        }
      }
    },
    "/status": {
      "get": {
        "summary": "Server uptime and status",
        "description": "This endpoint can be used to verify if the service is avaialble. It will return the environment name, version and uptime.\n",
        "responses": {
          "200": {
            "description": "OK"
          }
        },
        "security": []
      }
    },
    "/submitDeal": {
      "post": {
        "summary": "Submit a previously created Deal",
        "description": "When all data has been provided, calling this endpoint will submit the deal to the supplier. During submission a full validation will be performed which will ensure all mandatory fields have been provided, all documentation uploaded and the credit check and quote verification has been completed.\n",
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "$ref": "#/components/schemas/SubmitRequest"
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/SubmitResponse"
                }
              }
            }
          },
          "400": {
            "description": "Bad Request",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/ProblemDetailsRfc7807"
                }
              }
            }
          }
        }
      }
    },
    "/portalLink/{dealId}": {
      "get": {
        "summary": "Retrieve Portal Link Uri for a previously created Deal",
        "parameters": [
          {
            "name": "dealId",
            "in": "path",
            "description": "The contract ID",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "responses": {
          "200": {
            "description": "OK",
            "content": {
              "application/json": {
                "schema": {
                  "$ref": "#/components/schemas/GetPortalLinkResponse"
                }
              }
            }
          }
        }
      }
    }
  },
  "components": {
    "schemas": {
      "ProblemDetailsRfc7807": {
        "type": "object",
        "properties": {
          "type": {
            "type": "string"
          },
          "title": {
            "type": "string"
          },
          "status": {
            "type": "integer"
          },
          "detail": {
            "type": "string"
          },
          "extensions": {
            "$ref": "#/components/schemas/ProblemDetailsRfc7807_extensions"
          }
        }
      },
      "DealRequest": {
        "required": [
          "agent",
          "brokerage",
          "sites"
        ],
        "type": "object",
        "properties": {
          "dealId": {
            "type": "string",
            "format": "uuid",
            "example": "eb06113b-c916-4b80-8e18-a82bbe8a8293"
          },
          "statusWebhookUrl": {
            "type": "string",
            "format": "uri",
            "example": "https://myserver.com/send/callback/here"
          },
          "strictValidation": {
            "type": "boolean"
          },
          "ignoreInvalidData": {
            "type": "boolean"
          },
          "brokerage": {
            "$ref": "#/components/schemas/BrokerageIdentifier"
          },
          "aggregatorBrokerage": {
            "$ref": "#/components/schemas/BrokerageIdentifier"
          },
          "agent": {
            "$ref": "#/components/schemas/AgentIdentifier"
          },
          "customer": {
            "$ref": "#/components/schemas/Customer"
          },
          "sites": {
            "minItems": 1,
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Site"
            }
          }
        }
      },
      "Issue": {
        "required": [
          "description"
        ],
        "type": "object",
        "properties": {
          "entity": {
            "type": "string",
            "enum": [
              "DealRequest",
              "CreditCheckRequest",
              "QuotationRequest",
              "GetUtilityStatusRequest",
              "SubmitRequest",
              "AddDocumentRequest",
              "AddDocuSignDocumentRequest"
            ]
          },
          "description": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "UnexpectedProperty",
              "UnnecessaryProperty",
              "ValueIsMissing",
              "ValueIsInvalid",
              "ValuesAreDifferent",
              "MissingValueAddedByEnrichment",
              "ValueUpdatedByEnrichment",
              "EnrichmentNotAvailable"
            ]
          },
          "properties": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/EntityProperty"
            }
          }
        },
        "description": "An issue with the request or deal"
      },
      "EntityProperty": {
        "required": [
          "path"
        ],
        "type": "object",
        "properties": {
          "path": {
            "type": "string",
            "description": "The path to the property in the createBasketRequest object heirarchy",
            "example": "$.customer.contact.homeAddress.previousAddress.moveInDate"
          },
          "providedValue": {
            "type": "object"
          },
          "enrichedValue": {
            "type": "object"
          },
          "allowedValues": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/AllowedValue"
            }
          }
        }
      },
      "AllowedValue": {
        "type": "object",
        "properties": {
          "displayName": {
            "type": "string"
          },
          "value": {
            "type": "object"
          }
        }
      },
      "DealResponse": {
        "type": "object",
        "properties": {
          "dealId": {
            "type": "string",
            "format": "uuid",
            "example": "eb06113b-c916-4b80-8e18-a82bbe8a8293"
          },
          "portalUrl": {
            "type": "string"
          },
          "warnings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Issue"
            }
          }
        }
      },
      "AddDocumentRequest": {
        "required": [
          "dealId",
          "documentName"
        ],
        "type": "object",
        "properties": {
          "dealId": {
            "type": "string",
            "format": "uuid",
            "example": "eb06113b-c916-4b80-8e18-a82bbe8a8293"
          },
          "replaceExisting": {
            "type": "boolean",
            "description": "Replace any existing documents of the specified type"
          },
          "documentName": {
            "type": "string"
          },
          "documentContent": {
            "type": "string",
            "format": "binary"
          },
          "documentType": {
            "type": "string",
            "enum": [
              "ElecSignedContract",
              "ElecVerbalContractRecording",
              "ElecVerbalContractScript",
              "GasSignedContract",
              "GasVerbalContractRecording",
              "GasVerbalContractScript",
              "DualFuelSignedContract",
              "DualFuelVerbalContractRecording",
              "DualFuelVerbalContractScript",
              "Loa",
              "General",
              "VatExemption",
              "CclExemption",
              "DdMandate",
              "ProofOfChangeOfTenancy",
              "TaxExemptionDocumentation",
              "ProofOfPayment",
              "ProofOfAddress",
              "ProofOfTrading",
              "ProofOfBusiness",
              "VatDeclarationForm"
            ]
          }
        }
      },
      "AddDocumentResponse": {
        "type": "object",
        "properties": {
          "warnings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Issue"
            }
          }
        }
      },
      "AddDocuSignDocumentRequest": {
        "required": [
          "dealId",
          "documentType",
          "recipientEmail"
        ],
        "type": "object",
        "properties": {
          "dealId": {
            "type": "string",
            "format": "uuid",
            "example": "eb06113b-c916-4b80-8e18-a82bbe8a8293"
          },
          "recipientEmail": {
            "type": "string",
            "format": "email"
          },
          "documentType": {
            "type": "string",
            "enum": [
              "Contract"
            ]
          }
        }
      },
      "AddDocuSignDocumentResponse": {
        "type": "object",
        "properties": {
          "warnings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Issue"
            }
          }
        }
      },
      "CreditCheckRequest": {
        "required": [
          "dealId"
        ],
        "type": "object",
        "properties": {
          "dealId": {
            "type": "string",
            "format": "uuid",
            "example": "eb06113b-c916-4b80-8e18-a82bbe8a8293"
          },
          "overrideResult": {
            "type": "string",
            "description": "Used to override result to support testing of all outcome scenarios\n(only valid in test environments)\n",
            "enum": [
              "Accept",
              "Decline",
              "Refer",
              "ReferAccept",
              "ReferDecline",
              "NotRequired"
            ]
          }
        }
      },
      "CreditCheckResponse": {
        "type": "object",
        "properties": {
          "decision": {
            "type": "string",
            "enum": [
              "Accept",
              "Decline",
              "Refer",
              "ReferAccept",
              "ReferDecline",
              "NotRequired"
            ]
          },
          "warnings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Issue"
            }
          }
        }
      },
      "QuotationRequest": {
        "required": [
          "dealId"
        ],
        "type": "object",
        "properties": {
          "dealId": {
            "type": "string",
            "format": "uuid",
            "example": "eb06113b-c916-4b80-8e18-a82bbe8a8293"
          },
          "utilityType": {
            "type": "string",
            "enum": [
              "SmeElectricity",
              "SmeGas"
            ]
          },
          "quotationType": {
            "type": "string",
            "enum": [
              "Matrix",
              "Custom"
            ]
          }
        }
      },
      "QuotationResponse": {
        "type": "object",
        "properties": {
          "warnings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Issue"
            }
          },
          "quotationResults": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/QuotationResult"
            }
          }
        }
      },
      "QuotationResult": {
        "type": "object",
        "properties": {
          "utilityId": {
            "type": "string",
            "description": "The identifier used for the utility in the original create deal request. e.g. MPAN Core, MPRN, SPID Core"
          },
          "utilityType": {
            "type": "string",
            "enum": [
              "SmeElectricity",
              "SmeGas"
            ]
          },
          "elecRates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ElecPriceComponent"
            }
          },
          "gasRates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GasPriceComponent"
            }
          }
        }
      },
      "GetUtilityStatusesRequest": {
        "required": [
          "dealId"
        ],
        "type": "object",
        "properties": {
          "dealId": {
            "type": "string",
            "format": "uuid",
            "example": "eb06113b-c916-4b80-8e18-a82bbe8a8293"
          }
        }
      },
      "GetUtilityStatusesResponse": {
        "type": "object",
        "properties": {
          "utilityStatuses": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UtilityStatus"
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Issue"
            }
          }
        }
      },
      "SubmitRequest": {
        "required": [
          "dealId"
        ],
        "type": "object",
        "properties": {
          "dealId": {
            "type": "string",
            "format": "uuid",
            "example": "eb06113b-c916-4b80-8e18-a82bbe8a8293"
          }
        }
      },
      "SubmitResponse": {
        "type": "object",
        "properties": {
          "warnings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Issue"
            }
          }
        }
      },
      "GetPortalLinkResponse": {
        "type": "object",
        "properties": {
          "dealId": {
            "type": "string",
            "format": "uuid",
            "example": "eb06113b-c916-4b80-8e18-a82bbe8a8293"
          },
          "portalUrl": {
            "type": "string"
          },
          "warnings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Issue"
            }
          }
        }
      },
      "BillingDetails": {
        "type": "object",
        "properties": {
          "address": {
            "$ref": "#/components/schemas/PafAddress"
          },
          "contact": {
            "$ref": "#/components/schemas/Contact"
          },
          "deliveryMethod": {
            "type": "string",
            "enum": [
              "Email",
              "Post",
              "Online",
              "Both"
            ]
          },
          "frequency": {
            "type": "string",
            "enum": [
              "Monthly",
              "Quarterly"
            ]
          },
          "payment": {
            "$ref": "#/components/schemas/PaymentDetails"
          }
        }
      },
      "PaymentDetails": {
        "type": "object",
        "properties": {
          "method": {
            "type": "string",
            "enum": [
              "ReceiptofBill",
              "FixedDirectDebit",
              "VariableDirectDebit",
              "BACS",
              "Prepayment"
            ]
          },
          "paymentTermInDays": {
            "type": "integer"
          },
          "directDebitDayOfMonth": {
            "maximum": 31,
            "minimum": 1,
            "type": "integer"
          },
          "fixedDirectDebitPaymentAmount": {
            "type": "number"
          },
          "useExistingBankDetails": {
            "type": "boolean"
          },
          "bankDetails": {
            "$ref": "#/components/schemas/BankDetails"
          }
        }
      },
      "BankDetails": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string"
          },
          "branchName": {
            "type": "string"
          },
          "bankAccountType": {
            "type": "string",
            "enum": [
              "Personal",
              "Business"
            ]
          },
          "jointAccount": {
            "type": "boolean"
          },
          "companyRegistrationNo": {
            "type": "string"
          },
          "sortCode": {
            "pattern": "[0-9]{6}",
            "type": "string"
          },
          "accountNumber": {
            "pattern": "[0-9]{8}",
            "type": "string"
          },
          "accountName": {
            "type": "string"
          },
          "requires2signatures": {
            "type": "boolean"
          },
          "address": {
            "$ref": "#/components/schemas/PafAddress"
          }
        }
      },
      "Site": {
        "required": [
          "name"
        ],
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "example": "McDonalds oxford road"
          },
          "groupName": {
            "type": "string",
            "example": "North West"
          },
          "contact": {
            "$ref": "#/components/schemas/Contact"
          },
          "isChangeOfTenancy": {
            "type": "boolean"
          },
          "occupancyType": {
            "type": "string",
            "enum": [
              "Landlord",
              "Owner",
              "Tenant"
            ]
          },
          "moveInDate": {
            "type": "string",
            "format": "date"
          },
          "siteAddress": {
            "$ref": "#/components/schemas/PafAddress"
          },
          "utilities": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/UtilityBaseType"
            }
          }
        }
      },
      "ContractDetails": {
        "type": "object",
        "properties": {
          "isRenewalForSupplier": {
            "type": "boolean",
            "description": "Does the supplier already supply this meter, either for the same customer or the previous occupant if change of tenancy."
          },
          "isRenewalForBrokerage": {
            "type": "boolean"
          },
          "isNewConnection": {
            "type": "boolean"
          },
          "isOutOfContract": {
            "type": "boolean",
            "description": "Cannot always infer this from the currentContractEndDate as this might not be known"
          },
          "isFieldSale": {
            "type": "boolean",
            "description": "Field sale, and no contract available to upload"
          },
          "currentSupplier": {
            "$ref": "#/components/schemas/SupplierIdentifier"
          },
          "newSupplier": {
            "$ref": "#/components/schemas/SupplierIdentifier"
          },
          "hasTerminationNoticeBeenServedWithCurrentSupplier": {
            "type": "boolean"
          },
          "anyOutstandingDebtWithCurrentSupplier": {
            "type": "boolean"
          },
          "fulfilmentCode": {
            "type": "string"
          },
          "pricebook": {
            "type": "string"
          },
          "product": {
            "type": "string"
          },
          "commercialUsagePercentage": {
            "type": "integer"
          },
          "brokeragePaymentTerm": {
            "type": "string",
            "enum": [
              "WholeLife",
              "Annual"
            ]
          },
          "currentContractEndDate": {
            "type": "string",
            "format": "date"
          },
          "newContractStartDate": {
            "type": "string",
            "format": "date"
          },
          "newContractEndDate": {
            "type": "string",
            "format": "date"
          },
          "contractSignedDate": {
            "type": "string",
            "format": "date"
          }
        }
      },
      "ElecPriceComponent": {
        "type": "object",
        "properties": {
          "rateType": {
            "type": "string",
            "enum": [
              "StandingCharge",
              "Unit",
              "Day",
              "Night",
              "Weekend",
              "CapacityCharge",
              "ReactiveCharge",
              "Fits",
              "DirectDebit",
              "ChequeSurcharge"
            ]
          },
          "amount": {
            "type": "number",
            "description": "The total value inclusive of uplift"
          },
          "uplift": {
            "minimum": 0,
            "type": "number",
            "description": "How much of the provided amount is the commission uplift added by, and payable to the broker"
          },
          "supplierUplift": {
            "type": "number",
            "description": "How much of the provided amount is the uplift added by, and payable to the supplier to cover addition costs - e.g. credit risk"
          },
          "unit": {
            "type": "string",
            "enum": [
              "pencePerDay",
              "pencePerKwh",
              "pencePerDayPerKva",
              "pencePerKvarh"
            ]
          }
        }
      },
      "GasPriceComponent": {
        "type": "object",
        "properties": {
          "rateType": {
            "type": "string",
            "enum": [
              "StandingCharge",
              "Unit",
              "DirectDebit",
              "ChequeSurcharge"
            ]
          },
          "amount": {
            "type": "number",
            "description": "The total value inclusive of uplift"
          },
          "uplift": {
            "minimum": 0,
            "type": "number",
            "description": "How much of the provided amount is the commission uplift added by, and payable to the broker"
          },
          "supplierUplift": {
            "type": "number",
            "description": "How much of the provided amount is the uplift added by, and payable to the supplier to cover addition costs - e.g. credit risk"
          },
          "unit": {
            "type": "string",
            "enum": [
              "pencePerDay",
              "pencePerKwh"
            ]
          }
        }
      },
      "ElecMeterUsage": {
        "type": "object",
        "properties": {
          "unit": {
            "type": "integer"
          },
          "day": {
            "type": "integer"
          },
          "night": {
            "type": "integer"
          },
          "weekend": {
            "type": "integer"
          },
          "reactive": {
            "type": "integer"
          },
          "capacity": {
            "type": "integer"
          }
        }
      },
      "GasMeterUsage": {
        "type": "object",
        "properties": {
          "unit": {
            "type": "integer"
          }
        }
      },
      "ElecMeterLastReading": {
        "type": "object",
        "properties": {
          "day": {
            "type": "integer"
          },
          "night": {
            "type": "integer"
          },
          "weekend": {
            "type": "integer"
          }
        }
      },
      "GasMeterLastReading": {
        "type": "object",
        "properties": {
          "unit": {
            "type": "integer"
          }
        }
      },
      "SmeElectricity": {
        "type": "object",
        "properties": {
          "dateOfQuote": {
            "type": "string",
            "format": "date"
          },
          "mpanTop": {
            "maxLength": 8,
            "minLength": 8,
            "type": "string",
            "example": "03801631"
          },
          "mpanBottom": {
            "maxLength": 13,
            "minLength": 13,
            "type": "string",
            "format": "numeric",
            "example": "1640000651453"
          },
          "meterSerialNumbers": {
            "type": "array",
            "example": [
              "K13W307788"
            ],
            "items": {
              "type": "string"
            }
          },
          "includeMOPCharges": {
            "type": "boolean"
          },
          "halfHourlyNumberOfRates": {
            "maximum": 3,
            "minimum": 1,
            "type": "integer"
          },
          "associatedMpans": {
            "type": "array",
            "example": [
              "1610028163255",
              "1610028163246"
            ],
            "items": {
              "maxLength": 13,
              "minLength": 13,
              "type": "string",
              "format": "numeric"
            }
          },
          "usage": {
            "$ref": "#/components/schemas/ElecMeterUsage"
          },
          "lastReading": {
            "$ref": "#/components/schemas/ElecMeterLastReading"
          },
          "isRenewable": {
            "type": "boolean"
          },
          "standingChargeType": {
            "type": "string",
            "enum": [
              "None",
              "Low",
              "Standard",
              "High"
            ]
          },
          "rates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/ElecPriceComponent"
            }
          },
          "marketing": {
            "$ref": "#/components/schemas/SmeElectricity_marketing"
          },
          "smartInstallationDateAndTime": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SmeGas": {
        "type": "object",
        "properties": {
          "dateOfQuote": {
            "type": "string",
            "format": "date"
          },
          "emergencyContacts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Contact"
            }
          },
          "mprn": {
            "maxLength": 10,
            "minLength": 6,
            "type": "string",
            "format": "numeric"
          },
          "meterSerialNumbers": {
            "type": "array",
            "items": {
              "type": "string"
            }
          },
          "associatedMprns": {
            "type": "array",
            "items": {
              "maxLength": 10,
              "minLength": 6,
              "type": "string",
              "format": "numeric"
            }
          },
          "usage": {
            "$ref": "#/components/schemas/GasMeterUsage"
          },
          "lastReading": {
            "$ref": "#/components/schemas/GasMeterLastReading"
          },
          "isRenewable": {
            "type": "boolean"
          },
          "standingChargeType": {
            "type": "string",
            "enum": [
              "None",
              "Low",
              "Standard",
              "High"
            ]
          },
          "rates": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/GasPriceComponent"
            }
          },
          "marketing": {
            "$ref": "#/components/schemas/SmeElectricity_marketing"
          },
          "smartInstallationDateAndTime": {
            "type": "string",
            "format": "date-time"
          }
        }
      },
      "SmartMeterMarketing": {
        "type": "object",
        "properties": {
          "contact": {
            "$ref": "#/components/schemas/Contact"
          },
          "hasInterest": {
            "type": "boolean"
          },
          "refusalDate": {
            "type": "string",
            "format": "date"
          },
          "refusalReason": {
            "type": "string"
          }
        }
      },
      "Customer": {
        "type": "object",
        "properties": {
          "referenceCodes": {
            "type": "array",
            "example": [
              {
                "value": "ABC1234567",
                "ownerType": "Supplier"
              },
              {
                "value": "123-321X",
                "ownerType": "Brokerage"
              }
            ],
            "items": {
              "$ref": "#/components/schemas/ReferenceCode"
            }
          },
          "groupName": {
            "type": "string",
            "description": "A group used for organising and filtering customers.",
            "example": "Restaurants"
          },
          "letterOfAuthority": {
            "$ref": "#/components/schemas/LetterOfAuthority"
          },
          "contact": {
            "$ref": "#/components/schemas/Contact"
          },
          "company": {
            "$ref": "#/components/schemas/Company"
          }
        }
      },
      "Company": {
        "type": "object",
        "properties": {
          "name": {
            "type": "string",
            "example": "McDonalds Ltd"
          },
          "tradingAs": {
            "type": "string"
          },
          "type": {
            "type": "string",
            "enum": [
              "Limited",
              "SoleTrader",
              "Partnership",
              "LimitedLiabilityPartnership",
              "NonLimited",
              "PLC",
              "Charity",
              "ChurchOrCommunityOrganisation",
              "NonProfit",
              "PublicSector",
              "MutualSociety",
              "RoyalCharter",
              "JerseyBased"
            ]
          },
          "number": {
            "type": "string"
          },
          "dateOfIncorporation": {
            "type": "string",
            "format": "date"
          },
          "dateOfDissolution": {
            "type": "string",
            "format": "date"
          },
          "isScottishCharity": {
            "type": "boolean"
          },
          "isMicroBusiness": {
            "type": "boolean"
          },
          "sicCodes": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/SicCode"
            }
          },
          "address": {
            "$ref": "#/components/schemas/PafAddress"
          },
          "contacts": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Contact"
            }
          },
          "dataSource": {
            "type": "string",
            "enum": [
              "Broker",
              "CompaniesHouse",
              "CharitiesCommission",
              "ExperianBusinessTargetter"
            ]
          }
        }
      },
      "SicCode": {
        "type": "object",
        "properties": {
          "code": {
            "pattern": "[0-9]{4,5}",
            "type": "string"
          },
          "description": {
            "type": "string"
          }
        }
      },
      "ReferenceCode": {
        "type": "object",
        "properties": {
          "value": {
            "type": "string"
          },
          "ownerType": {
            "type": "string",
            "enum": [
              "Supplier",
              "Brokerage"
            ]
          }
        },
        "example": {
          "value": "ABC1234567",
          "ownerType": "Supplier"
        }
      },
      "LetterOfAuthority": {
        "type": "object",
        "properties": {
          "accessLevel": {
            "type": "string",
            "enum": [
              "None",
              "Full",
              "Readonly"
            ]
          },
          "expiryDate": {
            "type": "string",
            "format": "date"
          }
        },
        "example": {
          "accessLevel": "Full",
          "expiryDate": "2020-02-05"
        }
      },
      "BrokerageIdentifier": {
        "required": [
          "powwrId"
        ],
        "type": "object",
        "properties": {
          "powwrId": {
            "type": "string"
          }
        },
        "example": {
          "powwrId": "BKG-12873"
        }
      },
      "AgentIdentifier": {
        "required": [
          "powwrId"
        ],
        "type": "object",
        "properties": {
          "powwrId": {
            "type": "string",
            "format": "email"
          }
        }
      },
      "SupplierIdentifier": {
        "required": [
          "powwrId"
        ],
        "type": "object",
        "properties": {
          "powwrId": {
            "type": "string"
          }
        },
        "example": {
          "powwrId": "bgb"
        }
      },
      "Contact": {
        "type": "object",
        "properties": {
          "title": {
            "type": "string",
            "example": "Mr",
            "enum": [
              "Mr",
              "Mrs",
              "Miss",
              "Ms",
              "Mx",
              "Misc",
              "Dr",
              "Prof",
              "Admiral",
              "Captain",
              "Father",
              "Lady",
              "Lord",
              "Sir",
              "Rev",
              "Dame",
              "Rt Hon",
              "Sister"
            ]
          },
          "firstName": {
            "type": "string",
            "example": "Joe"
          },
          "lastName": {
            "type": "string",
            "example": "Bloggs"
          },
          "dateOfBirth": {
            "type": "string",
            "format": "date"
          },
          "isACompanyOwner": {
            "type": "boolean",
            "example": true
          },
          "email": {
            "type": "string",
            "format": "email"
          },
          "phoneNumbers": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/PhoneNumber"
            }
          },
          "jobTitle": {
            "type": "string",
            "example": "Director"
          },
          "consent": {
            "type": "array",
            "items": {
              "type": "string",
              "enum": [
                "thirdPartyEmail",
                "thirdPartyPost",
                "thirdPartySms",
                "thirdPartyPhone",
                "thirdPartyFaceToFace",
                "supplierEmail",
                "supplierPost",
                "supplierSms",
                "supplierPhone",
                "supplierFaceToFace",
                "supplierContractEmail",
                "supplierContractPost",
                "supplierContractSms",
                "supplierContractPhone",
                "supplierContractFaceToFace"
              ]
            }
          },
          "homeAddress": {
            "$ref": "#/components/schemas/HomeAddress"
          }
        },
        "description": "A contact, usually a person, including the information on how to contact them"
      },
      "HomeAddress": {
        "type": "object",
        "properties": {
          "address": {
            "$ref": "#/components/schemas/PafAddress"
          },
          "moveInDate": {
            "type": "string",
            "format": "date"
          },
          "previousAddress": {
            "$ref": "#/components/schemas/PreviousHomeAddress"
          }
        }
      },
      "PreviousHomeAddress": {
        "type": "object",
        "description": "A single prior address on file. Does not itself carry further address history.",
        "properties": {
          "address": {
            "$ref": "#/components/schemas/PafAddress"
          },
          "moveInDate": {
            "type": "string",
            "format": "date"
          }
        }
      },
      "PhoneNumber": {
        "type": "object",
        "properties": {
          "number": {
            "type": "string",
            "format": "phoneNumber"
          },
          "type": {
            "type": "string",
            "enum": [
              "mobile",
              "landline",
              "fax"
            ]
          }
        }
      },
      "UtilityBaseType": {
        "properties": {
          "billingDetails": {
            "$ref": "#/components/schemas/BillingDetails"
          },
          "contractDetails": {
            "$ref": "#/components/schemas/ContractDetails"
          },
          "address": {
            "$ref": "#/components/schemas/PafAddress"
          },
          "smeElectricDetails": {
            "$ref": "#/components/schemas/SmeElectricity"
          },
          "smeGasDetails": {
            "$ref": "#/components/schemas/SmeGas"
          }
        },
        "description": "Represents a gas/elec utility. Meter point address in ECOES, XOSERVE may be different to the site address so they can be specified here.\n        "
      },
      "PafAddress": {
        "type": "object",
        "properties": {
          "organisationName": {
            "type": "string",
            "example": "Powwr"
          },
          "departmentName": {
            "type": "string",
            "example": "Marketing"
          },
          "subBuildingName": {
            "type": "string",
            "example": "2nd Floor"
          },
          "buildingName": {
            "type": "string",
            "example": "Parkway House"
          },
          "buildingNumber": {
            "type": "string"
          },
          "dependentThoroughfareName": {
            "type": "string"
          },
          "thoroughfareName": {
            "type": "string",
            "example": "Palatine Rd"
          },
          "doubleDependentLocality": {
            "type": "string"
          },
          "dependentLocality": {
            "type": "string"
          },
          "postTown": {
            "type": "string",
            "example": "Northenden"
          },
          "county": {
            "type": "string"
          },
          "postcode": {
            "type": "string",
            "example": "M22 4DB"
          },
          "poBox": {
            "type": "string"
          }
        }
      },
      "UtilityStatus": {
        "type": "object",
        "properties": {
          "utilityId": {
            "type": "string",
            "description": "The identifier used for the utility in the original create deal request. e.g. MPAN Core, MPRN"
          },
          "utilityType": {
            "type": "string",
            "enum": [
              "SmeElectricity",
              "SmeGas"
            ]
          },
          "supplierStatus": {
            "type": "string",
            "description": "This is the status as provided by the supplier."
          },
          "powwrStatusGroup": {
            "type": "string",
            "description": "This is a standardised Powwr status group name. Supplier statuses will all map to a single Powwr Status Group."
          }
        }
      },
      "ProblemDetailsRfc7807_extensions": {
        "type": "object",
        "properties": {
          "errors": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Issue"
            }
          },
          "warnings": {
            "type": "array",
            "items": {
              "$ref": "#/components/schemas/Issue"
            }
          }
        }
      },
      "SmeElectricity_marketing": {
        "type": "object",
        "properties": {
          "smartMeter": {
            "$ref": "#/components/schemas/SmartMeterMarketing"
          }
        }
      }
    },
    "securitySchemes": {
      "ApiKeyAuth": {
        "type": "apiKey",
        "name": "apiKey",
        "in": "header"
      }
    }
  }
}