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

# Create new order

> Create a new order

You can use this endpoint to create a new order. See the guide section [Build your own Funnel](/guides/orders) for additional information.

## Required input

The following information is mandatory to create an order:

<AccordionGroup>
  <Accordion title="General information" defaultOpen>
    * a valid `tariffKey` (see [list tariffs](/api-reference/tariffs/list_tariffs))
    * customer information in `useraccount`:
      * `firstName` and `lastName` for private customers, `businessName` for business customers.
      * a validated email address of the customer
    * the `deliveryAddress` object with
      * `firstName` and `lastName` for private customers, `businessName` for business customers.
      * complete postal address of the delivery location
    * `bankDetails` need to be complete with `accountHolder`, `iban`, `bic` and `bankName` for SEPA. Set `bankDetails: null` for payment by invoice
    * `deliveryDetails` has to filled with
      * `maLoIdentifier` or `meterNumber` of the delivery point
      * the BDEW code of the previous supplier in `previousSupplierCode`
  </Accordion>

  <Accordion title="Use case: new delivery location">
    If the customer just moved into the location, i.e. has no previous supply contract for the delivery location:

    * `contractReason` has to be set to `NewDeliveryLocation`
    * `deliveryDetails` has to filled with
      * `moveInDate` set to the date the customer will move into the new location. This will be used as desired start date for the contract
      * `previousAnnualConsumption` has to be filled and set to the expected annual energy consumption.
  </Accordion>

  <Accordion title="Use case: change of supplier">
    If the customer already has a supply contract in the delivery location:

    * `contractReason` has to be set to `ChangeOfSupplier`
    * The name in `deliveryAddress` has to match with the contract holder of the previous supply contract
    * `deliveryDetails` has to filled with
      * `previousAnnualConsumption` has to be filled and set to the annual energy consumption as reported by the previous supplier
      * If the customer has already cancelled the contract with the previous supplier
        * `previousSelfCancelledDate` has to be filled. This will be used as desired start date for the new contract
      * If the customer wants Rabot to take care of cancelling the contract with the previous supplier:
        * `desiredTransitionDate`has to be filled
  </Accordion>
</AccordionGroup>

<Note>
  Requires `create:orders` scope.
</Note>


## OpenAPI

