> ## 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.

# Post v3producerscontractscharges and creditscsv upload

> This API allows you to credit amounts towards specific customer contracts.
These can be single items or recurring amounts, which will be added to the next customer invoice.
Typical use cases are customer-specific or variable amounts that you want to keep full control over.

An example is bonus payments, which can be granted once as a referral bonus or over
several months/years as a promotional bonus.

Has similar to ChargesAndCreditsCreateAPIView logic, but works with bulk creation from csv file

**Requirements to CSV file format:**
 - Encoding: Unicode, UTF-8;
 - Line ending: Unix/Linux, LF;
 - Headers must be included;
 - Separator: semicolon;
 - Date format: YYYY-MM-DD;
 - Fields:
   - contract_id
   - type_of_transaction
   - amount_cent
   - is_gross
   - vat_type
   - due_date
   - no_of_executions
   - execution_cycle
   - input_id
   - category
   - display_name
   - explanation_text
   - bookkeeping_account

CSV file data example:
```
contract_id;type_of_transaction;amount_cent;is_gross;vat_type;due_date;no_of_executions;execution_cycle;input_id;category;display_name;explanation_text;bookkeeping_account
CC-ID1-001;credit;10000;FALSE;normal;2023-05-30;1;;In_ID_001;Category_001;May_Credit_001 2023;;0001
CC-ID2-002;charge;20000;TRUE;reduced;2023-05-30;1;;In_ID_002;Category_002;May_Charge_001 2023;;0002
```



## OpenAPI

````yaml /lumx_openapi.yaml post /v3/producers/contracts/charges_and_credits/csv_upload/
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/producers/contracts/charges_and_credits/csv_upload/:
    post:
      tags:
        - producers
      description: >-
        This API allows you to credit amounts towards specific customer
        contracts.

        These can be single items or recurring amounts, which will be added to
        the next customer invoice.

        Typical use cases are customer-specific or variable amounts that you
        want to keep full control over.


        An example is bonus payments, which can be granted once as a referral
        bonus or over

        several months/years as a promotional bonus.


        Has similar to ChargesAndCreditsCreateAPIView logic, but works with bulk
        creation from csv file


        **Requirements to CSV file format:**
         - Encoding: Unicode, UTF-8;
         - Line ending: Unix/Linux, LF;
         - Headers must be included;
         - Separator: semicolon;
         - Date format: YYYY-MM-DD;
         - Fields:
           - contract_id
           - type_of_transaction
           - amount_cent
           - is_gross
           - vat_type
           - due_date
           - no_of_executions
           - execution_cycle
           - input_id
           - category
           - display_name
           - explanation_text
           - bookkeeping_account

        CSV file data example:

        ```

        contract_id;type_of_transaction;amount_cent;is_gross;vat_type;due_date;no_of_executions;execution_cycle;input_id;category;display_name;explanation_text;bookkeeping_account

        CC-ID1-001;credit;10000;FALSE;normal;2023-05-30;1;;In_ID_001;Category_001;May_Credit_001
        2023;;0001

        CC-ID2-002;charge;20000;TRUE;reduced;2023-05-30;1;;In_ID_002;Category_002;May_Charge_001
        2023;;0002

        ```
      operationId: producers_contracts_charges_and_credits_csv_upload_create
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: '#/components/schemas/ChargesAndCreditsCSVUpload'
        required: true
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ChargesAndCreditsCSVUploadResponse'
              examples:
                Example1:
                  value:
                    bonus_created:
                      - ABCDEFGH0001:
                          type_of_transaction: credit
                          amount_cent: 1000
                          is_gross: true
                          vat_type: normal
                          due_date: '2022-02-01'
                          input_id: ABCDEFGH0001
                          internal_id: ABCDEFGH0001__1
                          contract_id: CC0001
                          category: non_charging_bonus
                          display_name: Non-charging bonus
                          explanation_text: Diesen Bonus erhalten Sie da Sie noch nicht laden.
                          bookkeeping_account: ''
                          salespartner: salespartner_spid
                      - ABCDEFGH0001:
                          type_of_transaction: credit
                          amount_cent: 1000
                          is_gross: true
                          vat_type: normal
                          due_date: '2022-03-01'
                          input_id: ABCDEFGH0001
                          internal_id: ABCDEFGH0001__2
                          contract_id: CC0001
                          category: non_charging_bonus
                          display_name: Non-charging bonus
                          explanation_text: Diesen Bonus erhalten Sie da Sie noch nicht laden.
                          bookkeeping_account: ''
                          salespartner: salespartner_spid
                  summary: Objects Created
          description: ''
        '400':
          content:
            application/json:
              schema:
                type: object
                additionalProperties: {}
              examples:
                Example1:
                  value:
                    amount_cent:
                      - Ensure this value is greater than or equal to 0.
                    execution_cycle:
                      - >-
                        This field required in case when "no_of_executions"
                        greater than 1.
                  summary: Failed values validation
          description: ''
