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

# Switch Product

> Switches the currently active product of a contract to a new product. A policy check will be performed to verify if the transition between both products is allowed. The old product will still be available but its validity is set until valid_from - 1. The new product will be created with validity starting from valid_from. The contract start (if supported by the products) which may be set with the old product will be reset to valid_from. The old product will maintain the initial contract start associated with the charging session start. The product switch is only possible for contracts which are in status “closed_join” (“Vertrag angemeldet” or “in Belieferung” in the cockpit).



## OpenAPI

````yaml /lumx_openapi.yaml post /v3/consumers/{userID}/contracts/{contractID}/product/switch_product/
openapi: 3.0.3
info:
  title: Lumenaza external API
  version: 3.8.0 (v3)
  description: Specification of the Lumenaza external API.
servers:
  - url: https://api.lumenaza.de/
    description: Produktivserver
  - url: https://api.test.lumenaza.de/
    description: Testserver
security: []
tags:
  - name: Community Data API
    description: >-
      The API is used to retrieve master data and measurement data for a
      community. A community is defined by all customers that belong to your
      company.
paths:
  /v3/consumers/{userID}/contracts/{contractID}/product/switch_product/:
    post:
      tags:
        - consumers
      summary: Switch Product
      description: >-
        Switches the currently active product of a contract to a new product. A
        policy check will be performed to verify if the transition between both
        products is allowed. The old product will still be available but its
        validity is set until valid_from - 1. The new product will be created
        with validity starting from valid_from. The contract start (if supported
        by the products) which may be set with the old product will be reset to
        valid_from. The old product will maintain the initial contract start
        associated with the charging session start. The product switch is only
        possible for contracts which are in status “closed_join” (“Vertrag
        angemeldet” or “in Belieferung” in the cockpit).
      operationId: switch_product
      parameters:
        - in: path
          name: contractID
          schema:
            type: string
            pattern: ^[\w-]+$
          required: true
        - in: path
          name: userID
          schema:
            type: string
            pattern: ^[\w-]+$
          required: true
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ProductSwitch'
          application/x-www-form-urlencoded:
            schema:
              $ref: '#/components/schemas/ProductSwitch'
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/ProductSwitch'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProductSwitchSuccessResponse'
              examples:
                SuccessfulProductSwitch:
                  value:
                    consumer_id: '123456789'
                    contract_id: '987654321'
                  summary: Example of a successful product switch response
          description: ''
        '400':
          content:
            application/json:
              schema:
                type: object
                additionalProperties:
                  type: array
                  items:
                    type: string
                example:
                  email:
                    - Enter a valid email address.
                  non_field_errors:
                    - Invalid combination of fields.
              examples:
                ProductNameNotKnown:
                  value:
                    product_name:
                      - Unknown product name
                  summary: Example of a product name not known response
                ValidationError:InvalidValidFromDate:
                  value:
                    valid_from:
                      - Must be the first of a month
                      - Must be in the future
                  summary: Example of a validation error for invalid valid_from date
          description: DRF validation errors from the runtime request serializer.
        '403':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DetailResponse'
              examples:
                Forbidden:SwitchBetweenProductsNotAllowed:
                  value:
                    detail: Switch between products not allowed
                  summary: >-
                    Example of a forbidden response for switch between products
                    not allowed
          description: The runtime product-switch policy rejected the requested transition.
        '404':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/NotFoundResponse'
              examples:
                ContractIDNotFound:
                  value:
                    detail: Contract ID not found in database
                  summary: Example of a contract ID not found response
                NoActiveProductFound:
                  value:
                    detail: No active product found in database
                  summary: Example of no active product found response
          description: The runtime contract lookup could not find the requested resource.
components:
  schemas:
    ProductSwitch:
      type: object
      properties:
        product_name:
          type: string
        valid_from:
          type: string
          format: date
        product_specifics:
          type: object
          additionalProperties: {}
      required:
        - product_name
        - valid_from
    ProductSwitchSuccessResponse:
      type: object
      properties:
        consumer_id:
          type: string
        contract_id:
          type: string
      required:
        - consumer_id
        - contract_id
    DetailResponse:
      type: object
      properties:
        detail:
          type: string
      required:
        - detail
    NotFoundResponse:
      type: object
      properties:
        detail:
          type: string
      required:
        - detail

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.