````yaml POST /partner/v1/orders
openapi: 3.0.4
info:
  title: RABOT Partner API
  description: "## Introduction\r\n\r\nThe RABOT Partner API allows you to integrate with the RABOT platform to automate your process flows. It is designed for backend, server-to-server integration supporting the following use cases\r\n\r\n* Getting price quotes and managing customer orders (submit, check status) for Sales Partners\r\n\r\n* Accessing customer, contract and pricing / consumption data for integrating into 3rd party applications\r\n\r\n* Price dependent optimization of customer assets and energy consumption\r\n\r\n\r\n## Access to the API\r\n\r\n### Partner setup\r\n\r\nTo use the API, your organization has to be set up as a partner in the RABOT platform. As part of this setup process, you receive a set of **client credentials** (client id, client password) that allow you to perform requests against the API. The client credentials also define the level of access you have, depending on the agreed use case and commercial and legal agreement in place.\r\n\r\n> \r\n> Make sure to always keep your client credentials safe. Do not include client credentials in client side code (smartphone app, web application), as they could easily be extracted and misused. If you think your credentials have been compromised, contact RABOT to invalidate the credentials and get a new password.\r\n>\r\n\r\nFor development and testing purposes, the API is also available in a test environment, where you can create and modify data without triggering actual contract and grid operation processes. To access the test enviroment, you have to use different hostnames for your API request. Note that also your client credentials a different between test environment and production enviroment.\r\n\r\n| API | Test environment | Production environment |\r\n| ---------------- | --------------------------------- | ------------------------------ |\r\n| Authentication server | `test-auth.rabot-charge.de` | `auth.rabot-charge.de` |\r\n| API server | `test-api.rabot-charge.de` | `api.rabot-charge.de` |\r\n\r\n### Authentication\r\n\r\nThe RABOT Partner API uses OAuth 2.0 for authentication (see [RFC 7649](https://www.rfc-editor.org/rfc/rfc6749)). Using the OAuth client credentials flow, you can obtain an access token from the RABOT authentication server.\r\n\r\n#### Token request\r\n\r\n```shell\r\ncurl -L \"auth.rabot-charge.de/connect/token\" \\\r\n-H \"Content-Type: application/x-www-form-urlencoded\" \\\r\n-d \"client_id={{CLIENT_ID}}\" \\\r\n-d \"client_secret={{CLIENT_SECRET}}\" \\\r\n-d \"grant_type=client_credentials\" \\\r\n-d \"scope=api:partner\"\r\n```\r\n\r\nYou need to specify, which scopes you want to include in the token by specifying them in `scope` parameter.\r\n\r\nFollowing scopes are available:\r\n\r\n| Scope            | Description                                                     |\r\n| ---------------- | --------------------------------------------------------------- |\r\n| `api:partner`    | permission to access Partner API, required for all API requests |\r\n| `create:orders`  | permission to create orders                                     | \r\n\r\n\r\n> To use scopes, you need to have them assigned to your API client by RABOT administrators.\r\n> If you feel you should have a scope, that you don't have, please contact our B2B support team.\r\n\r\n#### Token response\r\n\r\nIf successful, the authentication server responds with a HTTP/200 status code, and the response body contains a structure with the access token\r\n\r\n```json\r\n{\r\n  \"access_token\": \"eyJhbGciOiJS....QnkY36d_ac\",\r\n  \"token_type\": \"Bearer\",\r\n  \"expires_in\": 3599\r\n}\r\n```\r\n\r\nIn all requests to the partner API, include the access token as Bearer token in the HTTP authorization header. Note that the token only has a limited life time; when the life time has expired, you will need to request a new token from the authentication server.\r\n\r\n#### Example request\r\n\r\n```shell\r\ncurl -L \"https://api.rabot-charge.de/partners/v1/tariffs\" \\\r\n-H \"Authorization: Bearer eyJhbGciOiJS....QnkY36d_ac\"\r\n```\r\n\r\n\r\n## Managing orders via the API\r\n\r\nAs a RABOT sales partner, the API allows you to build your own custom sales funnel for RABOT products (energy tariffs) or to integrate the price quote and order process into your own systems.\r\n\r\nNote that to build a sales process for RABOT energy tariffs that is compliant to the regulations, many requirements have to be fulfilled that are not part of this documentation. This documentation only covers the technical integration.\r\n\r\n### Creating a price quote\r\n\r\nTo create a price quote for a prospect customer, you need to select a tariff, and provide some basic information about the prospect, such as:\r\n\r\n* postcode of the delivery address\r\n* expected yearly energy consumption\r\n\r\nWith this information, you can call the tariff calculation endpoint `POST /partner/v1/tariffs/{tariffkey}/calculation`\r\n\r\nThis endpoint returns a response that details the different pricing components both on a monthly base and depending on the consumption, as well as the contract conditions (minimum duration, cancellation period).\r\n\r\n### Submitting an order\r\n\r\nWhen a customer has accepted the offer, you can use the API to submit the customer and order details to the RABOT platform with a `POST /partner/v1/orders` call\r\n\r\nFor the order, you have to provide the following information (see API reference for all the details):\r\n\r\n* a `tariffKey` to identify the requested product\r\n* customer identification, contact details and initial password.\r\n* delivery address and meter identification\r\n* information about previous supplier, desired change date and expected yearly consumption\r\n* bank details (for SEPA mandate)\r\n\r\nIf successful, the API returns a customer number and contract number, which uniquely identify the customer and order in the RABOT platform, and can be used in subsequent API calls, e.g. to check the status of the order processing\r\n\r\nBefore submitting the order via the API, you need to ensure that customers have received all the required contract and pricing information, have accepted the terms and conditions (AGB), have confirmed the email address and have accepted the offer.\r\n\r\nOnce the order is received by the RABOT platform, an order confirmation email will be sent out to the email address provided in the order.\r\n\r\n#### Managing user password\r\n\r\nIf the customer email address submitted with the order does not exist in the RABOT platform yet, a new user account is automatically created. If you provide a user password in the API call, this password will be used, and the customer will be able to log into RABOT user interfaces (web portal or mobile app) using email address and password.\r\n\r\nIf no password is provided in the API call, the user account will be created with a random password, and the customer would need to go through a \"forget password\" flow to chose a new password.\r\n\r\n### Checking order status\r\n\r\nAfter the order has been submitted successfully, you can use the `GET /partner/v1/orders` API endpoint to follow the different processing states of the order.\r\n\r\nAn order can have one of the following states:\r\n\r\n| Order status    | Description                                                  |\r\n| --------------- | ------------------------------------------------------------ |\r\n| Open            | The order has been received, but is not being processed yet if required data is missing (e.g. missing meter number) |\r\n| Processing      | The order is being processed, communication with other market actors (grid operators, previous supplier) is ongoing. This can take a few days up to a couple of weeks depending on the actors involved |\r\n| Rejected        | The order has been denied, e.g. due to a negative credit check |\r\n| Revoked         | The customer has revoked the order                           |\r\n| PendingDelivery | The order has been processed, and a contract confirmation has been sent to the customer, including a date for start of delivery |\r\n| Delivery        | The supply contract is active and RABOT is delivering energy to the delivery location |\r\n| Cancelled       | A contract termination has been received and an end of delivery date has been set. This could either be due to a customer actively sending a termination request, or because a customer has chosen a new supplier, and the supplier has communicated the termination request via the market communication processes. |\r\n| Unspecified     | An unknown order state, indicating an error in the communcation with other market actors |\r\n\r\n## Customers and contracts\r\n\r\nThe Partner API can provide access to customer and contract data. Depending on the partnership scope and agreed data privacy policies, the level of access can vary, and you might need to use the customer linking process to allow end users to grant you access to their data.\r\n\r\n### Customer linking process\r\nAn end user can grant your application access to their data by an approval process similar to the OAuth access flow. This involves the following steps:\r\n\r\n* call `POST /partner/v1/customers/link` to receive an `authorizationUrl` link. \r\n* send the user to this link in a Web view. \r\n* The user will be asked to log in using the credentials they used when creating their energy supply contract. \r\n* After login, the user will be asked to grant your application access to their personal and contract related data stored on the Rabot platform.\r\n* When the user approves, the web view will be redirected to the webpage defined by the `successUrl` parameter in the `POST /partner/v1/customers/link` call, and you will be able to access the users data via the API.\r\n\r\n> Note that the link returned by the API only has a limited validity of 10 minutes. If an end user tries to login using the link after the 10 minutes have expired, the login will fail, and you will have to create a new link again to re-start the process.\r\n\r\n#### Managing user reference Ids\r\nThe API offers different ways for you to match customer data in the RABOT platform with the data in your own platform.\r\n\r\n1. You can add a parameter `externalId` to the `POST /partner/v1/customers/link` call. This information is then stored with the customer data in the RABOT platform, and returned as part of the customer data in the `GET /partner/v1/customers` endpoint.\r\n\r\n2. In addition, when the user is redirected after granting your application access to their data, the `successUrl` link is extended with a query parameter `customerNo` that will contain the unique customer number of this customer in the RABOT platform. \r\n\r\n### Contract information\r\nVia the API, you can also get access to data about the indidvidual contracts of a customer. Note that a single customer can have multiple contracts.\r\n\r\nEvery contract initially starts as an order, received either via the web funnel or the API (see [Managing orders](#managing-orders-via-the-api)). Only after the order has been confirmed, and an order confirmation has been sent out to the user, is the order changed to a contract, and visible via the respective endpoint in the API.\r\n\r\n## Contract metrics\r\nThe contract metrics endpoint provides access to pricing and consumption information related to a specific contract. This can be actual recorded data (e.g. consumption values as reported by a Smart Meter) or forecasted data (e.g. consumption data for SLP customers, or day-ahead price energy pricing).\r\n\r\n### MetricType\r\nYou can select the type of information that you want to retrieve by specifying the appropriate `MetricType`:\r\n\r\n| MetricType | Description |\r\n| ---- | --- |\r\n| `Consumption` | The energy consumed during the selected period (in kWh). Can be either measured or estimated. |\r\n| `WorkingPrice` | The estimated average working price (EUR/kWh) in the selected period, including all fees and taxes.|\r\n| `TotalCost` | The total energy cost in the selected period, including all fees and taxes. If the selected period is smaller than a month, the applicable monthly fees will be pro-rated to the period.|\r\n| `Saving` | The monetary savings (in EUR) in the selected period, compared to the local default supplier's tariff pricing.|\r\n| `Co2Saving` | The savings in carbon emissions, commpared to the german energy grid mix.|\r\n\r\n> Note that for `WorkingPrice` and `TotalCost` metrics, the values returned by this API endpoint might not match the amounts reflected on the customers invoice.   \r\n> This is due to the fact that some price conditions or discounts are only calculated on a monthly level. For example a working price cap is only applied when creating the monthly invoice, so the API might return a higher monthly average working price than what is shown on the invoice.\r\n\r\n### ValueType\r\n\r\nYou can use the `ValueType` request parameter to define if you want to only receive recorded data or forecasted data, or both:\r\n\r\n| ValueType | Description |\r\n| - | - |\r\n| `Actual` | return only data based on measurements, e.g. energy consumption reported by the DSO |\r\n| `Forecast` | return only data based on estimations, e.g. consumption estimated based on standard load profiles (SLP), not confirmed by actual meter reading yet | \r\n| `Dynamic` | return either actual or forecasted data for the whole period, but not mixed | \r\n| `Combined` | return either actual or forecasted data. E.g. when querying data for a month on daily level, for some days the API might returned actual data, while for other days might return forecasted data, based on data availability |\r\n\r\n### Periods and Intervals\r\n\r\nThe API allows to retrieve data in different granularity, from to 15 minute intervals, up to aggregation on monthly or yearly level. Use the `interval` parameter to select the aggregation level.\r\nTo limit the size of the result set, depening on the selected `interval`, you can only query a limited time period:\r\n\r\n| interval | maximum period |\r\n| - | - |\r\n| `QuarteryHourly` | 1 day |\r\n| `Hourly` | 3 days |\r\n| `Daily` | 2 months |\r\n| `Weekly` | 1 year |\r\n| `Monthly` | 15 years |\r\n| `Yearly` | 50 years |\r\n\r\nIf you try to request a longer period, the API will return an `HTTP 400` error.\r\n\r\n### Example - 15-min consumption for Smart Meter \r\n\r\nFor contracts that are linked to a Smart Meter, the RABOT platform typically receives the measured consumption values in 15 minutes intervals on the following day. You can use the API to retrieve this information e.g. to display a detailed consumption graph the the user.\r\n\r\nRequest:\r\n```shell\r\ncurl -L \"https://api.rabot-charge.de/partner/v1/customers/87678631/contracts/26765215/metrics?period.from=2025-03-01&period.to=2025-03-02&interval=QuarterHourly&metricType=Consumption&valueType=Actual\" \\\r\n-H \"Authorization: ••••••\"\r\n```\r\n\r\nResponse:\r\n```json\r\n{\r\n    \"data\": {\r\n        \"valueUnitInfo\": \"in kWh\",\r\n        \"consideredDataPeriod\": {\r\n            \"from\": \"2025-03-01 00:00:00\",\r\n            \"to\": \"2025-03-02 00:00:00\"\r\n        },\r\n        \"metricType\": \"Consumption\",\r\n        \"valueType\": \"Actual\",\r\n        \"interval\": \"QuarterHourly\",\r\n        \"intervalDuration\": 96.0000,\r\n        \"averageValuePerInterval\": 0.6148,\r\n        \"totalValue\": 59.0165,\r\n        \"numberOfEntries\": 96,\r\n        \"records\": [\r\n            {\r\n                \"moment\": \"2025-03-01 00:00:00\",\r\n                \"value\": 0.3619,\r\n                \"valueRelevanceType\": \"Actual\"\r\n            },\r\n            {\r\n                \"moment\": \"2025-03-01 00:15:00\",\r\n                \"value\": 0.3486,\r\n                \"valueRelevanceType\": \"Actual\"\r\n            },\r\n            {\r\n                \"moment\": \"2025-03-01 00:30:00\",\r\n                \"value\": 0.3369,\r\n                \"valueRelevanceType\": \"Actual\"\r\n            },\r\n...\r\n            {\r\n                \"moment\": \"2025-03-01 23:30:00\",\r\n                \"value\": 0.5152,\r\n                \"valueRelevanceType\": \"Actual\"\r\n            },\r\n            {\r\n                \"moment\": \"2025-03-01 23:45:00\",\r\n                \"value\": 0.4810,\r\n                \"valueRelevanceType\": \"Actual\"\r\n            }\r\n        ]\r\n    },\r\n    \"isSuccess\": true,\r\n    \"message\": null,\r\n    \"error\": null\r\n}\r\n```\r\n\r\n### Example - Daily energy cost\r\n\r\nYou can easily retrieve the daily energy cost for any contract using the metrics API endpoint:\r\n\r\nRequest:\r\n```shell\r\ncurl -L \"https://api.rabot-charge.de/partner/v1/customers/87678631/contracts/26765215/metrics?period.from=2025-03-01&period.to=2025-04-01&interval=Daily&metricType=TotalCost&valueType=Combined\" \\\r\n-H \"Authorization: ••••••\" \r\n``` \r\n\r\nResponse:\r\n```json\r\n{\r\n    \"data\": {\r\n        \"valueUnitInfo\": \"in Euro\",\r\n        \"consideredDataPeriod\": {\r\n            \"from\": \"2025-03-01 00:00:00\",\r\n            \"to\": \"2025-04-01 00:00:00\"\r\n        },\r\n        \"metricType\": \"TotalCost\",\r\n        \"valueType\": \"Combined\",\r\n        \"interval\": \"Daily\",\r\n        \"intervalDuration\": 30.9583,\r\n        \"averageValuePerInterval\": 16.8718,\r\n        \"totalValue\": 522.3232,\r\n        \"numberOfEntries\": 31,\r\n        \"records\": [\r\n            {\r\n                \"moment\": \"2025-03-01 00:00:00\",\r\n                \"value\": 22.5213,\r\n                \"valueRelevanceType\": \"Actual\"\r\n            },\r\n            {\r\n                \"moment\": \"2025-03-02 00:00:00\",\r\n                \"value\": 18.2885,\r\n                \"valueRelevanceType\": \"Actual\"\r\n            },\r\n...\r\n            {\r\n                \"moment\": \"2025-03-30 00:00:00\",\r\n                \"value\": 6.6829,\r\n                \"valueRelevanceType\": \"Forecast\"\r\n            },\r\n            {\r\n                \"moment\": \"2025-03-31 00:00:00\",\r\n                \"value\": 9.8037,\r\n                \"valueRelevanceType\": \"Forecast\"\r\n            }\r\n        ]\r\n    },\r\n    \"isSuccess\": true,\r\n    \"message\": null,\r\n    \"error\": null\r\n}\r\n```\r\n\r\n### Example - Day-Ahead pricing\r\n\r\nThe metrics endpoint can also be used to get the future energy cost based on the Day Ahead market prices, and including all other fixed and variable fees and taxes. \r\n\r\nRequest:\r\n```shell\r\ncurl -L \"https://api.rabot-charge.de/partner/v1/customers/87678631/contracts/26765215/metrics?period.from=2025-05-05&period.to=2025-05-06&interval=Hourly&metricType=WorkingPrice&valueType=Combined\" \\\r\n-H \"Authorization: ••••••\"\r\n```\r\n\r\nResponse\r\n```json\r\n{\r\n    \"data\": {\r\n        \"valueUnitInfo\": \"in Cent/kWh\",\r\n        \"consideredDataPeriod\": {\r\n            \"from\": \"2025-05-05 00:00:00\",\r\n            \"to\": \"2025-05-06 00:00:00\"\r\n        },\r\n        \"metricType\": \"WorkingPrice\",\r\n        \"valueType\": \"Combined\",\r\n        \"interval\": \"Hourly\",\r\n        \"intervalDuration\": 24.0000,\r\n        \"averageValuePerInterval\": 32.5362,\r\n        \"totalValue\": 780.8697,\r\n        \"numberOfEntries\": 24,\r\n        \"records\": [\r\n            {\r\n                \"moment\": \"2025-05-05 00:00:00\",\r\n                \"value\": 31.0816,\r\n                \"valueRelevanceType\": \"Forecast\"\r\n            },\r\n            {\r\n                \"moment\": \"2025-05-05 01:00:00\",\r\n                \"value\": 30.5259,\r\n                \"valueRelevanceType\": \"Forecast\"\r\n            },\r\n            {\r\n                \"moment\": \"2025-05-05 02:00:00\",\r\n                \"value\": 30.7329,\r\n                \"valueRelevanceType\": \"Forecast\"\r\n            },\r\n            {\r\n                \"moment\": \"2025-05-05 03:00:00\",\r\n                \"value\": 31.0780,\r\n                \"valueRelevanceType\": \"Forecast\"\r\n            },\r\n...\r\n            {\r\n                \"moment\": \"2025-05-05 22:00:00\",\r\n                \"value\": 34.2161,\r\n                \"valueRelevanceType\": \"Forecast\"\r\n            },\r\n            {\r\n                \"moment\": \"2025-05-05 23:00:00\",\r\n                \"value\": 33.3759,\r\n                \"valueRelevanceType\": \"Forecast\"\r\n            }\r\n        ]\r\n    },\r\n    \"isSuccess\": true,\r\n    \"message\": null,\r\n    \"error\": null\r\n}\r\n```\r\n\r\n"
  version: v1