components:
  schemas:
    ChargesAndCreditsCSVUpload:
      type: object
      properties:
        file:
          type: string
          format: uri
          writeOnly: true
          description: >-
            UTF-8 encoded, semicolon-separated CSV file containing charges and
            credits.
      required:
        - file
    ChargesAndCreditsCSVUploadResponse:
      type: object
      properties:
        bonus_created:
          type: array
          items:
            type: object
            additionalProperties:
              $ref: '#/components/schemas/ChargesAndCreditsFromCSVFile'
          description: Created charges and credits, grouped by the submitted input ID.
      required:
        - bonus_created
    ChargesAndCreditsFromCSVFile:
      type: object
      properties:
        type_of_transaction:
          allOf:
            - $ref: '#/components/schemas/TypeOfTransactionEnum'
          description: >-
            Whether the amount shall be charged or credited towards the
            customers.


            * `credit` - credit

            * `charge` - charge
        amount_cent:
          type: integer
          minimum: 0
          description: Monetary Amount in cent. For example "1000" for 10,00 EUR
        is_gross:
          type: boolean
          description: >-
            Identifier for whether it is a net (excl. VAT) or gross (incl. VAT)
            amount
        vat_type:
          allOf:
            - $ref: '#/components/schemas/VatTypeEnum'
          description: >-
            VAT rate for normal is 19% and reduced is 7%. In case of vat
            changes, the value, which is valid at the due date, will be used. 


            * `normal` - normal

            * `reduced` - reduced
        due_date:
          type: string
          format: date
          description: >-
            Defines which customer bill will include the submitted amount: the
            bill which covers a billing period including this due_date will
            contain the submitted amount.
        no_of_executions:
          type: integer
          minimum: 1
          writeOnly: true
          nullable: true
          description: >-
            In case of recurring payments this field defines how many times the
            submitted amount shall beexecuted. The unit (months, years) is
            defined in the field execution_cycle. If left empty, the value
            defaults to 1 and the amount is only executed once.
        execution_cycle:
          writeOnly: true
          nullable: true
          description: >-
            In case the no_of_executions has been set to a value greater than 1,
            this field is used to define the frequency of the executions.


            * `month` - month

            * `year` - year
          oneOf:
            - $ref: '#/components/schemas/ExecutionCycleEnum'
            - $ref: '#/components/schemas/BlankEnum'
            - $ref: '#/components/schemas/NullEnum'
        input_id:
          type: string
          description: Please submit a unique identifier per contract ID
          maxLength: 128
        internal_id:
          type: string
          readOnly: true
          maxLength: 150
        contract_id:
          type: string
          title: Vertragsnummer
          description: Contract id of the customer
        category:
          type: string
          description: >-
            Describes the nature of the submitted amount, e. g. "Bonus", and is
            used to group values of the same category on the customer facing
            invoice.
          maxLength: 40
        display_name:
          type: string
          description: Display name which is exposed on the customer invoice
          maxLength: 128
        explanation_text:
          type: string
          nullable: true
          description: >-
            Description text explaining the context of the amount. Its displayed
            on the customer invoice
        bookkeeping_account:
          type: string
          description: >-
            The bookkeeping account for this transaction, which will be reported
            back to you in the accounting file. In case of DATEV it is the
            contra account (Gegenkonto).
          maxLength: 128
        salespartner:
          type: string
          title: Vertriebspartner ID
          readOnly: true
      required:
        - amount_cent
        - category
        - contract_id
        - display_name
        - due_date
        - input_id
        - internal_id
        - is_gross
        - salespartner
        - type_of_transaction
        - vat_type
    TypeOfTransactionEnum:
      enum:
        - credit
        - charge
      type: string
      description: |-
        * `credit` - credit
        * `charge` - charge
    VatTypeEnum:
      enum:
        - normal
        - reduced
      type: string
      description: |-
        * `normal` - normal
        * `reduced` - reduced
    ExecutionCycleEnum:
      enum:
        - month
        - year
      type: string
      description: |-
        * `month` - month
        * `year` - year
    BlankEnum:
      enum:
        - ''
    NullEnum:
      enum:
        - null

````

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