servers: []
security: []
tags:
  - name: Customer
    description: Controller implementing RESTful API to manage customers.
  - name: DayAheadPrices
    description: Provides a RESTful API to perform day-ahead-prices-related operations.
  - name: Order
    description: Provides a RESTful API to perform order-related operations.
  - name: Tariff
    description: Provides a RESTful API to perform tariff-related operations.
paths:
  /partner/v1/orders:
    post:
      tags:
        - Order
      summary: Create a new order
      parameters:
        - name: Partner-Token
          in: header
          description: If arbitrary orders can be created, partner token of partner
          schema:
            type: string
      requestBody:
        description: Request data object
        content:
          application/json:
            schema:
              allOf:
                - $ref: '#/components/schemas/CreateOrderRequestDto'
              description: Information about a new order to be created
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateOrderResponseDto'
components:
  schemas:
    CreateOrderRequestDto:
      type: object
      properties:
        tariffKey:
          type: string
          description: Tariff key of the tariff to be used
          example: RabotSmart
        offerDate:
          type: string
          description: >-
            Date, for which the offer was given. Uses today as default, if not
            provided.
          format: date
          nullable: true
          example: '2025-08-22'
        userAccount:
          allOf:
            - $ref: '#/components/schemas/UserAccountDto'
          description: >-
            Information about user account, that should be created and bound
            with the tariff. If an account for the same user (identified by the
            email address) already exists, the contract is linked to the
            existing user account instead.
        contract:
          allOf:
            - $ref: '#/components/schemas/ContractDto'
          description: >-
            Information about the contract, that should be created for this
            order
        campaignCode:
          type: string
          description: Optional campaign code, if campaign is to be used
          nullable: true
      additionalProperties: false
      description: Information about a new order to be created
    CreateOrderResponseDto:
      type: object
      properties:
        customerNumber:
          type: string
          description: Customer number of created customer
          example: '234567890'
        contractNumber:
          type: string
          description: Number of newly created contract
          example: '345678901'
      additionalProperties: false
    UserAccountDto:
      type: object
      properties:
        customerNumber:
          type: string
          description: Customer number
          nullable: true
          readOnly: true
        emailAddress:
          type: string
          description: >-
            E-mail address of the account. This is used for email communication
            (e.g. when sending the order confirmation), and also serves as the
            login name for the mobile app.
          example: j.doe@example.tld
        phoneNumber:
          type: string
          description: Phone number of the account holder
          nullable: true
          example: '+491234567890'
        password:
          type: string
          description: >-
            Password in plain text. If no password is provided, a random
            password is generated, and the user will have to use the forget
            password flow to define a new password.
          nullable: true
          writeOnly: true
          example: SomeExamplePassword987.
        firstName:
          type: string
          description: First name of the account holder
          nullable: true
          example: Max
        lastName:
          type: string
          description: Last name of the account holder
          nullable: true
          example: Mustermann
        businessName:
          type: string
          description: Company name if this is a business account
          nullable: true
        gender:
          allOf:
            - $ref: '#/components/schemas/Genders'
          description: Gender of the account holder
          nullable: true
        dateOfBirth:
          type: string
          description: Date of birth of the account holder
          format: date
          nullable: true
      additionalProperties: false
      description: Information about user account.
    ContractDto:
      type: object
      properties:
        externalId:
          type: string
          description: External identifier of contract created from an external system.
          nullable: true
          example: urn:acme:contract:ffa98ecb-f28c-442d-b52e-7ffdc97ba676
        salesPersonId:
          type: string
          description: Identifier of the sales person associated with the contract.
          nullable: true
          example: SALESPERSON123
        type:
          allOf:
            - $ref: '#/components/schemas/ContractTypes'
          description: Type of the contract.
          example: Personal
        state:
          allOf:
            - $ref: '#/components/schemas/ContractStateDto'
          description: State of the contract.
          nullable: true
          readOnly: true
        number:
          type: string
          description: Read-only contract number, provided by the API.
          nullable: true
          readOnly: true
          example: '123456789'
        deliveryAddress:
          allOf:
            - $ref: '#/components/schemas/AddressDto'
          description: Delivery address of the contract.
        billingAddress:
          allOf:
            - $ref: '#/components/schemas/AddressDto'
          description: Billing address of the contract.
          nullable: true
          example: null
        bankDetails:
          allOf:
            - $ref: '#/components/schemas/BankDetailsDto'
          description: Bank details of the contract or NULL, when invoice pays due.
          nullable: true
        contractReason:
          allOf:
            - $ref: '#/components/schemas/ContractReasons'
          description: Reason, why the contract was created.
          example: NewDeliveryLocation
        deliveryDetails:
          allOf:
            - $ref: '#/components/schemas/DeliveryDetailsDto'
          description: Information about the point of delivery.
        deliveryState:
          allOf:
            - $ref: '#/components/schemas/DeliveryStateDto'
          description: Delivery state information of the contract.
          nullable: true
          readOnly: true
        agreements:
          allOf:
            - $ref: '#/components/schemas/ContractAgreementsDto'
          description: Contract agreements.
        validFromDate:
          type: string
          description: Contract start date.
          format: date
          nullable: true
          readOnly: true
          example: '2024-01-01'
        validToDate:
          type: string
          description: Contract end date or NULL if no end date.
          format: date
          nullable: true
          readOnly: true
          example: null
        transactionDateTime:
          type: string
          description: |-
            Date and time of the transaction that created this contract.
            If not provided, current date and time is used.
          format: date-time
          nullable: true
          example: '2024-04-01 00:00:00'
        industry:
          allOf:
            - $ref: '#/components/schemas/Industries'
          description: |-
            Represents the industry category associated with the contract,
            indicating the field of business or commercial activity.
          nullable: true
          example: ElectricalEquipment
        legalStructure:
          type: string
          description: >-
            Legal structure of the organization or entity associated with the
            contract.
          nullable: true
          example: GmbH
      additionalProperties: false
      description: Contract data transfer object.
    Genders:
      enum:
        - Male
        - Female
        - Other
      type: string
      description: >-
        Enumeration of genders<p>Members:</p><ul><li><i>Male</i> - Male
        gender</li> <li><i>Female</i> - Female gender</li> <li><i>Other</i> -
        Other or unspecified gender</li> </ul>
    ContractTypes:
      enum:
        - Private
        - Business
      type: string
      description: >-
        Type of contract (private or
        business).<p>Members:</p><ul><li><i>Private</i> - Contract of a private
        person</li> <li><i>Business</i> - Contract of a business</li> </ul>
    ContractStateDto:
      type: object
      properties:
        state:
          allOf:
            - $ref: '#/components/schemas/ContractStates'
          description: Status of contract processing.
          readOnly: true
          example: Rejected
        comment:
          type: string
          description: Additional comment about the contract state.
          nullable: true
          readOnly: true
          example: Contract was rejected by Schufa
      additionalProperties: false
      description: Detailed information about contract state
    AddressDto:
      type: object
      properties:
        title:
          type: string
          description: Academic title or NULL if none
          nullable: true
          example: Dr.
        firstName:
          type: string
          description: First name or NULL if business address
          nullable: true
          example: Thomas
        lastName:
          type: string
          description: Last name or NULL if business address
          nullable: true
          example: Mustermann
        businessName:
          type: string
          description: Business name in case of business address or NULL if person
          nullable: true
          example: null
        gender:
          allOf:
            - $ref: '#/components/schemas/Genders'
          description: Gender of the address holder
          nullable: true
        extension:
          type: string
          description: Address extension
          nullable: true
          example: null
        streetName:
          type: string
          description: Street name
          example: Grüner Weg
        houseNumber:
          type: string
          description: House number or NULL if none
          example: '42'
        city:
          type: string
          description: Name of the city
          example: Berlin
        postCode:
          type: string
          description: Postcode in valid format
          example: '14109'
        countryCode:
          type: string
          description: ISO 3166 A2 code of the country
          example: DE
      additionalProperties: false
      description: Address data transfer object.
    BankDetailsDto:
      type: object
      properties:
        accountHolder:
          type: string
          description: >-
            Name of the account holder. When used to create an order,

            if the value is not provided, the name of the customer from

            billing address (or delivery address, when billing address is not
            provided)

            will be used.
          nullable: true
          example: Thomas Heinrich Mustermann
        iban:
          type: string
          description: IBAN of the account.
          example: DE89370400440532013000
        bic:
          type: string
          description: BIC of the account.
          nullable: true
          example: DEUTDEFF
        bankName:
          type: string
          description: Name of the bank.
          nullable: true
          example: Deutsche Bank
        hasAcceptedDirectDebit:
          type: boolean
          description: Flags, if the direct debit has been accepted.
          example: true
      additionalProperties: false
      description: Bank details data transfer object.
    ContractReasons:
      enum:
        - NewDeliveryLocation
        - ChangeOfSupplier
      type: string
      description: >-
        Enumeration of transaction
        reasons<p>Members:</p><ul><li><i>NewDeliveryLocation</i> - New delivery
        location</li> <li><i>ChangeOfSupplier</i> - Change of supplier</li>
        </ul>
    DeliveryDetailsDto:
      required:
        - previousAnnualConsumptionKwh
      type: object
      properties:
        meterNumber:
          type: string
          description: Identification number of the metering device bound to the contract.
          nullable: true
          example: '123456789'
        maLoIdentifier:
          type: string
          description: |-
            Market location identifier; will be used when provided,
            otherwise it will be retrieved from MaKo service.
          nullable: true
          example: '99987999749'
        meLoIdentifier:
          type: string
          description: |-
            Metering location identifier; will be used when provided,
            otherwise it will be retrieved from MaKo service.
          nullable: true
          example: DE99911149565001246597500M01ID018
        desiredTransitionDate:
          type: string
          description: Date of the desired transition to a new supplier.
          format: date
          nullable: true
          example: '2024-05-01'
        moveInDate:
          type: string
          description: >-
            Date when the customer moves in to a location of delivery point, if
            applicable.
          format: date
          nullable: true
          example: null
        previousSelfCancelledDate:
          type: string
          description: Date of previous contract self-cancellation, if applicable.
          format: date
          nullable: true
          example: '2024-04-22'
        previousSupplierCode:
          type: string
          description: BDEW code of previous supplier, or NULL if none.
          nullable: true
          example: '9979250000006'
        previousAnnualConsumptionKwh:
          type: integer
          description: Previous annual consumption in kWh.
          format: int32
          example: 2600
        capabilities:
          allOf:
            - $ref: '#/components/schemas/DeliveryCapabilitiesDto'
          description: Capabilities of the delivery point.
      additionalProperties: false
      description: Information about the place of delivery and delivery conditions.
    DeliveryStateDto:
      type: object
      properties:
        startDate:
          type: string
          description: Delivery start date.
          format: date
          nullable: true
          example: '2024-02-01'
        endDate:
          type: string
          description: Delivery end date or NULL if not specified.
          format: date
          nullable: true
          example: null
        state:
          allOf:
            - $ref: '#/components/schemas/DeliveryStates'
          description: Current delivery state
          example: InChangeProcess
        message:
          type: string
          description: Message received with the delivery state change from MaKo operator.
          nullable: true
          example: null
        denialReason:
          allOf:
            - $ref: '#/components/schemas/DenialReasons'
          description: Reason for denial if state is "Denied" or NULL otherwise.
          nullable: true
          example: null
        cancellationReason:
          allOf:
            - $ref: '#/components/schemas/CancellationReasons'
          description: Cancellation reason if state is "Canceled" or NULL otherwise.
          nullable: true
          example: null
      additionalProperties: false
      description: Delivery state data transfer object.
    ContractAgreementsDto:
      type: object
      properties:
        termsAndConditions:
          type: boolean
          description: Flags, whether the terms and conditions have been accepted.
          example: true
        privacyPolicy:
          type: boolean
          description: Flags, whether the privacy policy has been accepted.
          example: true
        revocationPolicy:
          type: boolean
          description: Flags, whether the revocation policy has been accepted.
          example: true
      additionalProperties: false
      description: Flags of contract agreements
    Industries:
      enum:
        - None
        - AgricultureForestryLivestockFarmingAndFisheries
        - ChemicalAndPlasticProducts
        - ChurchesAndChurchInstitutions
        - Construction
        - DataProcessing
        - EducationAndTeaching
        - ElectricalEquipment
        - ElectronicAndOpticalProducts
        - FurnitureAndWoodworking
        - Gastronomy
        - GlassAndCeramicProducts
        - HealthAndSocialServices
        - Hospitality
        - MechanicalEngineering
        - MediaAndCommunication
        - MetalProductionAndProcessing
        - MineralOilsAndFuels
        - Mining
        - MotorVehicles
        - PaperGoods
        - PharmaceuticalProducts
        - PrintingAndReproduction
        - PublicAdministration
        - RealEstateAndHousing
        - RegisteredAssociations
        - Retail
        - ServicesConsultingTechnical
        - ServicesFinanceInsuranceLegal
        - ServicesOther
        - SportAndFitness
        - TextilesClothingLeatherGoods
        - Tradework
        - TransportShippingAndWarehousing
        - TravelAndTourism
        - WasteEnvironmentalAndWaterManagement
        - Wholesale
      type: string
      description: >-
        Enumeration of industries.<p>Members:</p><ul><li><i>None</i> - No
        industry specified.</li>
        <li><i>AgricultureForestryLivestockFarmingAndFisheries</i> -
        Agriculture, forestry, livestock, and fisheries.</li>
        <li><i>ChemicalAndPlasticProducts</i> - Chemical and plastic
        products.</li> <li><i>ChurchesAndChurchInstitutions</i> - Churches and
        religious institutions.</li> <li><i>Construction</i> - Construction
        industry.</li> <li><i>DataProcessing</i> - Data processing and IT
        services.</li> <li><i>EducationAndTeaching</i> - Education and teaching
        services.</li> <li><i>ElectricalEquipment</i> - Electrical equipment
        manufacturing.</li> <li><i>ElectronicAndOpticalProducts</i> - Electronic
        and optical products.</li> <li><i>FurnitureAndWoodworking</i> -
        Furniture and woodworking.</li> <li><i>Gastronomy</i> - Gastronomy and
        food services.</li> <li><i>GlassAndCeramicProducts</i> - Glass and
        ceramic products.</li> <li><i>HealthAndSocialServices</i> - Health and
        social services.</li> <li><i>Hospitality</i> - Hospitality and hotel
        industry.</li> <li><i>MechanicalEngineering</i> - Mechanical
        engineering.</li> <li><i>MediaAndCommunication</i> - Media and
        communication.</li> <li><i>MetalProductionAndProcessing</i> - Metal
        production and processing.</li> <li><i>MineralOilsAndFuels</i> - Mineral
        oils and fuels.</li> <li><i>Mining</i> - Mining and extraction.</li>
        <li><i>MotorVehicles</i> - Motor vehicles and automotive.</li>
        <li><i>PaperGoods</i> - Paper goods and manufacturing.</li>
        <li><i>PharmaceuticalProducts</i> - Pharmaceutical products.</li>
        <li><i>PrintingAndReproduction</i> - Printing and reproduction
        services.</li> <li><i>PublicAdministration</i> - Public administration
        and government.</li> <li><i>RealEstateAndHousing</i> - Real estate and
        housing.</li> <li><i>RegisteredAssociations</i> - Registered
        associations and non-profits.</li> <li><i>Retail</i> - Retail
        trade.</li> <li><i>ServicesConsultingTechnical</i> - Technical
        consulting services.</li> <li><i>ServicesFinanceInsuranceLegal</i> -
        Finance, insurance, and legal services.</li> <li><i>ServicesOther</i> -
        Other various services.</li> <li><i>SportAndFitness</i> - Sport and
        fitness industry.</li> <li><i>TextilesClothingLeatherGoods</i> -
        Textiles, clothing, and leather goods.</li> <li><i>Tradework</i> -
        Trades and craftwork.</li> <li><i>TransportShippingAndWarehousing</i> -
        Transport, shipping, and warehousing.</li> <li><i>TravelAndTourism</i> -
        Travel and tourism.</li> <li><i>WasteEnvironmentalAndWaterManagement</i>
        - Waste, environmental, and water management.</li> <li><i>Wholesale</i>
        - Wholesale trade.</li> </ul>
    ContractStates:
      enum:
        - Open
        - Delivery
        - Unspecified
        - PendingDelivery
        - Cancelled
        - Rejected
        - Revoked
        - Processing
      type: string
      description: >-
        Enumeration of contract states<p>Members:</p><ul><li><i>Open</i> -
        Contract is waiting to be processed</li> <li><i>Delivery</i> - Contract
        is in delivery</li> <li><i>Unspecified</i> - Incorrect getec contract
        state</li> <li><i>PendingDelivery</i> - Contract was successfully
        processed and is pending delivery</li> <li><i>Cancelled</i> - Contract
        was cancelled (see delivery state for more details)</li>
        <li><i>Rejected</i> - Contract was rejected</li> <li><i>Revoked</i> -
        Contract was revoked</li> <li><i>Processing</i> - Contract is being
        processed</li> </ul>
    DeliveryCapabilitiesDto:
      type: object
      properties:
        hasElectricVehicle:
          type: boolean
          description: Flag, indicating if the contract holder has an electric vehicle.
          example: false
        hasSmartMeter:
          type: boolean
          description: Flag, indicating if the contract holder has a smart meter.
          example: true
        hasHeatPump:
          type: boolean
          description: Flag, indicating if the contract holder has a heat pump.
          example: true
      additionalProperties: false
      description: Capabilities of a contract holder.
    DeliveryStates:
      enum:
        - None
        - Delivery
        - DeliveryPending
        - CancelledDelivery
        - CancelledPendingDelivery
        - Cancelled
        - Denied
        - Revoked
        - InChangeProcess
        - Unknown
      type: string
      description: >-
        Specifies the state of a delivery of a
        contract.<p>Members:</p><ul><li><i>None</i> - No delivery state
        information.</li> <li><i>Delivery</i> - Contract in delivery.</li>
        <li><i>DeliveryPending</i> - Contract is ready and pending
        delivery.</li> <li><i>CancelledDelivery</i> - Delivery of the contract
        was cancelled.</li> <li><i>CancelledPendingDelivery</i> - Cancellation
        of the delivery is pending.</li> <li><i>Cancelled</i> - Contract was
        cancelled.</li> <li><i>Denied</i> - Contract was denied.</li>
        <li><i>Revoked</i> - Contract was revoked.</li>
        <li><i>InChangeProcess</i> - Contract is in change process.</li>
        <li><i>Unknown</i> - Unknown delivery state.</li> </ul>
    DenialReasons:
      enum:
        - Dunning
        - InsufficientSolvency
        - ContractCommitment
        - Duplicate
        - UnsuccessfulSupplierChange
        - Other
      type: string
      description: >-
        Specifies the reason for a denial of
        contract.<p>Members:</p><ul><li><i>Dunning</i> - Denial due to dunning
        process.</li> <li><i>InsufficientSolvency</i> - SCHUFA score is too
        low.</li> <li><i>ContractCommitment</i> - Denial due to contract
        commitment.</li> <li><i>Duplicate</i> - Denial due to a duplicate
        contract.</li> <li><i>UnsuccessfulSupplierChange</i> - Denial due to an
        unsuccessful supplier change.</li> <li><i>Other</i> - Other
        reasons.</li> </ul>
    CancellationReasons:
      enum:
        - None
        - Dunning
        - OtherSupplier
        - CustomerSupplierChange
        - CustomerRelocation
        - Decommissioning
        - Unknown
        - CustomerProduct
        - CustomerPrice
        - CustomerService
        - CustomerMisc
        - CustomerPriceChange
      type: string
      description: >-
        Specifies the reason for a cancellation of
        contract.<p>Members:</p><ul><li><i>None</i> - No cancellation reason
        specified.</li> <li><i>Dunning</i> - Cancellation due to dunning
        (payment issues).</li> <li><i>OtherSupplier</i> - Cancellation because
        of switching to another supplier.</li> <li><i>CustomerSupplierChange</i>
        - Cancellation initiated by the customer due to supplier change.</li>
        <li><i>CustomerRelocation</i> - Cancellation due to customer
        relocation.</li> <li><i>Decommissioning</i> - Cancellation due to
        decommissioning.</li> <li><i>Unknown</i> - Unknown cancellation
        reason.</li> <li><i>CustomerProduct</i> - Cancellation due to customer
        dissatisfaction with the product.</li> <li><i>CustomerPrice</i> -
        Cancellation due to customer dissatisfaction with the price.</li>
        <li><i>CustomerService</i> - Cancellation due to customer
        dissatisfaction with the service.</li> <li><i>CustomerMisc</i> -
        Cancellation due to miscellaneous customer reasons.</li>
        <li><i>CustomerPriceChange</i> - Cancellation due to a change in price
        for the customer.</li> </ul>

````