openapi: 3.0.3
info:
  title: Account API
  version: 1.191.1
  description: |
    API endpoints to interact with your account.  
    ## Authentication
    Go to your profile settings and generate an access token. Use it as Bearer authentication header.
    ## Request headers
    * `Authorization`: Required - Bearer access token.
    * `X-Account-Uuid`: Required - All endpoints require a `Account-Uuid` header. You can copy the account uuid from the settings page.
    * `Accept-Language`: Optional - two letter code for the preferred locale (en | de | es ...)  
    * `Accept`: Recommended - Use `application/json`  
    ## Status codes
    * 400: Bad Request
    * 403: Forbidden
    * 404: Not found
    * 409: Duplicate
    * 412: Precondition Failed
    * 419: Security Check failed
    * 422: Unprocessable
    * 424: Failed Dependency
  license:
    name: Protected
servers:
  - url: https://api.jupiter-erp.com/
    description: Production
tags:
  - name: Account
  - name: AI Assistant
  - name: Comments
  - name: MediaFiles
  - name: Contacts
  - name: ContactGroups
  - name: ContactFields
  - name: FileFolders
  - name: Files
  - name: CostCenters
  - name: BookingAccountCatalog
  - name: CustomLedgerAccounts
  - name: Projects
  - name: Service objects
  - name: Service orders
  - name: Service order appointments
  - name: Service protocols
  - name: Service protocol templates
  - name: TaskGroups
  - name: Tasks
  - name: TextTemplates
  - name: PrintLayouts
  - name: PrintBackgrounds
  - name: Products
  - name: Custom Documents
  - name: Quotes
  - name: Order Confirmations
  - name: Delivery Notes
  - name: Invoices
  - name: Dunnings
  - name: Credit Notes
  - name: Receipts
  - name: Depreciations
  - name: Recurring Receipts
  - name: DocumentLinks
  - name: Bank Accounts
  - name: Bank Transactions
  - name: Service Contracts
  - name: Locations
  - name: Warehouses
  - name: Personnel
security:
  - BearerAuth: []
  - AccountAuth: []
paths:
  /api/account:
    get:
      operationId: getAccount
      tags:
        - Account
      summary: Get current account information
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Account"
    patch:
      operationId: updateAccount
      tags:
        - Account
      summary: Update current account information
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateAccountRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Account"
  /api/account/configuration:
    get:
      operationId: getAccountConfiguration
      tags:
        - Account
      summary: Get current account configuration
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AccountConfiguration"
  /api/account/configuration/email:
    get:
      operationId: getAccountEmailConfiguration
      tags:
        - Account
      summary: Get current account email configuration
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AccountEmailConfiguration"
  /api/account/configuration/accounting:
    get:
      operationId: getAccountAccountingConfiguration
      tags:
        - Account
      summary: Get current account accounting configuration
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AccountAccountingConfiguration"
  /api/account/configuration/accounting/account-catalog:
    get:
      operationId: listBookingAccountCatalog
      tags:
        - BookingAccountCatalog
      summary: List booking account catalog
      description: Platform booking account catalog grouped by account type and category, with ledger numbers resolved for the account's chart of accounts.
      parameters:
        - name: account_type
          in: query
          required: false
          schema:
            $ref: "#/components/schemas/BookingAccountCatalogType"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListBookingAccountCatalog200Response"
  /api/account/configuration/accounting/account-catalog/custom:
    get:
      operationId: listCustomLedgerAccounts
      tags:
        - CustomLedgerAccounts
      summary: List custom ledger accounts
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListCustomLedgerAccounts200Response"
  /api/account/configuration/accounting/account-catalog/custom/{id}:
    get:
      operationId: getCustomLedgerAccount
      tags:
        - CustomLedgerAccounts
      summary: Get custom ledger account
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomLedgerAccount"
  /api/account/configuration/document:
    get:
      operationId: getAccountDocumentConfiguration
      tags:
        - Account
      summary: Get current account document configuration
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AccountDocumentConfiguration"
  /api/account/configuration/service:
    get:
      operationId: getAccountServiceConfiguration
      tags:
        - Account
      summary: Get service area configuration (number formats for projects and service contracts)
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AccountServiceConfiguration"
  /api/account/ai/files:
    post:
      operationId: createAiAssistantFile
      tags:
        - AI Assistant
      summary: Upload file for AI assistant chat
      description: |
        Upload a file for use in the AI assistant chat. The file is stored in the account drive
        under System → AI Assistant → current user folder.

        Requires session token (PWA login). API tokens are not accepted.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
              properties:
                file:
                  type: string
                  format: binary
                  description: File to attach in the AI assistant chat
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FileItem"
  /api/account/comments:
    get:
      operationId: listComments
      tags:
        - Comments
      summary: List comments of an entity
      parameters:
        - name: entity_type
          in: query
          description: Filter by entity type
          required: false
          schema:
            type: string
        - name: entity_id
          in: query
          description: Filter by entity id
          required: false
          schema:
            type: integer
        - name: user_id
          in: query
          description: Filter by user id
          required: false
          schema:
            type: integer
        - name: order_by
          in: query
          description: Sort by a specific field
          required: false
          schema:
            type: string
            enum:
              - id
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListComments200Response"
    post:
      operationId: createComment
      tags:
        - Comments
      summary: Create comment
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: "#/components/schemas/CreateCommentRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Comment"
  /api/account/comments/{id}:
    patch:
      operationId: updateComment
      tags:
        - Comments
      summary: Update comment
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateCommentRequest"
      responses:
        "200":
          description: Ok
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Comment"
    delete:
      operationId: deleteComment
      tags:
        - Comments
      summary: Delete comment
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/comments/{id}/uploads/{uploadId}:
    delete:
      operationId: deleteCommentUpload
      tags:
        - Comments
      summary: Delete comment upload
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
        - name: uploadId
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/media-files:
    get:
      operationId: listMediaFiles
      tags:
        - MediaFiles
      summary: List Media Files of an entity
      parameters:
        - name: entity_type
          in: query
          description: Filter by entity type
          required: false
          schema:
            $ref: "#/components/schemas/MediaFile/properties/entity_type"
        - name: entity_id
          in: query
          description: Filter by entity id
          required: false
          schema:
            type: integer
        - name: key
          in: query
          description: Filter by key
          required: false
          schema:
            type: string
        - name: user_id
          in: query
          description: Filter by user id
          required: false
          schema:
            type: integer
        - name: order_by
          in: query
          description: Sort by a specific field
          required: false
          schema:
            type: string
            enum:
              - id
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListMediaFiles200Response"
    post:
      operationId: createMediaFile
      tags:
        - MediaFiles
      summary: Create Media File
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: "#/components/schemas/CreateMediaFileRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MediaFile"
  /api/account/media-files/{id}:
    patch:
      operationId: updateMediaFile
      tags:
        - MediaFiles
      summary: Update Media Files
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateMediaFileRequest"
      responses:
        "200":
          description: Ok
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/MediaFile"
    delete:
      operationId: deleteMediaFile
      tags:
        - MediaFiles
      summary: Delete Media Files
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/contacts:
    get:
      operationId: listContacts
      tags:
        - Contacts
      summary: List account contacts
      parameters:
        - name: status
          in: query
          description: Filter by contact lifecycle status. Defaults to active contacts when omitted.
          required: false
          schema:
            $ref: "#/components/schemas/Contact/properties/status"
        - name: parent_id
          in: query
          description: Filter by parent contact ID
          required: false
          schema:
            type: integer
        - name: type
          in: query
          description: Filter by contact type (organisation or person)
          required: false
          schema:
            $ref: "#/components/schemas/Contact/properties/type"
        - name: gender
          in: query
          description: Filter by gender
          required: false
          schema:
            $ref: "#/components/schemas/Contact/properties/gender"
        - name: name
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            $ref: "#/components/schemas/Contact/properties/name"
        - name: first_name
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
            maxLength: 255
        - name: last_name
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
            maxLength: 255
        - name: address_line_1
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
            maxLength: 255
        - name: zip
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
            maxLength: 32
        - name: city
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
            maxLength: 255
        - name: state
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
            maxLength: 255
        - name: country_code
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
            maxLength: 3
        - name: phones
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
            maxLength: 24
        - name: emails
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
            maxLength: 255
        - name: websites
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
            maxLength: 255
        - name: reference_key
          in: query
          description: |
            Search by reference key. Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
            maxLength: 255
        - name: contact_number
          in: query
          description: |
            Search by contact number. Supports SQL-like syntax:  
            - `123*`: begins with `123`  
            - `*123`: ends with `123`  
            - `*123*`: contains `123`  
            - `123`: exact match.
          required: false
          schema:
            type: string
            maxLength: 255
        - name: debtor_number
          in: query
          description: |
            Search by debtor number. Supports SQL-like syntax:  
            - `123*`: begins with `123`  
            - `*123`: ends with `123`  
            - `*123*`: contains `123`  
            - `123`: exact match.
          required: false
          schema:
            type: string
            maxLength: 255
        - name: creditor_number
          in: query
          description: |
            Search by creditor number. Supports SQL-like syntax:  
            - `123*`: begins with `123`  
            - `*123`: ends with `123`  
            - `*123*`: contains `123`  
            - `123`: exact match.
          required: false
          schema:
            type: string
            maxLength: 255
        - name: bank_iban
          in: query
          description: |
            Search by bank IBAN. Supports SQL-like syntax:  
            - `DE89*`: begins with `DE89`  
            - `*DE89`: ends with `DE89`  
            - `*DE89*`: contains `DE89`  
            - `DE89`: exact match.
          required: false
          schema:
            type: string
            maxLength: 50
        - name: vat_id
          in: query
          description: |
            Search by VAT ID. Supports SQL-like syntax:  
            - `DE123*`: begins with `DE123`  
            - `*DE123`: ends with `DE123`  
            - `*DE123*`: contains `DE123`  
            - `DE123`: exact match.
          required: false
          schema:
            type: string
            maxLength: 50
        - name: tax_id
          in: query
          description: |
            Search by tax ID. Supports SQL-like syntax:  
            - `12345*`: begins with `12345`  
            - `*12345`: ends with `12345`  
            - `*12345*`: contains `12345`  
            - `12345`: exact match.
          required: false
          schema:
            type: string
            maxLength: 50
        - name: group_ids[]
          in: query
          description: Filter by group IDs
          required: false
          schema:
            type: array
            items:
              type: integer
              minimum: 0
        - name: created_at_from
          in: query
          description: Filter contacts created on or after this date (YYYY-MM-DD)
          required: false
          schema:
            type: string
            format: date
        - name: created_at_to
          in: query
          description: Filter contacts created on or before this date (YYYY-MM-DD)
          required: false
          schema:
            type: string
            format: date
        - name: updated_at_from
          in: query
          description: Filter contacts updated on or after this date (YYYY-MM-DD)
          required: false
          schema:
            type: string
            format: date
        - name: updated_at_to
          in: query
          description: Filter contacts updated on or before this date (YYYY-MM-DD)
          required: false
          schema:
            type: string
            format: date
        - name: order_by
          in: query
          description: Sort by a specific field
          required: false
          schema:
            type: string
            enum:
              - id
              - parent_id
              - type
              - name
              - first_name
              - last_name
              - address_line_1
              - zip
              - city
              - state
              - country_code
              - reference_key
              - contact_number
              - debtor_number
              - creditor_number
              - created_at
              - updated_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListContacts200Response"
    post:
      operationId: createContact
      tags:
        - Contacts
      summary: Create contact
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateContactRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Contact"
  /api/account/contacts/{id}:
    get:
      operationId: getContact
      tags:
        - Contacts
      summary: Get account contact
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Contact"
    patch:
      operationId: updateContact
      tags:
        - Contacts
      summary: Update contact
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateContactRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Contact"
    delete:
      operationId: deleteContact
      tags:
        - Contacts
      summary: Delete account contact
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/contacts/next:
    get:
      operationId: getNextContact
      tags:
        - Contacts
      summary: Get next Contact
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetNextContact200Response"
  /api/account/contacts/groups/attach:
    post:
      operationId: attachContactsGroups
      tags:
        - Contacts
      summary: Attach contacts to groups
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/BulkContactsGroupsRequest"
      responses:
        "204":
          description: OK
  /api/account/contacts/groups/remove:
    post:
      operationId: removeContactsGroups
      tags:
        - Contacts
      summary: Detach contacts from groups
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/BulkContactsGroupsRequest"
      responses:
        "204":
          description: OK
  /api/account/contact-groups:
    post:
      operationId: createContactGroup
      tags:
        - ContactGroups
      summary: Create contact group
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateContactGroupRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ContactGroup"
    get:
      operationId: listContactGroups
      tags:
        - ContactGroups
      summary: List account contact groups
      parameters:
        - name: name
          in: query
          description: |
            Search by name. Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
            maxLength: 255
        - name: ids[]
          in: query
          required: false
          schema:
            type: array
            items:
              type: integer
              minimum: 0
            minItems: 1
            maxItems: 100
        - name: order_by
          in: query
          description: Sort by a specific field
          required: false
          schema:
            type: string
            enum:
              - id
              - name
              - contacts_count
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListContactGroups200Response"
  /api/account/contact-groups/{id}:
    get:
      operationId: getContactGroup
      tags:
        - ContactGroups
      summary: Get account contact group
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ContactGroup"
    patch:
      operationId: updateContactGroup
      tags:
        - ContactGroups
      summary: Update contact group
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateContactGroupRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ContactGroup"
    delete:
      operationId: deleteContactGroup
      tags:
        - ContactGroups
      summary: Delete account contact group
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/contact-fields:
    get:
      operationId: listContactFields
      tags:
        - ContactFields
      summary: List ContactFields
      parameters:
        - name: order_by
          in: query
          description: Sort by a specific field
          required: false
          schema:
            type: string
            enum:
              - id
              - key
              - name
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListContactFields200Response"
    post:
      operationId: createContactField
      tags:
        - ContactFields
      summary: Create ContactFields
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateContactFieldRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ContactField"
  /api/account/contact-fields/{id}:
    get:
      operationId: getContactField
      tags:
        - ContactFields
      summary: Get ContactFields
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ContactField"
    patch:
      operationId: updateContactField
      tags:
        - ContactFields
      summary: Update ContactFields
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateContactFieldRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ContactField"
    delete:
      operationId: deleteContactField
      tags:
        - ContactFields
      summary: Delete ContactFields
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/file-folders:
    get:
      operationId: listFileFolders
      tags:
        - FileFolders
      summary: List file folders
      parameters:
        - name: parent_id
          in: query
          description: Filter by parent folder ID
          required: false
          schema:
            type: integer
        - name: order_by
          in: query
          description: Sort by a specific field
          required: false
          schema:
            type: string
            enum:
              - id
              - name
              - ordering
              - last_name
              - files_count
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListFileFolders200Response"
    post:
      operationId: createFileFolder
      tags:
        - FileFolders
      summary: Create file folder
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateFileFolderRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FileFolder"
  /api/account/file-folders/{id}:
    get:
      operationId: getFileFolder
      tags:
        - FileFolders
      summary: Get file folder
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FileFolder"
    patch:
      operationId: updateFileFolder
      tags:
        - FileFolders
      summary: Update file folder
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateFileFolderRequest"
      responses:
        "200":
          description: Updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FileFolder"
    delete:
      operationId: deleteFileFolder
      tags:
        - FileFolders
      summary: Delete file folder
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/file-folders/tree:
    get:
      operationId: getFileFoldersTree
      tags:
        - FileFolders
      summary: Get file folders tree
      parameters:
        - $ref: "#/components/parameters/OrderDirParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetFileFoldersTree200Response"
  /api/account/files:
    get:
      operationId: listFiles
      tags:
        - Files
      summary: List files
      parameters:
        - name: folder_id
          in: query
          description: Filter by folder ID
          required: false
          schema:
            type: integer
        - name: inbox
          in: query
          description: Selects only inbox files
          required: false
          schema:
            type: integer
            maximum: 1
            minimum: 0
        - name: trash
          in: query
          description: Selects only deleted files
          required: false
          schema:
            type: integer
            maximum: 1
            minimum: 0
        - name: category
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
        - name: date_from
          in: query
          description: Search from date
          required: false
          schema:
            type: string
            format: YYYY-mm-dd
        - name: date_to
          in: query
          description: Search to date
          required: false
          schema:
            type: string
            format: YYYY-mm-dd
        - name: contact_id
          in: query
          description: Filter by contact ID
          required: false
          schema:
            type: integer
        - name: file_name
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          schema:
            type: string
        - name: created_user_id
          in: query
          description: Filter by user ID
          required: false
          schema:
            type: integer
        - name: created_at_from
          in: query
          description: Search from created_at
          required: false
          schema:
            type: string
            format: date-time
            example: 2025-01-14T13:51:15.000Z
            description: Last update timestamp in ISO 8601 format.
        - name: created_at_to
          in: query
          description: Search to created_at
          required: false
          schema:
            type: string
            format: date-time
            example: 2025-01-14T13:51:15.000Z
            description: Last update timestamp in ISO 8601 format.
        - name: order_by
          in: query
          description: Sort by a specific field
          required: false
          schema:
            type: string
            enum:
              - id
              - date
              - file_name
              - file_bytes
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListFiles200Response"
    post:
      operationId: createFile
      tags:
        - Files
      summary: Create File
      requestBody:
        content:
          multipart/form-data:
            schema:
              $ref: "#/components/schemas/CreateFileRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FileItem"
  /api/account/files/categories:
    get:
      operationId: listFileCategories
      tags:
        - Files
      summary: List file categories
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListFileCategories200Response"
  /api/account/files/{id}/download-link:
    get:
      operationId: getFileDownloadLink
      tags:
        - Files
      summary: Get download link for a file
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
        - name: disposition
          in: query
          required: false
          schema:
            type: string
            enum:
              - inline
              - attachment
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetFileDownloadLink200Response"
  /api/account/files/{id}/base64:
    get:
      operationId: getFileData
      tags:
        - Files
      summary: Get file
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            text/plain:
              example: data:application/pdf;base64,JVBERi0xLjQKJ...
              schema:
                type: string
  /api/account/files/{id}:
    get:
      operationId: getFile
      tags:
        - Files
      summary: Get file
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FileItem"
    patch:
      operationId: updateFile
      tags:
        - Files
      summary: Update File
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateFileRequest"
      responses:
        "200":
          description: Updated
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/FileItem"
    delete:
      operationId: deleteFile
      tags:
        - Files
      summary: Delete File
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
        - name: force
          in: query
          required: false
          description: set to 1 if the file should not be moved to the trash folder but force-deleted instead
          schema:
            type: integer
            minimum: 0
            maximum: 1
      responses:
        "204":
          description: Deleted
  /api/account/cost-centers:
    post:
      operationId: createCostCenter
      tags:
        - CostCenters
      summary: Create CostCenters
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateCostCenterRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CostCenter"
    get:
      operationId: listCostCenters
      tags:
        - CostCenters
      summary: List CostCenters
      parameters:
        - name: order_by
          in: query
          description: Sort by a specific field
          required: false
          schema:
            type: string
            enum:
              - id
              - name
              - code
              - booking_account_number
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListCostCenters200Response"
  /api/account/cost-centers/{id}:
    get:
      operationId: getCostCenter
      tags:
        - CostCenters
      summary: Get CostCenters
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CostCenter"
    patch:
      operationId: updateCostCenter
      tags:
        - CostCenters
      summary: Update CostCenters
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateCostCenterRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CostCenter"
    delete:
      operationId: deleteCostCenter
      tags:
        - CostCenters
      summary: Delete CostCenters
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/depreciations:
    get:
      operationId: listDepreciations
      tags:
        - Depreciations
      summary: List fixed assets with depreciation schedules
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  items:
                    type: array
                    items:
                      type: object
                      properties:
                        receipt_position_id:
                          type: integer
                        receipt_id:
                          type: integer
                        receipt_reference:
                          type: string
                          nullable: true
                        issuer_reference:
                          type: string
                          nullable: true
                        contact_name:
                          type: string
                          nullable: true
                        receipt_date:
                          type: string
                          format: date
                        description:
                          type: string
                          nullable: true
                        acquisition_amount_cents:
                          type: integer
                        book_value_cents:
                          type: integer
                        depreciation_method:
                          type: string
                          enum:
                            - linear
                            - gwg
                        depreciation_useful_life_years:
                          type: integer
                          nullable: true
                        asset_ledger_account_number:
                          type: string
                          nullable: true
                        asset_ledger_account_name:
                          type: string
                          nullable: true
                      required:
                        - receipt_position_id
                        - receipt_id
                        - receipt_date
                        - acquisition_amount_cents
                        - book_value_cents
                        - depreciation_method
                required:
                  - items
  /api/account/depreciations/{receiptPositionId}/plan:
    get:
      operationId: getDepreciationPlan
      tags:
        - Depreciations
      summary: Get depreciation plan for a receipt position
      parameters:
        - name: receiptPositionId
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                properties:
                  plan:
                    type: array
                    items:
                      type: object
                      properties:
                        period_start:
                          type: string
                          format: date
                        period_end:
                          type: string
                          format: date
                        period_year:
                          type: integer
                        amount:
                          type: integer
                        book_value_start:
                          type: integer
                        book_value_end:
                          type: integer
                      required:
                        - period_start
                        - period_end
                        - period_year
                        - amount
                        - book_value_start
                        - book_value_end
                required:
                  - plan
  /api/account/receipts:
    post:
      operationId: createReceipt
      tags:
        - Receipts
      summary: Create receipt
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateReceiptRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Receipt"
    get:
      operationId: listReceipts
      tags:
        - Receipts
      summary: List receipts
      parameters:
        - name: receipt_type
          in: query
          schema:
            type: string
            enum:
              - expense
              - income
        - name: search
          in: query
          description: |
            Search in reference (receipt number), issuer reference, and contact name.
            Supports SQL-like syntax:
            - `test*`: begins with `test`
            - `*test`: ends with `test`
            - `*test*`: contains `test`
            - `test`: exact match.
          schema:
            type: string
        - name: date_from
          in: query
          schema:
            type: string
            format: date
        - name: date_to
          in: query
          schema:
            type: string
            format: date
        - name: due_date_from
          in: query
          schema:
            type: string
            format: date
        - name: due_date_to
          in: query
          schema:
            type: string
            format: date
        - name: sum_gross_from
          in: query
          schema:
            type: integer
        - name: sum_gross_to
          in: query
          schema:
            type: integer
        - name: amount_open_from
          in: query
          schema:
            type: integer
        - name: amount_open_to
          in: query
          schema:
            type: integer
        - name: currency_code
          in: query
          description: Filter by receipt currency (ISO 4217, e.g. EUR, USD).
          schema:
            type: string
            minLength: 3
            maxLength: 3
        - name: status
          in: query
          schema:
            type: string
            enum:
              - draft
              - open
              - partially_paid
              - paid
              - cancelled
        - name: reference
          in: query
          schema:
            type: string
        - name: issuer_reference
          in: query
          schema:
            type: string
        - name: account_user_id
          in: query
          schema:
            type: integer
        - name: contact_id
          in: query
          schema:
            type: integer
        - name: project_id
          in: query
          schema:
            type: integer
        - name: service_order_id
          in: query
          schema:
            type: integer
        - name: cost_center_id
          in: query
          schema:
            type: integer
        - name: recurring_receipt_id
          in: query
          description: Filter receipts generated from the given recurring receipt template (Dauerbeleg).
          schema:
            type: integer
        - name: booking_account_catalog_id
          in: query
          description: Filter receipts that have at least one position with this platform booking account catalog entry.
          schema:
            type: integer
        - name: custom_ledger_account_id
          in: query
          description: Filter receipts that have at least one position with this account custom ledger account.
          schema:
            type: integer
        - $ref: "#/components/parameters/RecordLockedQueryParameter"
        - name: order_by
          in: query
          schema:
            type: string
            enum:
              - id
              - date
              - created_at
              - reference
              - status
              - due_date
              - sum_gross
              - amount_open
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListReceipts200Response"
  /api/account/receipts/stage-file:
    post:
      operationId: stageReceiptFile
      tags:
        - Receipts
      summary: Stage receipt document file
      description: |
        Upload a receipt document (PDF or image) for later attachment to a receipt.
        Does not start analysis. Use createReceipt/updateReceipt with the returned file_hash,
        or POST /receipts/{id}/analyze after the file is attached.
      requestBody:
        required: true
        content:
          multipart/form-data:
            schema:
              type: object
              required:
                - file
              properties:
                file:
                  type: string
                  format: binary
                  description: Receipt document (PDF, PNG, or JPG)
      responses:
        "201":
          description: Created - file staged
          content:
            application/json:
              schema:
                x-internal: true
                type: object
                title: StageReceiptFile201Response
                properties:
                  file_hash:
                    type: string
                    description: SHA-256 hash to attach via createReceipt or updateReceipt file_hash.
                    pattern: ^[a-f0-9]{64}$
                required:
                  - file_hash
  /api/account/receipts/{id}:
    get:
      operationId: getReceipt
      tags:
        - Receipts
      summary: Get receipt
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Receipt"
    patch:
      operationId: updateReceipt
      tags:
        - Receipts
      summary: Update receipt
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateReceiptRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Receipt"
    delete:
      operationId: deleteReceipt
      tags:
        - Receipts
      summary: Delete receipt
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: No Content
  /api/account/receipts/{id}/e-invoice-xml:
    get:
      operationId: getReceiptEInvoiceXml
      tags:
        - Receipts
      summary: Get receipt ZUGFeRD XML
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/EInvoiceXml"
  /api/account/receipts/{id}/analyze:
    post:
      operationId: analyzeReceipt
      tags:
        - Receipts
      summary: Analyze receipt document
      description: |
        Start async OCR/AI extraction for the document attached to a draft receipt.
        Results are applied to the receipt when the job completes. Can be called multiple times
        (for example after replacing the document).
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "202":
          description: Accepted - analysis started
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/AnalyzeReceiptFile202Response"
  /api/account/receipts/{id}/analysis:
    get:
      operationId: getReceiptAnalysis
      tags:
        - Receipts
      summary: Get receipt document analysis status
      description: |
        Returns the status of the most recent analysis job for the receipt.
        Poll while status is pending or processing.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ReceiptFileAnalysisStatus"
  /api/account/receipts/{id}/payments:
    post:
      operationId: createReceiptPayment
      tags:
        - Receipts
      summary: Record payment on receipt
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateReceiptPaymentRequest"
      responses:
        "201":
          description: Created; returns updated receipt with amount_open and payments
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Receipt"
  /api/account/receipts/{id}/payments/{paymentId}:
    delete:
      operationId: deleteReceiptPayment
      tags:
        - Receipts
      summary: Delete a payment from a receipt (reverts amount_open)
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
          description: Receipt ID
        - name: paymentId
          in: path
          required: true
          schema:
            type: integer
          description: Document payment ID
        - name: delete_bank_transaction
          in: query
          required: false
          schema:
            type: boolean
            default: false
          description: When true, also deletes the linked manual bank transaction if it has no other payment allocations.
      responses:
        "200":
          description: OK; returns updated receipt
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Receipt"
        "404":
          description: Receipt or payment not found
  /api/account/receipts/{id}/reset:
    post:
      operationId: resetReceipt
      tags:
        - Receipts
      summary: Reset receipt to draft
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Receipt"
  /api/account/receipts/{id}/set-open:
    post:
      operationId: setReceiptOpen
      tags:
        - Receipts
      summary: Set receipt status to open
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Receipt"
  /api/account/receipts/{id}/set-partially-paid:
    post:
      operationId: setReceiptPartiallyPaid
      tags:
        - Receipts
      summary: Set receipt status to partially paid
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Receipt"
  /api/account/receipts/{id}/set-paid:
    post:
      operationId: setReceiptPaid
      tags:
        - Receipts
      summary: Set receipt status to paid
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Receipt"
  /api/account/receipts/{id}/set-cancelled:
    post:
      operationId: setReceiptCancelled
      tags:
        - Receipts
      summary: Set receipt status to cancelled
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Receipt"
  /api/account/recurring-receipts:
    get:
      operationId: listRecurringReceipts
      tags:
        - Recurring Receipts
      summary: List recurring receipts
      parameters:
        - name: search
          in: query
          schema:
            type: string
        - name: status
          in: query
          schema:
            type: string
            enum:
              - active
              - inactive
        - name: receipt_type
          in: query
          schema:
            type: string
            enum:
              - expense
              - income
        - name: contact_id
          in: query
          schema:
            type: integer
        - name: project_id
          in: query
          schema:
            type: integer
        - name: cost_center_id
          in: query
          schema:
            type: integer
        - name: account_user_id
          in: query
          schema:
            type: integer
        - name: interval_unit
          in: query
          schema:
            type: string
            enum:
              - day
              - week
              - month
              - year
        - name: automatic_generation
          in: query
          schema:
            type: boolean
        - name: next_run_on_or_before
          in: query
          schema:
            type: string
            format: date
        - name: order_by
          in: query
          schema:
            type: string
            enum:
              - id
              - name
              - status
              - receipt_type
              - automatic_generation
              - first_period_start
              - end_date
              - next_run_date
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListRecurringReceipts200Response"
    post:
      operationId: createRecurringReceipt
      tags:
        - Recurring Receipts
      summary: Create recurring receipt
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateRecurringReceiptRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RecurringReceipt"
  /api/account/recurring-receipts/{id}:
    get:
      operationId: getRecurringReceipt
      tags:
        - Recurring Receipts
      summary: Get recurring receipt
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RecurringReceipt"
    patch:
      operationId: updateRecurringReceipt
      tags:
        - Recurring Receipts
      summary: Update recurring receipt
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateRecurringReceiptRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RecurringReceipt"
    delete:
      operationId: deleteRecurringReceipt
      tags:
        - Recurring Receipts
      summary: Delete recurring receipt
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: No Content
  /api/account/recurring-receipts/{id}/next-receipt:
    post:
      operationId: createRecurringReceiptNextReceipt
      tags:
        - Recurring Receipts
      summary: Create the next due receipt from a recurring receipt
      description: |
        Generates the receipt for the next due period of this recurring receipt template (manual trigger).
        Returns 409 when a receipt for the next period already exists and 422 when the template is inactive,
        no next period is available, or the feature/limit prevents creation.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Receipt"
  /api/account/locations:
    post:
      operationId: createLocation
      tags:
        - Locations
      summary: Create Location
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateLocationRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Location"
    get:
      operationId: listLocations
      tags:
        - Locations
      summary: List Locations
      parameters:
        - name: search
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
        - name: active
          in: query
          description: Filter by active status
          required: false
          schema:
            type: boolean
        - name: order_by
          in: query
          description: Sort by a specific field
          required: false
          schema:
            type: string
            enum:
              - id
              - name
              - code
              - city
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                title: ListLocations200Response
                properties:
                  data:
                    type: array
                    items:
                      $ref: "#/components/schemas/Location"
                  meta:
                    $ref: "#/components/schemas/PaginationMetaData"
                required:
                  - data
                  - meta
  /api/account/locations/{id}:
    get:
      operationId: getLocation
      tags:
        - Locations
      summary: Get Location
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Location"
    patch:
      operationId: updateLocation
      tags:
        - Locations
      summary: Update Location
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateLocationRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Location"
    delete:
      operationId: deleteLocation
      tags:
        - Locations
      summary: Delete Location
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/warehouses:
    post:
      operationId: createWarehouse
      tags:
        - Warehouses
      summary: Create Warehouse
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateWarehouseRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Warehouse"
    get:
      operationId: listWarehouses
      tags:
        - Warehouses
      summary: List Warehouses
      parameters:
        - name: search
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
        - name: location_id
          in: query
          description: Filter by location ID
          required: false
          schema:
            type: integer
        - name: active
          in: query
          description: Filter by active status
          required: false
          schema:
            type: boolean
        - name: order_by
          in: query
          description: Sort by a specific field
          required: false
          schema:
            type: string
            enum:
              - id
              - name
              - code
              - city
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListWarehouses200Response"
  /api/account/warehouses/{id}:
    get:
      operationId: getWarehouse
      tags:
        - Warehouses
      summary: Get Warehouse
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Warehouse"
    patch:
      operationId: updateWarehouse
      tags:
        - Warehouses
      summary: Update Warehouse
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateWarehouseRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Warehouse"
    delete:
      operationId: deleteWarehouse
      tags:
        - Warehouses
      summary: Delete Warehouse
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/personnel:
    post:
      operationId: createPersonnel
      tags:
        - Personnel
      summary: Create Personnel
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreatePersonnelRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Personnel"
    get:
      operationId: listPersonnel
      tags:
        - Personnel
      summary: List Personnel
      parameters:
        - name: search
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
        - name: location_id
          in: query
          description: Filter by location ID
          required: false
          schema:
            type: integer
        - name: active
          in: query
          description: Filter by active status
          required: false
          schema:
            type: boolean
        - name: order_by
          in: query
          description: Sort by a specific field
          required: false
          schema:
            type: string
            enum:
              - id
              - first_name
              - last_name
              - position
              - department
              - employee_number
              - hire_date
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListPersonnel200Response"
  /api/account/personnel/{id}:
    get:
      operationId: getPersonnel
      tags:
        - Personnel
      summary: Get Personnel
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Personnel"
    patch:
      operationId: updatePersonnel
      tags:
        - Personnel
      summary: Update Personnel
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdatePersonnelRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Personnel"
    delete:
      operationId: deletePersonnel
      tags:
        - Personnel
      summary: Delete Personnel
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/projects:
    get:
      operationId: listProjects
      tags:
        - Projects
      summary: List projects
      parameters:
        - name: search
          in: query
          description: |
            Search in project number and name (Bezeichnung).
            Supports SQL-like syntax: `test*`, `*test`, `*test*`, `test`.
          required: false
          schema:
            type: string
        - name: name
          in: query
          description: |
            Filter by project name only.
            Supports SQL-like syntax: `test*`, `*test`, `*test*`, `test`.
          required: false
          schema:
            type: string
        - name: status
          in: query
          required: false
          schema:
            type: string
            enum:
              - pending
              - active
              - completed
              - archived
        - name: contact_id
          in: query
          required: false
          schema:
            type: integer
        - name: account_user_id
          in: query
          required: false
          schema:
            type: integer
        - name: order_by
          in: query
          description: Sort by a specific field
          required: false
          schema:
            type: string
            enum:
              - id
              - number
              - name
              - status
              - start_date
              - end_date
              - contact_id
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListProjects200Response"
    post:
      operationId: createProject
      tags:
        - Projects
      summary: Create project
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateProjectRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Project"
  /api/account/projects/next:
    get:
      operationId: getNextProjectNumber
      tags:
        - Projects
      summary: Get next suggested project number and formatted string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                title: GetNextProjectNumber200Response
                properties:
                  number:
                    type: integer
                  formatted_number:
                    type: string
                  format:
                    type: string
                required:
                  - number
                  - formatted_number
                  - format
  /api/account/projects/{id}:
    get:
      operationId: getProject
      tags:
        - Projects
      summary: Get project
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Project"
    patch:
      operationId: updateProject
      tags:
        - Projects
      summary: Update project
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateProjectRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Project"
    delete:
      operationId: deleteProject
      tags:
        - Projects
      summary: Delete project
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/service-objects:
    get:
      operationId: listServiceObjects
      tags:
        - Service objects
      summary: List service objects
      parameters:
        - name: search
          in: query
          description: |
            Search in formatted number, name, serial number, and location.
            Supports SQL-like syntax: `test*`, `*test`, `*test*`, `test`.
          required: false
          schema:
            type: string
        - name: name
          in: query
          required: false
          schema:
            type: string
        - name: contact_id
          in: query
          required: false
          schema:
            type: integer
        - name: type
          in: query
          required: false
          schema:
            type: string
            enum:
              - machine
              - building
              - device
              - vehicle
              - other
        - name: status
          in: query
          required: false
          schema:
            type: string
            enum:
              - active
              - inactive
        - name: order_by
          in: query
          required: false
          schema:
            type: string
            enum:
              - id
              - number
              - name
              - type
              - serial_number
              - status
              - installed_at
              - contact_id
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListServiceObjects200Response"
    post:
      operationId: createServiceObject
      tags:
        - Service objects
      summary: Create service object
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateServiceObjectRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServiceObject"
  /api/account/service-objects/next:
    get:
      operationId: getNextServiceObjectNumber
      tags:
        - Service objects
      summary: Get next suggested service object number and formatted string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetNextServiceObjectNumber200Response"
  /api/account/service-objects/{id}:
    get:
      operationId: getServiceObject
      tags:
        - Service objects
      summary: Get service object
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServiceObject"
    patch:
      operationId: updateServiceObject
      tags:
        - Service objects
      summary: Update service object
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateServiceObjectRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServiceObject"
    delete:
      operationId: deleteServiceObject
      tags:
        - Service objects
      summary: Delete service object
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/service-orders:
    get:
      operationId: listServiceOrders
      tags:
        - Service orders
      summary: List service orders
      parameters:
        - name: search
          in: query
          description: |
            Search in formatted number, subject, reference, name line 1, buyer reference.
            Supports SQL-like syntax: `test*`, `*test`, `*test*`, `test`.
          required: false
          schema:
            type: string
        - name: formatted_number
          in: query
          description: |
            Filter by formatted number. Supports SQL-like syntax (same as search).
          required: false
          schema:
            type: string
        - name: service_date_from
          in: query
          description: |
            Lower bound (inclusive) for the order’s `service_date_from` (date part).
          required: false
          schema:
            type: string
            format: date
        - name: service_date_to
          in: query
          description: |
            Upper bound (inclusive) for the order’s `service_date_from` (date part).
          required: false
          schema:
            type: string
            format: date
        - name: sum_net_from
          in: query
          required: false
          schema:
            type: integer
            nullable: true
        - name: sum_net_to
          in: query
          required: false
          schema:
            type: integer
            nullable: true
        - name: subject
          in: query
          required: false
          schema:
            type: string
        - name: status
          in: query
          required: false
          schema:
            type: string
            enum:
              - open
              - planned
              - in_progress
              - done
              - invoiced
              - cancelled
        - name: contact_id
          in: query
          required: false
          schema:
            type: integer
        - name: cost_center_id
          in: query
          required: false
          schema:
            type: integer
        - name: account_user_id
          in: query
          description: Filter by contact person on the order (Ansprechpartner).
          required: false
          schema:
            type: integer
        - name: assignee_account_user_id
          in: query
          description: Filter by field assignee (Bearbeiter) for scheduling.
          required: false
          schema:
            type: integer
        - name: project_id
          in: query
          required: false
          schema:
            type: integer
        - name: service_contract_id
          in: query
          required: false
          schema:
            type: integer
        - $ref: "#/components/parameters/ServiceObjectIdQueryParameter"
        - name: order_by
          in: query
          required: false
          schema:
            type: string
            enum:
              - id
              - number
              - formatted_number
              - service_date_from
              - status
              - subject
              - sum_net
              - sum_gross
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListServiceOrders200Response"
    post:
      operationId: createServiceOrder
      tags:
        - Service orders
      summary: Create service order
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateServiceOrderRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServiceOrder"
  /api/account/service-orders/next:
    get:
      operationId: getNextServiceOrderNumber
      tags:
        - Service orders
      summary: Get next suggested service order number and formatted string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetNextServiceOrderNumber200Response"
  /api/account/service-orders/{id}:
    get:
      operationId: getServiceOrder
      tags:
        - Service orders
      summary: Get service order
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServiceOrder"
    patch:
      operationId: updateServiceOrder
      tags:
        - Service orders
      summary: Update service order
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateServiceOrderRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServiceOrder"
    delete:
      operationId: deleteServiceOrder
      tags:
        - Service orders
      summary: Delete service order
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/service-order-appointments:
    get:
      operationId: listServiceOrderAppointments
      tags:
        - Service order appointments
      summary: List service order appointments
      parameters:
        - name: service_order_id
          in: query
          required: false
          description: Filter by service order.
          schema:
            type: integer
        - name: contact_id
          in: query
          required: false
          description: Filter by contact (via linked service order).
          schema:
            type: integer
        - name: project_id
          in: query
          required: false
          description: Filter by project (via linked service order).
          schema:
            type: integer
        - name: service_contract_id
          in: query
          required: false
          description: Filter by service contract (via linked service order).
          schema:
            type: integer
        - name: status
          in: query
          required: false
          schema:
            type: string
            enum:
              - planned
              - confirmed
              - completed
              - cancelled
        - name: assignee_account_user_id
          in: query
          required: false
          schema:
            type: integer
        - name: starts_from
          in: query
          required: false
          description: Filter appointments with starts_at on or after this date (Y-m-d).
          schema:
            type: string
            format: date
        - name: starts_to
          in: query
          required: false
          description: Filter appointments with starts_at on or before this date (Y-m-d).
          schema:
            type: string
            format: date
        - name: order_by
          in: query
          required: false
          schema:
            type: string
            enum:
              - id
              - service_order_id
              - starts_at
              - ends_at
              - status
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListServiceOrderAppointments200Response"
    post:
      operationId: createServiceOrderAppointment
      tags:
        - Service order appointments
      summary: Create a service order appointment (schedule slice for Gantt)
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateServiceOrderAppointmentRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServiceOrderAppointment"
  /api/account/service-order-appointments/{id}:
    get:
      operationId: getServiceOrderAppointment
      tags:
        - Service order appointments
      summary: Get a service order appointment
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServiceOrderAppointment"
    patch:
      operationId: updateServiceOrderAppointment
      tags:
        - Service order appointments
      summary: Update a service order appointment
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateServiceOrderAppointmentRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServiceOrderAppointment"
    delete:
      operationId: deleteServiceOrderAppointment
      tags:
        - Service order appointments
      summary: Delete a service order appointment
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/service-protocols:
    get:
      operationId: listServiceProtocols
      tags:
        - Service protocols
      summary: List service protocols
      parameters:
        - name: search
          in: query
          required: false
          schema:
            type: string
        - name: name
          in: query
          required: false
          schema:
            type: string
        - name: service_order_id
          in: query
          required: false
          description: Filter protocols linked to this service order.
          schema:
            type: integer
        - name: service_object_id
          in: query
          required: false
          description: Filter protocols linked to this service object.
          schema:
            type: integer
        - name: account_user_id
          in: query
          required: false
          description: Filter protocols by linked account user (responsible user on the protocol).
          schema:
            type: integer
        - name: date_from
          in: query
          required: false
          description: Lower bound (inclusive) for the protocol `date` (date part).
          schema:
            type: string
            format: date
        - name: date_to
          in: query
          required: false
          description: Upper bound (inclusive) for the protocol `date` (date part).
          schema:
            type: string
            format: date
        - name: order_by
          in: query
          required: false
          schema:
            type: string
            enum:
              - id
              - number
              - name
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListServiceProtocols200Response"
    post:
      operationId: createServiceProtocol
      tags:
        - Service protocols
      summary: Create service protocol
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateServiceProtocolRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServiceProtocol"
  /api/account/service-protocols/next:
    get:
      operationId: getNextServiceProtocolNumber
      tags:
        - Service protocols
      summary: Get next suggested service protocol number and formatted string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetNextServiceProtocolNumber200Response"
  /api/account/service-protocols/{id}:
    get:
      operationId: getServiceProtocol
      tags:
        - Service protocols
      summary: Get service protocol
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServiceProtocol"
    patch:
      operationId: updateServiceProtocol
      tags:
        - Service protocols
      summary: Update service protocol
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateServiceProtocolRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServiceProtocol"
    delete:
      operationId: deleteServiceProtocol
      tags:
        - Service protocols
      summary: Delete service protocol
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/service-protocol-templates:
    get:
      operationId: listServiceProtocolTemplates
      tags:
        - Service protocol templates
      summary: List service protocol templates
      parameters:
        - name: name
          in: query
          description: |
            Supports SQL-like syntax:
            - `test*`: begins with `test`
            - `*test`: ends with `test`
            - `*test*`: contains `test`
            - `test`: exact match.
          required: false
          schema:
            type: string
        - name: order_by
          in: query
          description: Sort by a specific field
          required: false
          schema:
            type: string
            enum:
              - id
              - name
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListServiceProtocolTemplates200Response"
    post:
      operationId: createServiceProtocolTemplate
      tags:
        - Service protocol templates
      summary: Create service protocol template
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateServiceProtocolTemplateRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServiceProtocolTemplate"
  /api/account/service-protocol-templates/{id}:
    get:
      operationId: getServiceProtocolTemplate
      tags:
        - Service protocol templates
      summary: Get service protocol template
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServiceProtocolTemplate"
    patch:
      operationId: updateServiceProtocolTemplate
      tags:
        - Service protocol templates
      summary: Update service protocol template
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateServiceProtocolTemplateRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServiceProtocolTemplate"
    delete:
      operationId: deleteServiceProtocolTemplate
      tags:
        - Service protocol templates
      summary: Delete service protocol template
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/task-groups:
    get:
      operationId: listTaskGroups
      tags:
        - TaskGroups
      summary: List TaskGroups
      parameters:
        - name: entity_type
          in: query
          required: true
          schema:
            type: string
        - name: entity_id
          in: query
          required: true
          schema:
            type: integer
        - name: order_by
          in: query
          description: Sort by a specific field
          required: false
          schema:
            type: string
            enum:
              - name
              - ordering
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListTaskGroups200Response"
    post:
      operationId: createTaskGroup
      tags:
        - TaskGroups
      summary: Create TaskGroups
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateTaskGroupRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TaskGroup"
  /api/account/task-groups/{id}:
    get:
      operationId: getTaskGroup
      tags:
        - TaskGroups
      summary: Get TaskGroups
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TaskGroup"
    patch:
      operationId: updateTaskGroup
      tags:
        - TaskGroups
      summary: Update TaskGroups
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateTaskGroupRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TaskGroup"
    delete:
      operationId: deleteTaskGroup
      tags:
        - TaskGroups
      summary: Delete TaskGroups
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/tasks:
    get:
      operationId: listTasks
      tags:
        - Tasks
      summary: List Tasks
      parameters:
        - name: task_group_id
          in: query
          required: true
          schema:
            type: integer
        - name: order_by
          in: query
          description: Sort by a specific field
          required: false
          schema:
            type: string
            enum:
              - name
              - ordering
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListTasks200Response"
    post:
      operationId: createTask
      tags:
        - Tasks
      summary: Create Tasks
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateTaskRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Task"
  /api/account/tasks/{id}:
    get:
      operationId: getTask
      tags:
        - Tasks
      summary: Get Tasks
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Task"
    patch:
      operationId: updateTask
      tags:
        - Tasks
      summary: Update Tasks
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateTaskRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Task"
    delete:
      operationId: deleteTask
      tags:
        - Tasks
      summary: Delete Tasks
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/tasks/groups/{groupId}/attach:
    post:
      operationId: attachTasksToGroup
      tags:
        - Tasks
      summary: Attach Tasks to Group
      parameters:
        - name: groupId
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/AttachTasksToGroupRequest"
      responses:
        "204":
          description: OK
  /api/account/tasks/groups/{groupId}/remove:
    post:
      operationId: detachTasksFromGroup
      tags:
        - Tasks
      summary: Detach Tasks from Group
      parameters:
        - name: groupId
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DetachTasksFromGroupRequest"
      responses:
        "204":
          description: OK
  /api/account/tasks/groups/{groupId}/sort:
    post:
      operationId: sortTasksInGroup
      tags:
        - Tasks
      summary: Sort Tasks in Group
      parameters:
        - name: groupId
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/SortTasksInGroupRequest"
      responses:
        "204":
          description: OK
  /api/account/print-layouts:
    get:
      operationId: listPrintLayouts
      tags:
        - PrintLayouts
      summary: List PrintLayouts
      parameters:
        - name: order_by
          in: query
          description: Sort by a specific field
          required: false
          schema:
            type: string
            enum:
              - id
              - name
              - is_default
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListPrintLayouts200Response"
    post:
      operationId: createPrintLayout
      tags:
        - PrintLayouts
      summary: Create PrintLayouts
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreatePrintLayoutRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PrintLayout"
  /api/account/print-layouts/templates/{layout_name}:
    get:
      operationId: getPrintLayoutTemplate
      tags:
        - PrintLayouts
      summary: Get PrintLayout template
      parameters:
        - name: layout_name
          in: path
          required: true
          schema:
            type: string
            enum:
              - default
              - classic
              - modern
              - elegant
              - minimal
              - accent
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PrintLayoutTemplate"
  /api/account/print-layouts/{id}:
    get:
      operationId: getPrintLayout
      tags:
        - PrintLayouts
      summary: Get PrintLayouts
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PrintLayout"
    patch:
      operationId: updatePrintLayout
      tags:
        - PrintLayouts
      summary: Update PrintLayouts
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdatePrintLayoutRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PrintLayout"
    delete:
      operationId: deletePrintLayout
      tags:
        - PrintLayouts
      summary: Delete PrintLayouts
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/print-backgrounds:
    get:
      operationId: listPrintBackgrounds
      tags:
        - PrintBackgrounds
      summary: List PrintBackgrounds
      parameters:
        - name: order_by
          in: query
          description: Sort by a specific field
          required: false
          schema:
            type: string
            enum:
              - id
              - name
              - is_default
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListPrintBackgrounds200Response"
    post:
      operationId: createPrintBackground
      tags:
        - PrintBackgrounds
      summary: Create PrintBackgrounds
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreatePrintBackgroundRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PrintBackground"
  /api/account/print-backgrounds/{id}:
    get:
      operationId: getPrintBackground
      tags:
        - PrintBackgrounds
      summary: Get PrintBackgrounds
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PrintBackground"
    patch:
      operationId: updatePrintBackground
      tags:
        - PrintBackgrounds
      summary: Update PrintBackgrounds
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdatePrintBackgroundRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/PrintBackground"
    delete:
      operationId: deletePrintBackground
      tags:
        - PrintBackgrounds
      summary: Delete PrintBackgrounds
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/text-templates:
    get:
      operationId: listTextTemplates
      tags:
        - TextTemplates
      summary: List TextTemplates
      parameters:
        - name: name
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
        - name: types[]
          in: query
          required: false
          schema:
            type: array
            items:
              $ref: "#/components/schemas/TextTemplate/properties/type"
        - name: document_types[]
          in: query
          required: false
          schema:
            type: array
            items:
              $ref: "#/components/schemas/TextTemplate/properties/document_type"
        - name: positions[]
          in: query
          required: false
          schema:
            type: array
            items:
              $ref: "#/components/schemas/TextTemplate/properties/position"
        - name: is_default
          in: query
          required: false
          schema:
            type: boolean
        - name: order_by
          in: query
          description: Sort by a specific field
          required: false
          schema:
            type: string
            enum:
              - id
              - name
              - type
              - document_type
              - position
              - is_default
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListTextTemplates200Response"
    post:
      operationId: createTextTemplate
      tags:
        - TextTemplates
      summary: Create TextTemplates
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateTextTemplateRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TextTemplate"
  /api/account/text-templates/{id}:
    get:
      operationId: getTextTemplate
      tags:
        - TextTemplates
      summary: Get TextTemplates
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TextTemplate"
    patch:
      operationId: updateTextTemplate
      tags:
        - TextTemplates
      summary: Update TextTemplates
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateTextTemplateRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/TextTemplate"
    delete:
      operationId: deleteTextTemplate
      tags:
        - TextTemplates
      summary: Delete TextTemplates
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/products:
    get:
      operationId: listProducts
      tags:
        - Products
      summary: List Products
      parameters:
        - name: name
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
        - name: sku
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
        - name: type
          in: query
          required: false
          schema:
            type: string
            enum:
              - physical
              - virtual
              - service
        - name: price_net_from
          in: query
          required: false
          schema:
            type: integer
        - name: price_net_to
          in: query
          required: false
          schema:
            type: integer
        - name: order_by
          in: query
          description: Sort by a specific field
          required: false
          schema:
            type: string
            enum:
              - id
              - name
              - sku
              - price_net
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListProducts200Response"
    post:
      operationId: createProduct
      tags:
        - Products
      summary: Create Products
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateProductRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Product"
  /api/account/products/{id}:
    get:
      operationId: getProduct
      tags:
        - Products
      summary: Get Products
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Product"
    patch:
      operationId: updateProduct
      tags:
        - Products
      summary: Update Products
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateProductRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Product"
    delete:
      operationId: deleteProduct
      tags:
        - Products
      summary: Delete Products
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/custom-documents:
    get:
      operationId: listCustomDocuments
      tags:
        - Custom Documents
      summary: List custom documents
      parameters:
        - name: number
          in: query
          required: false
          schema:
            type: integer
        - name: search
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
        - name: formatted_number
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
        - name: date_from
          in: query
          required: false
          schema:
            type: string
        - name: date_to
          in: query
          required: false
          schema:
            type: string
        - name: status
          in: query
          required: false
          schema:
            type: string
            enum:
              - draft
              - saved
              - sent
        - name: reference
          in: query
          required: false
          schema:
            type: string
        - name: account_user_id
          in: query
          required: false
          schema:
            type: integer
        - name: subject
          in: query
          required: false
          schema:
            type: string
        - name: contact_id
          in: query
          required: false
          schema:
            type: integer
        - name: project_id
          in: query
          required: false
          schema:
            type: integer
        - name: service_contract_id
          in: query
          required: false
          schema:
            type: integer
        - name: service_order_id
          in: query
          required: false
          schema:
            type: integer
        - $ref: "#/components/parameters/ServiceObjectIdQueryParameter"
        - name: order_by
          in: query
          description: Sort by a specific field
          required: false
          schema:
            type: string
            enum:
              - id
              - formatted_number
              - status
              - date
              - subject
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListCustomDocuments200Response"
    post:
      operationId: createCustomDocument
      tags:
        - Custom Documents
      summary: Create custom document
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateCustomDocumentRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomDocument"
  /api/account/custom-documents/next:
    get:
      operationId: getNextCustomDocument
      tags:
        - Custom Documents
      summary: Get next custom document
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetNextCustomDocument200Response"
  /api/account/custom-documents/{id}:
    get:
      operationId: getCustomDocument
      tags:
        - Custom Documents
      summary: Get custom documents
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomDocument"
    patch:
      operationId: updateCustomDocument
      tags:
        - Custom Documents
      summary: Update custom documents
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateCustomDocumentRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomDocument"
    delete:
      operationId: deleteCustomDocument
      tags:
        - Custom Documents
      summary: Delete custom documents
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/custom-documents/{id}/save:
    post:
      operationId: saveCustomDocument
      tags:
        - Custom Documents
      summary: Save custom document
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomDocument"
  /api/account/custom-documents/{id}/reset:
    post:
      operationId: resetCustomDocument
      tags:
        - Custom Documents
      summary: Reset custom document
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomDocument"
  /api/account/custom-documents/{id}/send:
    post:
      operationId: sendCustomDocument
      tags:
        - Custom Documents
      summary: Mark custom document as sent
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DocumentSend"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CustomDocument"
  /api/account/custom-documents/{id}/document-links:
    post:
      operationId: createCustomDocumentDocumentLink
      tags:
        - Custom Documents
      summary: Link custom-documents to another document (manual related)
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateDocumentLinkRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RelatedDocumentSummary"
        "403":
          description: Forbidden (e.g. cannot delete derived_from via wrong endpoint)
  /api/account/quotes:
    get:
      operationId: listQuotes
      tags:
        - Quotes
      summary: List Quotes
      parameters:
        - name: search
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
        - name: number
          in: query
          required: false
          schema:
            type: integer
        - name: formatted_number
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
        - name: date_from
          in: query
          required: false
          schema:
            type: string
        - name: date_to
          in: query
          required: false
          schema:
            type: string
        - name: due_date_from
          in: query
          required: false
          schema:
            type: string
        - name: due_date_to
          in: query
          required: false
          schema:
            type: string
        - name: sum_net_from
          in: query
          required: false
          schema:
            type: number
            nullable: true
        - name: sum_net_to
          in: query
          required: false
          schema:
            type: number
            nullable: true
        - name: status
          in: query
          required: false
          schema:
            type: string
            enum:
              - draft
              - open
              - accepted
              - rejected
        - name: reference
          in: query
          required: false
          schema:
            type: string
        - name: account_user_id
          in: query
          required: false
          schema:
            type: integer
        - name: subject
          in: query
          required: false
          schema:
            type: string
        - name: contact_id
          in: query
          required: false
          schema:
            type: integer
        - name: project_id
          in: query
          required: false
          schema:
            type: integer
        - name: service_contract_id
          in: query
          required: false
          schema:
            type: integer
        - name: service_order_id
          in: query
          required: false
          schema:
            type: integer
        - $ref: "#/components/parameters/ServiceObjectIdQueryParameter"
        - name: order_by
          in: query
          description: Sort by a specific field
          required: false
          schema:
            type: string
            enum:
              - id
              - formatted_number
              - status
              - date
              - due_date
              - sum_net
              - subject
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListQuotes200Response"
    post:
      operationId: createQuote
      tags:
        - Quotes
      summary: Create Quotes
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateQuoteRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Quote"
  /api/account/quotes/next:
    get:
      operationId: getNextQuote
      tags:
        - Quotes
      summary: Get next Quote
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                title: GetNextQuote200Response
                properties:
                  number:
                    type: integer
                  formatted_number:
                    type: string
                  format:
                    type: string
                  text:
                    type: object
                    title: GetNextQuote200ResponseText
                    properties:
                      subject:
                        type: string
                      top:
                        type: string
                      bottom:
                        type: string
                required:
                  - number
                  - formatted_number
                  - format
  /api/account/quotes/{id}:
    get:
      operationId: getQuote
      tags:
        - Quotes
      summary: Get Quote
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Quote"
    patch:
      operationId: updateQuote
      tags:
        - Quotes
      summary: Update Quote
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateQuoteRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Quote"
    delete:
      operationId: deleteQuote
      tags:
        - Quotes
      summary: Delete Quotes
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/quotes/{id}/save:
    post:
      operationId: saveQuote
      tags:
        - Quotes
      summary: Save Quote
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Quote"
  /api/account/quotes/{id}/reset:
    post:
      operationId: resetQuote
      tags:
        - Quotes
      summary: Reset Quote
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Quote"
  /api/account/quotes/{id}/send:
    post:
      operationId: sendQuote
      tags:
        - Quotes
      summary: Mark Quote as sent
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DocumentSend"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Quote"
  /api/account/quotes/{id}/accept:
    post:
      operationId: acceptQuote
      tags:
        - Quotes
      summary: Accept Quote
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Quote"
  /api/account/quotes/{id}/reject:
    post:
      operationId: rejectQuote
      tags:
        - Quotes
      summary: Reject Quote
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Quote"
  /api/account/quotes/{id}/open:
    post:
      operationId: openQuote
      tags:
        - Quotes
      summary: Open Quote
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Quote"
  /api/account/quotes/{id}/document-links:
    post:
      operationId: createQuoteDocumentLink
      tags:
        - Quotes
      summary: Link quotes to another document (manual related)
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateDocumentLinkRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RelatedDocumentSummary"
        "403":
          description: Forbidden (e.g. cannot delete derived_from via wrong endpoint)
  /api/account/order-confirmations:
    get:
      operationId: listOrderConfirmations
      tags:
        - Order Confirmations
      summary: List Order Confirmations
      parameters:
        - name: number
          in: query
          required: false
          schema:
            type: integer
        - name: search
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
        - name: formatted_number
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
        - name: date_from
          in: query
          required: false
          schema:
            type: string
        - name: date_to
          in: query
          required: false
          schema:
            type: string
        - name: sum_net_from
          in: query
          required: false
          schema:
            type: number
            nullable: true
        - name: sum_net_to
          in: query
          required: false
          schema:
            type: number
            nullable: true
        - name: status
          in: query
          required: false
          schema:
            type: string
            enum:
              - draft
              - open
              - accepted
              - rejected
        - name: reference
          in: query
          required: false
          schema:
            type: string
        - name: account_user_id
          in: query
          required: false
          schema:
            type: integer
        - name: subject
          in: query
          required: false
          schema:
            type: string
        - name: contact_id
          in: query
          required: false
          schema:
            type: integer
        - name: project_id
          in: query
          required: false
          schema:
            type: integer
        - name: service_contract_id
          in: query
          required: false
          schema:
            type: integer
        - name: service_order_id
          in: query
          required: false
          schema:
            type: integer
        - $ref: "#/components/parameters/ServiceObjectIdQueryParameter"
        - name: order_by
          in: query
          description: Sort by a specific field
          required: false
          schema:
            type: string
            enum:
              - id
              - formatted_number
              - status
              - date
              - sum_net
              - subject
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListOrderConfirmations200Response"
    post:
      operationId: createOrderConfirmation
      tags:
        - Order Confirmations
      summary: Create Order Confirmation
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateOrderConfirmationRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OrderConfirmation"
  /api/account/order-confirmations/next:
    get:
      operationId: getNextOrderConfirmation
      tags:
        - Order Confirmations
      summary: Get next Order Confirmation
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                title: GetNextOrderConfirmation200Response
                properties:
                  number:
                    type: integer
                  formatted_number:
                    type: string
                  format:
                    type: string
                  text:
                    type: object
                    title: GetNextOrderConfirmation200ResponseText
                    properties:
                      subject:
                        type: string
                      top:
                        type: string
                      bottom:
                        type: string
                required:
                  - number
                  - formatted_number
                  - format
  /api/account/order-confirmations/{id}:
    get:
      operationId: getOrderConfirmation
      tags:
        - Order Confirmations
      summary: Get Order Confirmation
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OrderConfirmation"
    patch:
      operationId: updateOrderConfirmation
      tags:
        - Order Confirmations
      summary: Update Order Confirmation
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateOrderConfirmationRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OrderConfirmation"
    delete:
      operationId: deleteOrderConfirmation
      tags:
        - Order Confirmations
      summary: Delete Order Confirmation
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/order-confirmations/{id}/save:
    post:
      operationId: saveOrderConfirmation
      tags:
        - Order Confirmations
      summary: Save Order Confirmation
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OrderConfirmation"
  /api/account/order-confirmations/{id}/reset:
    post:
      operationId: resetOrderConfirmation
      tags:
        - Order Confirmations
      summary: Reset Order Confirmation
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OrderConfirmation"
  /api/account/order-confirmations/{id}/send:
    post:
      operationId: sendOrderConfirmation
      tags:
        - Order Confirmations
      summary: Mark Order Confirmation as sent
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DocumentSend"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OrderConfirmation"
  /api/account/order-confirmations/{id}/accept:
    post:
      operationId: acceptOrderConfirmation
      tags:
        - Order Confirmations
      summary: Accept Order Confirmation
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OrderConfirmation"
  /api/account/order-confirmations/{id}/reject:
    post:
      operationId: rejectOrderConfirmation
      tags:
        - Order Confirmations
      summary: Reject Order Confirmation
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OrderConfirmation"
  /api/account/order-confirmations/{id}/open:
    post:
      operationId: openOrderConfirmation
      tags:
        - Order Confirmations
      summary: Open Order Confirmation
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/OrderConfirmation"
  /api/account/order-confirmations/{id}/document-links:
    post:
      operationId: createOrderConfirmationDocumentLink
      tags:
        - Order Confirmations
      summary: Link order-confirmations to another document (manual related)
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateDocumentLinkRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RelatedDocumentSummary"
        "403":
          description: Forbidden (e.g. cannot delete derived_from via wrong endpoint)
  /api/account/delivery-notes:
    get:
      operationId: listDeliveryNotes
      tags:
        - Delivery Notes
      summary: List Delivery Notes
      parameters:
        - name: number
          in: query
          required: false
          schema:
            type: integer
        - name: search
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
        - name: formatted_number
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
        - name: date_from
          in: query
          required: false
          schema:
            type: string
        - name: date_to
          in: query
          required: false
          schema:
            type: string
        - name: sum_net_from
          in: query
          required: false
          schema:
            type: number
            nullable: true
        - name: sum_net_to
          in: query
          required: false
          schema:
            type: number
            nullable: true
        - name: status
          in: query
          required: false
          schema:
            type: string
            enum:
              - draft
              - open
              - accepted
              - rejected
        - name: reference
          in: query
          required: false
          schema:
            type: string
        - name: account_user_id
          in: query
          required: false
          schema:
            type: integer
        - name: subject
          in: query
          required: false
          schema:
            type: string
        - name: contact_id
          in: query
          required: false
          schema:
            type: integer
        - name: project_id
          in: query
          required: false
          schema:
            type: integer
        - name: service_contract_id
          in: query
          required: false
          schema:
            type: integer
        - name: service_order_id
          in: query
          required: false
          schema:
            type: integer
        - $ref: "#/components/parameters/ServiceObjectIdQueryParameter"
        - name: order_by
          in: query
          description: Sort by a specific field
          required: false
          schema:
            type: string
            enum:
              - id
              - formatted_number
              - status
              - date
              - sum_net
              - subject
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListDeliveryNotes200Response"
    post:
      operationId: createDeliveryNote
      tags:
        - Delivery Notes
      summary: Create Delivery Note
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateDeliveryNoteRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DeliveryNote"
  /api/account/delivery-notes/next:
    get:
      operationId: getNextDeliveryNote
      tags:
        - Delivery Notes
      summary: Get next Delivery Note
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                title: GetNextDeliveryNote200Response
                properties:
                  number:
                    type: integer
                  formatted_number:
                    type: string
                  format:
                    type: string
                  text:
                    type: object
                    title: GetNextDeliveryNote200ResponseText
                    properties:
                      subject:
                        type: string
                      top:
                        type: string
                      bottom:
                        type: string
                required:
                  - number
                  - formatted_number
                  - format
  /api/account/delivery-notes/{id}:
    get:
      operationId: getDeliveryNote
      tags:
        - Delivery Notes
      summary: Get Delivery Note
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DeliveryNote"
    patch:
      operationId: updateDeliveryNote
      tags:
        - Delivery Notes
      summary: Update Delivery Note
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateDeliveryNoteRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DeliveryNote"
    delete:
      operationId: deleteDeliveryNote
      tags:
        - Delivery Notes
      summary: Delete Delivery Note
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/delivery-notes/{id}/save:
    post:
      operationId: saveDeliveryNote
      tags:
        - Delivery Notes
      summary: Save Delivery Note
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DeliveryNote"
  /api/account/delivery-notes/{id}/reset:
    post:
      operationId: resetDeliveryNote
      tags:
        - Delivery Notes
      summary: Reset Delivery Note
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DeliveryNote"
  /api/account/delivery-notes/{id}/send:
    post:
      operationId: sendDeliveryNote
      tags:
        - Delivery Notes
      summary: Mark Delivery Note as sent
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DocumentSend"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DeliveryNote"
  /api/account/delivery-notes/{id}/accept:
    post:
      operationId: acceptDeliveryNote
      tags:
        - Delivery Notes
      summary: Accept Delivery Note
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DeliveryNote"
  /api/account/delivery-notes/{id}/reject:
    post:
      operationId: rejectDeliveryNote
      tags:
        - Delivery Notes
      summary: Reject Delivery Note
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DeliveryNote"
  /api/account/delivery-notes/{id}/open:
    post:
      operationId: openDeliveryNote
      tags:
        - Delivery Notes
      summary: Open Delivery Note
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/DeliveryNote"
  /api/account/delivery-notes/{id}/document-links:
    post:
      operationId: createDeliveryNoteDocumentLink
      tags:
        - Delivery Notes
      summary: Link delivery-notes to another document (manual related)
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateDocumentLinkRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RelatedDocumentSummary"
        "403":
          description: Forbidden (e.g. cannot delete derived_from via wrong endpoint)
  /api/account/invoices:
    get:
      operationId: listInvoices
      tags:
        - Invoices
      summary: List Invoices
      parameters:
        - name: number
          in: query
          required: false
          schema:
            type: integer
        - name: search
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
        - name: formatted_number
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
        - name: date_from
          in: query
          required: false
          schema:
            type: string
        - name: date_to
          in: query
          required: false
          schema:
            type: string
        - name: due_date_from
          in: query
          required: false
          schema:
            type: string
        - name: due_date_to
          in: query
          required: false
          schema:
            type: string
        - name: sum_net_from
          in: query
          required: false
          schema:
            type: number
            nullable: true
        - name: sum_net_to
          in: query
          required: false
          schema:
            type: number
        - name: amount_open_from
          in: query
          required: false
          description: Filter by open amount (cents) >= value
          schema:
            type: integer
            nullable: true
        - name: amount_open_to
          in: query
          required: false
          description: Filter by open amount (cents) <= value
          schema:
            type: integer
            nullable: true
        - name: status
          in: query
          required: false
          schema:
            type: string
            enum:
              - draft
              - open
              - partially_paid
              - paid
              - cancelled
        - name: reference
          in: query
          required: false
          schema:
            type: string
        - name: account_user_id
          in: query
          required: false
          schema:
            type: integer
        - name: subject
          in: query
          required: false
          schema:
            type: string
        - name: contact_id
          in: query
          required: false
          schema:
            type: integer
        - name: cost_center_id
          in: query
          required: false
          schema:
            type: integer
        - name: project_id
          in: query
          required: false
          schema:
            type: integer
        - name: service_contract_id
          in: query
          required: false
          schema:
            type: integer
        - name: service_order_id
          in: query
          required: false
          schema:
            type: integer
        - $ref: "#/components/parameters/ServiceObjectIdQueryParameter"
        - $ref: "#/components/parameters/RecordLockedQueryParameter"
        - name: order_by
          in: query
          description: Sort by a specific field
          required: false
          schema:
            type: string
            enum:
              - id
              - formatted_number
              - status
              - date
              - due_date
              - sum_net
              - subject
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListInvoices200Response"
    post:
      operationId: createInvoice
      tags:
        - Invoices
      summary: Create Invoice
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateInvoiceRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Invoice"
  /api/account/invoices/next:
    get:
      operationId: getNextInvoice
      tags:
        - Invoices
      summary: Get next Invoice
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                title: GetNextInvoice200Response
                properties:
                  number:
                    type: integer
                  formatted_number:
                    type: string
                  format:
                    type: string
                  text:
                    type: object
                    title: GetNextInvoice200ResponseText
                    properties:
                      subject:
                        type: string
                      top:
                        type: string
                      bottom:
                        type: string
                required:
                  - number
                  - formatted_number
                  - format
  /api/account/invoices/{id}:
    get:
      operationId: getInvoice
      tags:
        - Invoices
      summary: Get Invoice
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Invoice"
    patch:
      operationId: updateInvoice
      tags:
        - Invoices
      summary: Update Invoice
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateInvoiceRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Invoice"
    delete:
      operationId: deleteInvoice
      tags:
        - Invoices
      summary: Delete Invoice
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/invoices/{id}/save:
    post:
      operationId: saveInvoice
      tags:
        - Invoices
      summary: Save Invoice
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Invoice"
  /api/account/invoices/{id}/reset:
    post:
      operationId: resetInvoice
      tags:
        - Invoices
      summary: Reset Invoice
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Invoice"
  /api/account/invoices/{id}/send:
    post:
      operationId: sendInvoice
      tags:
        - Invoices
      summary: Mark Invoice as sent
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DocumentSend"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Invoice"
  /api/account/invoices/{id}/cancel:
    post:
      operationId: cancelInvoice
      tags:
        - Invoices
      summary: Cancel invoice via credit note
      description: |
        Creates a credit note from the given invoice and links it to the invoice.
        By default the credit note is finalized and, when the invoice has an open amount,
        offset against the invoice without bank transactions (full cancellation when amounts match).
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CancelInvoiceRequest"
      responses:
        "201":
          description: Created - The credit note (finalized and settled by default)
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreditNote"
  /api/account/invoices/{id}/dunning:
    post:
      operationId: createDunningFromInvoice
      tags:
        - Invoices
      summary: Create dunning from invoice
      description: Creates a draft dunning (Mahnung) for the given invoice. The backend determines the next dunning level, pre-fills due date and fee from document configuration, and returns the new dunning. The frontend should redirect to the dunnings list and open this dunning.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "201":
          description: Created - The new dunning (draft)
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Dunning"
  /api/account/invoices/{id}/set-open:
    post:
      operationId: setInvoiceOpen
      tags:
        - Invoices
      summary: Set invoice status to open
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Invoice"
  /api/account/invoices/{id}/set-partially-paid:
    post:
      operationId: setInvoicePartiallyPaid
      tags:
        - Invoices
      summary: Set invoice status to partially paid
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Invoice"
  /api/account/invoices/{id}/set-paid:
    post:
      operationId: setInvoicePaid
      tags:
        - Invoices
      summary: Set invoice status to paid
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Invoice"
  /api/account/invoices/{id}/set-cancelled:
    post:
      operationId: setInvoiceCancelled
      tags:
        - Invoices
      summary: Set invoice status to cancelled
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Invoice"
  /api/account/invoices/{id}/payments:
    post:
      operationId: createInvoicePayment
      tags:
        - Invoices
      summary: Record a payment for an invoice
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
          description: Invoice ID
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateDocumentPaymentRequest"
      responses:
        "201":
          description: Created; returns updated invoice with amount_open and payments
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Invoice"
        "404":
          description: Invoice not found
  /api/account/invoices/{id}/payments/{paymentId}:
    delete:
      operationId: deleteInvoicePayment
      tags:
        - Invoices
      summary: Delete a payment from an invoice (reverts amount_open)
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
          description: Invoice ID
        - name: paymentId
          in: path
          required: true
          schema:
            type: integer
          description: Document payment ID
        - $ref: "#/paths/~1api~1account~1receipts~1%7Bid%7D~1payments~1%7BpaymentId%7D/delete/parameters/2"
      responses:
        "200":
          description: OK; returns updated invoice
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Invoice"
        "404":
          description: Invoice or payment not found
  /api/account/invoices/{id}/document-links:
    post:
      operationId: createInvoiceDocumentLink
      tags:
        - Invoices
      summary: Link invoice to another document (manual related)
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateDocumentLinkRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RelatedDocumentSummary"
        "403":
          description: Forbidden (e.g. cannot delete derived_from via wrong endpoint)
  /api/account/invoices/{id}/e-invoice-xml:
    get:
      operationId: getInvoiceEInvoiceXml
      tags:
        - Invoices
      summary: Get invoice ZUGFeRD XML
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/EInvoiceXml"
  /api/account/document-links/{linkId}:
    delete:
      operationId: deleteDocumentLink
      tags:
        - DocumentLinks
      summary: Remove a manual related document link
      parameters:
        - name: linkId
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: No Content
        "403":
          description: Forbidden (derived_from links cannot be removed manually)
  /api/account/dunnings:
    get:
      operationId: listDunnings
      tags:
        - Dunnings
      summary: List Dunnings
      parameters:
        - name: search
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
        - name: date_from
          in: query
          required: false
          schema:
            type: string
        - name: date_to
          in: query
          required: false
          schema:
            type: string
        - name: due_date_from
          in: query
          required: false
          schema:
            type: string
        - name: due_date_to
          in: query
          required: false
          schema:
            type: string
        - name: amount_open_from
          in: query
          required: false
          description: Filter by open amount (cents) >= value
          schema:
            type: integer
            nullable: true
        - name: amount_open_to
          in: query
          required: false
          description: Filter by open amount (cents) <= value
          schema:
            type: integer
            nullable: true
        - name: status
          in: query
          required: false
          schema:
            type: string
            enum:
              - draft
              - open
              - closed
        - name: subject
          in: query
          required: false
          schema:
            type: string
        - name: invoice_id
          in: query
          description: Filter by invoice ID (only dunnings for this invoice).
          required: false
          schema:
            type: integer
        - name: dunning_level
          in: query
          description: Filter by dunning level (Mahnstufe). 0 = payment reminder, 1+ = dunning level.
          required: false
          schema:
            type: integer
            minimum: 0
            maximum: 10
        - name: contact_id
          in: query
          description: Filter by contact ID (dunnings for invoices of this contact).
          required: false
          schema:
            type: integer
        - $ref: "#/components/parameters/RecordLockedQueryParameter"
        - name: order_by
          in: query
          description: Sort by a specific field (only indexed columns are allowed).
          required: false
          schema:
            type: string
            enum:
              - id
              - status
              - date
              - due_date
              - subject
              - dunning_level
              - dunning_fee_amount
              - amount_open
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListDunnings200Response"
    post:
      operationId: createDunning
      tags:
        - Dunnings
      summary: Create Dunning
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateDunningRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Dunning"
  /api/account/dunnings/next:
    get:
      operationId: getNextDunning
      tags:
        - Dunnings
      summary: Get next Dunning
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                title: GetNextDunning200Response
                description: Default text templates for a new dunning. Dunnings have no own number; display number is invoice number + '-' + dunning level.
                properties:
                  text:
                    type: object
                    title: GetNextDunning200ResponseText
                    properties:
                      subject:
                        type: string
                      top:
                        type: string
                      bottom:
                        type: string
                required:
                  - text
  /api/account/dunnings/{id}:
    get:
      operationId: getDunning
      tags:
        - Dunnings
      summary: Get Dunning
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Dunning"
    patch:
      operationId: updateDunning
      tags:
        - Dunnings
      summary: Update Dunning
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateDunningRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Dunning"
    delete:
      operationId: deleteDunning
      tags:
        - Dunnings
      summary: Delete Dunning
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/dunnings/{id}/save:
    post:
      operationId: saveDunning
      tags:
        - Dunnings
      summary: Save Dunning
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Dunning"
  /api/account/dunnings/{id}/reset:
    post:
      operationId: resetDunning
      tags:
        - Dunnings
      summary: Reset Dunning
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Dunning"
  /api/account/dunnings/{id}/send:
    post:
      operationId: sendDunning
      tags:
        - Dunnings
      summary: Mark Dunning as sent
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DocumentSend"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Dunning"
  /api/account/dunnings/{id}/set-open:
    post:
      operationId: setDunningOpen
      tags:
        - Dunnings
      summary: Set dunning status to open
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Dunning"
  /api/account/dunnings/{id}/set-closed:
    post:
      operationId: setDunningClosed
      tags:
        - Dunnings
      summary: Set dunning status to closed
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Dunning"
  /api/account/dunnings/{id}/payments:
    post:
      operationId: createDunningPayment
      tags:
        - Dunnings
      summary: Record a payment for a dunning
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
          description: Dunning ID
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateDocumentPaymentRequest"
      responses:
        "201":
          description: Created; returns updated dunning with amount_open and payments
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Dunning"
        "404":
          description: Dunning not found
  /api/account/dunnings/{id}/payments/{paymentId}:
    delete:
      operationId: deleteDunningPayment
      tags:
        - Dunnings
      summary: Delete a payment from a dunning
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
          description: Dunning ID
        - name: paymentId
          in: path
          required: true
          schema:
            type: integer
          description: Document payment ID
        - $ref: "#/paths/~1api~1account~1receipts~1%7Bid%7D~1payments~1%7BpaymentId%7D/delete/parameters/2"
      responses:
        "200":
          description: OK; returns updated dunning
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Dunning"
        "404":
          description: Dunning or payment not found
  /api/account/credit-notes:
    get:
      operationId: listCreditNotes
      tags:
        - Credit Notes
      summary: List Credit Notes
      parameters:
        - name: number
          in: query
          required: false
          schema:
            type: integer
        - name: search
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
        - name: formatted_number
          in: query
          description: |
            Supports SQL-like syntax:  
            - `test*`: begins with `test`  
            - `*test`: ends with `test`  
            - `*test*`: contains `test`  
            - `test`: exact match.
          required: false
          schema:
            type: string
        - name: date_from
          in: query
          required: false
          schema:
            type: string
        - name: date_to
          in: query
          required: false
          schema:
            type: string
        - name: due_date_from
          in: query
          required: false
          schema:
            type: string
        - name: due_date_to
          in: query
          required: false
          schema:
            type: string
        - name: sum_net_from
          in: query
          required: false
          schema:
            type: number
            nullable: true
        - name: sum_net_to
          in: query
          required: false
          schema:
            type: number
            nullable: true
        - name: amount_open_from
          in: query
          required: false
          description: Filter by open amount (cents) >= value
          schema:
            type: integer
            nullable: true
        - name: amount_open_to
          in: query
          required: false
          description: Filter by open amount (cents) <= value
          schema:
            type: integer
            nullable: true
        - name: status
          in: query
          required: false
          schema:
            type: string
            enum:
              - draft
              - open
              - partially_paid
              - paid
        - name: reference
          in: query
          required: false
          schema:
            type: string
        - name: account_user_id
          in: query
          required: false
          schema:
            type: integer
        - name: subject
          in: query
          required: false
          schema:
            type: string
        - name: contact_id
          in: query
          required: false
          schema:
            type: integer
        - name: cost_center_id
          in: query
          required: false
          schema:
            type: integer
        - name: project_id
          in: query
          required: false
          schema:
            type: integer
        - name: service_contract_id
          in: query
          required: false
          schema:
            type: integer
        - name: service_order_id
          in: query
          required: false
          schema:
            type: integer
        - $ref: "#/components/parameters/ServiceObjectIdQueryParameter"
        - $ref: "#/components/parameters/RecordLockedQueryParameter"
        - name: order_by
          in: query
          description: Sort by a specific field
          required: false
          schema:
            type: string
            enum:
              - id
              - formatted_number
              - status
              - date
              - due_date
              - sum_net
              - subject
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListCreditNotes200Response"
    post:
      operationId: createCreditNote
      tags:
        - Credit Notes
      summary: Create Credit Note
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateCreditNoteRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreditNote"
  /api/account/credit-notes/next:
    get:
      operationId: getNextCreditNote
      tags:
        - Credit Notes
      summary: Get next Credit Note
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                type: object
                title: GetNextCreditNote200Response
                properties:
                  number:
                    type: integer
                  formatted_number:
                    type: string
                  format:
                    type: string
                  text:
                    type: object
                    title: GetNextCreditNote200ResponseText
                    properties:
                      subject:
                        type: string
                      top:
                        type: string
                      bottom:
                        type: string
                required:
                  - number
                  - formatted_number
                  - format
  /api/account/credit-notes/{id}:
    get:
      operationId: getCreditNote
      tags:
        - Credit Notes
      summary: Get Credit Note
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreditNote"
    patch:
      operationId: updateCreditNote
      tags:
        - Credit Notes
      summary: Update Credit Note
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateCreditNoteRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreditNote"
    delete:
      operationId: deleteCreditNote
      tags:
        - Credit Notes
      summary: Delete Credit Note
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/credit-notes/{id}/save:
    post:
      operationId: saveCreditNote
      tags:
        - Credit Notes
      summary: Save Credit Note
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreditNote"
  /api/account/credit-notes/{id}/reset:
    post:
      operationId: resetCreditNote
      tags:
        - Credit Notes
      summary: Reset Credit Note
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreditNote"
  /api/account/credit-notes/{id}/send:
    post:
      operationId: sendCreditNote
      tags:
        - Credit Notes
      summary: Mark Credit Note as sent
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/DocumentSend"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreditNote"
  /api/account/credit-notes/{id}/set-open:
    post:
      operationId: setCreditNoteOpen
      tags:
        - Credit Notes
      summary: Set credit note status to open
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreditNote"
  /api/account/credit-notes/{id}/set-partially-paid:
    post:
      operationId: setCreditNotePartiallyPaid
      tags:
        - Credit Notes
      summary: Set credit note status to partially paid
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreditNote"
  /api/account/credit-notes/{id}/set-paid:
    post:
      operationId: setCreditNotePaid
      tags:
        - Credit Notes
      summary: Set credit note status to paid
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreditNote"
  /api/account/credit-notes/{id}/payments:
    post:
      operationId: createCreditNotePayment
      tags:
        - Credit Notes
      summary: Record a payment (outgoing) for a credit note
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
          description: Credit note ID
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateDocumentPaymentRequest"
      responses:
        "201":
          description: Created; returns updated credit note with amount_open and payments
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreditNote"
        "404":
          description: Credit note not found
  /api/account/credit-notes/{id}/payments/{paymentId}:
    delete:
      operationId: deleteCreditNotePayment
      tags:
        - Credit Notes
      summary: Delete a payment from a credit note
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
          description: Credit note ID
        - name: paymentId
          in: path
          required: true
          schema:
            type: integer
          description: Document payment ID
        - $ref: "#/paths/~1api~1account~1receipts~1%7Bid%7D~1payments~1%7BpaymentId%7D/delete/parameters/2"
      responses:
        "200":
          description: OK; returns updated credit note
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreditNote"
        "404":
          description: Credit note or payment not found
  /api/account/credit-notes/{id}/apply-to-invoice:
    post:
      operationId: applyCreditNoteToInvoice
      tags:
        - Credit Notes
      summary: Apply credit note to invoice (offset)
      description: |
        Offsets (verrechnet) a finalized credit note against an open invoice amount without creating bank transactions.
        Creates clearing payments on both documents and a settlement record for DATEV export.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: false
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/ApplyCreditNoteToInvoiceRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ApplyCreditNoteToInvoice200Response"
  /api/account/credit-notes/{id}/settlements/{settlementId}:
    delete:
      operationId: deleteCreditNoteSettlement
      tags:
        - Credit Notes
      summary: Delete credit note settlement
      description: Reverses an invoice/credit note offset and restores open amounts on both documents.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
        - name: settlementId
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/CreditNote"
  /api/account/credit-notes/{id}/document-links:
    post:
      operationId: createCreditNoteDocumentLink
      tags:
        - Credit Notes
      summary: Link credit-notes to another document (manual related)
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateDocumentLinkRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/RelatedDocumentSummary"
        "403":
          description: Forbidden (e.g. cannot delete derived_from via wrong endpoint)
  /api/account/credit-notes/{id}/e-invoice-xml:
    get:
      operationId: getCreditNoteEInvoiceXml
      tags:
        - Credit Notes
      summary: Get credit note ZUGFeRD XML
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/EInvoiceXml"
  /api/account/bank-accounts:
    get:
      operationId: listBankAccounts
      tags:
        - Bank Accounts
      summary: List Bank Accounts
      parameters:
        - name: search
          in: query
          description: |
            Search in name, IBAN and BIC. Supports SQL-like syntax:
            - `test*`: begins with `test`
            - `*test`: ends with `test`
            - `*test*`: contains `test`
            - `test`: exact match.
          required: false
          schema:
            type: string
        - name: is_active
          in: query
          required: false
          schema:
            type: boolean
        - name: order_by
          in: query
          required: false
          schema:
            type: string
            enum:
              - id
              - name
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListBankAccounts200Response"
    post:
      operationId: createBankAccount
      tags:
        - Bank Accounts
      summary: Create Bank Account
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateBankAccountRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BankAccount"
  /api/account/bank-accounts/{id}:
    get:
      operationId: getBankAccount
      tags:
        - Bank Accounts
      summary: Get Bank Account
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BankAccount"
    patch:
      operationId: updateBankAccount
      tags:
        - Bank Accounts
      summary: Update Bank Account
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateBankAccountRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BankAccount"
    delete:
      operationId: deleteBankAccount
      tags:
        - Bank Accounts
      summary: Delete Bank Account
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/bank-transactions:
    get:
      operationId: listBankTransactions
      tags:
        - Bank Transactions
      summary: List Bank Transactions
      parameters:
        - name: bank_account_id
          in: query
          description: Optional. Filter by bank account; omit to list all transactions.
          required: false
          schema:
            type: integer
        - name: search
          in: query
          description: |
            Search in counterparty (Empfänger) and reference (Verwendungszweck). SQL-like:
            `test*` begins with, `*test` ends with, `*test*` contains, `test` exact.
          required: false
          schema:
            type: string
        - name: transaction_date_from
          in: query
          description: Filter transactions from this date (inclusive). Format Y-m-d.
          required: false
          schema:
            type: string
            format: date
        - name: transaction_date_to
          in: query
          description: Filter transactions until this date (inclusive). Format Y-m-d.
          required: false
          schema:
            type: string
            format: date
        - name: amount_cents_min
          in: query
          description: Minimum amount (signed, in cents). Use negative for debits.
          required: false
          schema:
            type: integer
        - name: amount_cents_max
          in: query
          description: Maximum amount (signed, in cents). Use negative for debits.
          required: false
          schema:
            type: integer
        - name: amount_assignable_cents_min
          in: query
          description: Minimum open (assignable) amount in cents (magnitude, non-negative).
          required: false
          schema:
            type: integer
            minimum: 0
        - name: amount_assignable_cents_max
          in: query
          description: Maximum open (assignable) amount in cents (magnitude, non-negative).
          required: false
          schema:
            type: integer
            minimum: 0
        - name: currency_code
          in: query
          description: Filter by transaction currency (ISO 4217, e.g. EUR, USD).
          required: false
          schema:
            type: string
            minLength: 3
            maxLength: 3
        - name: source
          in: query
          description: Filter by source (manual, csv, api)
          required: false
          schema:
            type: string
            enum:
              - manual
              - csv
              - api
        - name: assignment_status
          in: query
          description: Filter by assignment status (open, partially_assigned, fully_assigned, private, transfer)
          required: false
          schema:
            type: string
            enum:
              - open
              - partially_assigned
              - fully_assigned
              - private
              - transfer
        - name: auto_detected
          in: query
          description: Filter by auto-detected flag (true/false)
          required: false
          schema:
            type: boolean
        - $ref: "#/components/parameters/RecordLockedQueryParameter"
        - name: order_by
          in: query
          required: false
          schema:
            type: string
            enum:
              - transaction_date
              - amount_cents
              - amount_assignable_cents
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListBankTransactions200Response"
    post:
      operationId: createBankTransaction
      tags:
        - Bank Transactions
      summary: Create Bank Transaction
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateBankTransactionRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BankTransaction"
  /api/account/bank-transactions/assignment-suggestions:
    get:
      operationId: listBankTransactionAssignmentSuggestions
      tags:
        - Bank Transactions
      summary: List automatic assignment suggestions for open bank transactions
      description: |
        Scans open (non-private) bank transactions with assignable remainder and returns payable document
        suggestions for each transaction that has at least one match. Matches are based on exact amount
        and/or document number in reference or memo.
      parameters:
        - name: bank_account_id
          in: query
          schema:
            type: integer
          description: Filter by bank account
        - name: transaction_date_from
          in: query
          schema:
            type: string
            format: date
        - name: transaction_date_to
          in: query
          schema:
            type: string
            format: date
        - name: limit
          in: query
          schema:
            type: integer
            minimum: 1
            maximum: 100
            default: 50
          description: Maximum number of transactions with suggestions to return
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListBankTransactionAssignmentSuggestions200Response"
  /api/account/bank-transactions/{id}:
    get:
      operationId: getBankTransaction
      tags:
        - Bank Transactions
      summary: Get Bank Transaction
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BankTransaction"
    patch:
      operationId: updateBankTransaction
      tags:
        - Bank Transactions
      summary: Update Bank Transaction
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateBankTransactionRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BankTransaction"
    delete:
      operationId: deleteBankTransaction
      tags:
        - Bank Transactions
      summary: Delete Bank Transaction
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: OK
  /api/account/bank-transactions/{id}/linked-payables:
    get:
      operationId: listLinkedPayables
      tags:
        - Bank Transactions
      summary: List payables linked to a bank transaction
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
          description: Bank transaction id
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListLinkedPayables200Response"
  /api/account/bank-transactions/{id}/payable-suggestions:
    get:
      operationId: listPayableDocumentSuggestions
      tags:
        - Bank Transactions
      summary: List payable document suggestions for a bank transaction
      description: |
        Returns open invoices, credit notes, or dunnings that likely belong to the given bank transaction.
        Matches when the document open amount equals the transaction amount (or remaining assignable amount) exactly,
        or when the document number appears in the transaction reference or memo.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
          description: Bank transaction id
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListPayableDocumentSuggestions200Response"
        "404":
          description: Bank transaction not found
  /api/account/bank-transactions/{id}/link-payable:
    post:
      operationId: linkPayable
      tags:
        - Bank Transactions
      summary: Link a payable (invoice, credit note, dunning) to this bank transaction
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
          description: Bank transaction id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/LinkPayableRequest"
      responses:
        "200":
          description: OK - returns updated bank transaction
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BankTransaction"
        "404":
          description: Bank transaction or payable not found
        "412":
          description: Precondition failed (e.g. private transaction, draft invoice)
  /api/account/bank-transactions/{id}/transfer-candidates:
    get:
      operationId: listTransferCandidates
      tags:
        - Bank Transactions
      summary: List candidate transactions for internal account transfer linking
      description: |
        Returns open bank transactions on other accounts with opposite sign and matching absolute amount.
        Use before linking two transactions as an internal transfer (Umbuchung).
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
          description: Bank transaction id
        - name: bank_account_id
          in: query
          description: Optional. Filter candidates by bank account (must belong to the current account and differ from the source transaction account).
          required: false
          schema:
            type: integer
        - name: search
          in: query
          description: |
            Search in counterparty and reference. SQL-like:
            `test*` begins with, `*test` ends with, `*test*` contains, `test` exact.
          required: false
          schema:
            type: string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListTransferCandidates200Response"
        "404":
          description: Bank transaction not found
  /api/account/bank-transactions/{id}/link-transfer:
    post:
      operationId: linkTransfer
      tags:
        - Bank Transactions
      summary: Link two bank transactions as internal account transfer (Umbuchung)
      description: |
        Pairs this transaction with a counterpart on another bank account (opposite sign, same amount).
        Both transactions receive assignment status `transfer` and can no longer be assigned to payables.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
          description: Bank transaction id
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/LinkTransferRequest"
      responses:
        "200":
          description: OK - returns updated bank transaction
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BankTransaction"
        "404":
          description: Bank transaction not found
        "412":
          description: Precondition failed (e.g. different accounts, amount mismatch, already linked)
  /api/account/bank-transactions/{id}/unlink-transfer:
    delete:
      operationId: unlinkTransfer
      tags:
        - Bank Transactions
      summary: Remove internal account transfer link (Umbuchung)
      description: Unlinks this transaction from its paired counterpart. Both return to open status.
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
          description: Bank transaction id
      responses:
        "200":
          description: OK - returns updated bank transaction
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/BankTransaction"
        "404":
          description: Bank transaction not found
        "412":
          description: Precondition failed (transaction is not linked as transfer)
  /api/account/service-contracts:
    get:
      operationId: listServiceContracts
      tags:
        - Service Contracts
      summary: List Service Contracts
      parameters:
        - name: search
          in: query
          required: false
          description: Search in subject and number. Use * as wildcard (e.g. *term* for contains).
          schema:
            type: string
        - name: status
          in: query
          required: false
          schema:
            type: string
            enum:
              - active
              - inactive
        - name: contact_id
          in: query
          required: false
          schema:
            type: integer
        - name: cost_center_id
          in: query
          required: false
          schema:
            type: integer
        - name: project_id
          in: query
          required: false
          schema:
            type: integer
        - $ref: "#/components/parameters/ServiceObjectIdQueryParameter"
        - name: account_user_id
          in: query
          required: false
          schema:
            type: integer
        - name: interval_unit
          in: query
          required: false
          description: Filter contracts by billing interval unit (day, week, month, year).
          schema:
            type: string
            enum:
              - day
              - week
              - month
              - year
        - name: invoice_mode
          in: query
          required: false
          schema:
            type: string
            enum:
              - automatic_draft
              - automatic_send_email
        - name: invoice_anchor
          in: query
          required: false
          schema:
            type: string
            enum:
              - first
              - middle
              - last
        - name: recurring_document_type
          in: query
          required: false
          schema:
            type: string
            enum:
              - invoice
              - service_order
        - name: first_period_start_from
          in: query
          required: false
          schema:
            type: string
            format: date
        - name: first_period_start_to
          in: query
          required: false
          schema:
            type: string
            format: date
        - name: end_date_from
          in: query
          required: false
          schema:
            type: string
            format: date
        - name: end_date_to
          in: query
          required: false
          schema:
            type: string
            format: date
        - name: next_invoice_overdue
          in: query
          required: false
          description: Active contracts whose next invoice due date is before today (computed).
          schema:
            type: boolean
        - name: next_invoice_due_on_or_before
          in: query
          required: false
          description: Next invoice due date (computed) on or before this date (YYYY-MM-DD).
          schema:
            type: string
            format: date
        - name: next_invoice_due_on_or_after
          in: query
          required: false
          description: Next invoice due date (computed) on or after this date (YYYY-MM-DD).
          schema:
            type: string
            format: date
        - name: next_billing_period_from_on_or_before
          in: query
          required: false
          description: Next billing period start (computed) on or before this date (YYYY-MM-DD).
          schema:
            type: string
            format: date
        - name: next_billing_period_from_on_or_after
          in: query
          required: false
          description: Next billing period start (computed) on or after this date (YYYY-MM-DD).
          schema:
            type: string
            format: date
        - name: order_by
          in: query
          required: false
          schema:
            type: string
            enum:
              - id
              - number
              - status
              - recurring_document_type
              - automatic_generation
              - invoice_mode
              - subject
              - first_period_start
              - end_date
              - created_at
        - $ref: "#/components/parameters/OrderDirParameter"
        - $ref: "#/components/parameters/PerPageParameter"
        - $ref: "#/components/parameters/PageParameter"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ListServiceContracts200Response"
    post:
      operationId: createServiceContract
      tags:
        - Service Contracts
      summary: Create Service Contract
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/CreateServiceContractRequest"
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServiceContract"
  /api/account/service-contracts/next:
    get:
      operationId: getNextServiceContractNumber
      tags:
        - Service Contracts
      summary: Get next suggested service contract number and formatted string
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/GetNextServiceContractNumber200Response"
  /api/account/service-contracts/{id}:
    get:
      operationId: getServiceContract
      tags:
        - Service Contracts
      summary: Get Service Contract
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServiceContract"
    patch:
      operationId: updateServiceContract
      tags:
        - Service Contracts
      summary: Update Service Contract
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      requestBody:
        content:
          application/json:
            schema:
              $ref: "#/components/schemas/UpdateServiceContractRequest"
      responses:
        "200":
          description: OK
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServiceContract"
    delete:
      operationId: deleteServiceContract
      tags:
        - Service Contracts
      summary: Delete Service Contract
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "204":
          description: No Content
  /api/account/service-contracts/{id}/next-invoice:
    post:
      operationId: createServiceContractNextInvoice
      tags:
        - Service Contracts
      summary: Create next invoice (draft) for Service Contract
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/Invoice"
        "409":
          description: Conflict (invoice for period already exists)
        "422":
          description: Validation error (e.g. contract inactive or next invoice not due)
  /api/account/service-contracts/{id}/next-order:
    post:
      operationId: createServiceContractNextOrder
      tags:
        - Service Contracts
      summary: Create next service order for Service Contract
      parameters:
        - name: id
          in: path
          required: true
          schema:
            type: integer
      responses:
        "201":
          description: Created
          content:
            application/json:
              schema:
                $ref: "#/components/schemas/ServiceOrder"
        "409":
          description: Conflict (order for period already exists)
        "422":
          description: Validation error (e.g. contract inactive or no next period)
components:
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
    AccountAuth:
      type: apiKey
      in: header
      name: X-Account-Uuid
  schemas:
    Account:
      type: object
      properties:
        id:
          type: integer
        slug:
          type: string
        uuid:
          type: string
        name:
          type: string
          minLength: 3
          maxLength: 128
        status:
          type: string
          enum:
            - active
            - blocked
          description: Tenant account lifecycle status. Set only by platform admins; not writable via Account API.
        company_name:
          type: string
          minLength: 2
          maxLength: 255
          nullable: true
        director_name:
          type: string
          minLength: 2
          maxLength: 255
          nullable: true
        legal_form:
          type: string
          minLength: 3
          maxLength: 128
          nullable: true
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        phone:
          $ref: "#/components/schemas/Phone"
        email:
          $ref: "#/components/schemas/EmailAddress"
        website:
          $ref: "#/components/schemas/WebLink"
        website_contact:
          $ref: "#/components/schemas/WebLink"
        website_imprint:
          $ref: "#/components/schemas/WebLink"
        website_support:
          $ref: "#/components/schemas/WebLink"
        website_privacy_policy:
          $ref: "#/components/schemas/WebLink"
        website_terms_of_service:
          $ref: "#/components/schemas/WebLink"
        district_court:
          type: string
          minLength: 3
          maxLength: 64
          nullable: true
        trading_register_number:
          type: string
          minLength: 0
          maxLength: 32
          nullable: true
        bank_iban:
          $ref: "#/components/schemas/BankIban"
        bank_bic:
          $ref: "#/components/schemas/BankBic"
        sepa_creditor_id:
          $ref: "#/components/schemas/SepaCreditorId"
        vat_id:
          $ref: "#/components/schemas/VatId"
        tax_id:
          $ref: "#/components/schemas/TaxId"
        industry:
          type: string
          minLength: 2
          maxLength: 255
          nullable: true
        employees:
          type: string
          minLength: 2
          maxLength: 255
          nullable: true
        logo:
          $ref: "#/components/schemas/MediaItemUrl"
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
      required:
        - id
        - uuid
        - name
        - status
        - updated_at
        - created_at
    AccountAccountingConfiguration:
      type: object
      properties:
        tax_office_nr:
          type: string
        tax_office_name:
          type: string
        taxation_type:
          type: string
        vat_return_frequency:
          type: string
        fiscal_year_start:
          type: string
          format: date
        profit_determination:
          type: string
        chart_of_accounts:
          type: string
        datev_advisor_number:
          type: string
        datev_client_number:
          type: string
        tax_advisor_email:
          type: string
          format: email
          nullable: true
          description: Default email address of the tax advisor for sending accounting exports.
        booking_accounts:
          type: array
          items:
            $ref: "#/components/schemas/AccountingBookingAccount"
        custom_ledger_accounts:
          type: array
          items:
            $ref: "#/components/schemas/CustomLedgerAccount"
        export_amount_format:
          type: string
          enum:
            - cents
            - decimal
          description: Number format for monetary values in CSV exports (cents = integer smallest currency unit, decimal = major currency unit with decimal separator).
        export_decimal_separator:
          type: string
          enum:
            - comma
            - dot
          description: Decimal separator when export_amount_format is decimal (comma = 12,34, dot = 12.34).
        datev_booking_method:
          type: string
          enum:
            - automatic
            - tax_split
          description: Default DATEV booking method (automatic = gross lines via automatic accounts/Vorsteuer key, tax_split = explicit net + VAT lines).
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    AccountConfiguration:
      type: object
      properties:
        currency_code:
          type: string
          description: 3 Letter currency code
          minLength: 3
          maxLength: 3
        locale:
          type: string
          description: Locale identifier string
          minLength: 2
          maxLength: 5
        default_vat_rate:
          type: number
          description: Default VAT rate in percent
          minimum: 0
          maximum: 100
        currency_format:
          type: string
          enum:
            - code_value
            - value_code
            - symbol_value
            - value_symbol
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    AccountDocumentConfiguration:
      type: object
      properties:
        quote_due_days:
          type: integer
        payment_term_days:
          type: integer
        cash_discount_days:
          type: integer
        cash_discount_rate:
          type: number
        dunning_period_days:
          type: integer
        dunning_level_0_label:
          type: string
          description: Label for dunning level 0 (e.g. payment reminder)
        dunning_level_1_label:
          type: string
          description: Label for dunning level 1
        dunning_level_2_label:
          type: string
          description: Label for dunning level 2
        dunning_level_3_label:
          type: string
          description: Label for dunning level 3
        dunning_fee_level_0:
          type: integer
          description: Dunning fee for level 0 (cents)
        dunning_due_days_level_0:
          type: integer
          description: Due-date offset for level 0 (days)
        dunning_due_days_level_1:
          type: integer
        dunning_due_days_level_2:
          type: integer
        dunning_due_days_level_3:
          type: integer
        dunning_fee_level_1:
          type: integer
          description: Dunning fee for level 1 (cents)
        dunning_fee_level_2:
          type: integer
        dunning_fee_level_3:
          type: integer
        payment_terms:
          type: array
          items:
            type: string
        delivery_terms:
          type: array
          items:
            type: string
        document_number_formats:
          type: array
          items:
            type: object
            additionalProperties: true
        document_number_min_numbers:
          type: object
          nullable: true
          additionalProperties:
            type: integer
          description: Minimum {NR} when starting a new sequence per document kind (keys e.g. custom_document, quote, invoice)
        e_invoice_by_default:
          type: boolean
          default: true
          description: When true, new invoices get e_invoice by default
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    AccountEmailConfiguration:
      type: object
      properties:
        smtp_host:
          type: string
        smtp_port:
          type: string
        smtp_username:
          type: string
        smtp_password_set:
          type: boolean
          description: Indicates if SMTP password is set (password itself is never returned)
        smtp_encryption:
          type: string
        smtp_from_name:
          type: string
        smtp_from_email:
          type: string
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    AccountServiceConfiguration:
      type: object
      properties:
        number_formats:
          type: object
          nullable: true
          additionalProperties:
            type: string
          description: Keys project, service_contract, service_object, service_order, service_protocol — format strings with placeholders {NR}, {YYYY}, {YY}, {MM}, {DD}
        number_min_numbers:
          type: object
          nullable: true
          additionalProperties:
            type: integer
          description: Minimum {NR} when starting a new sequence per service entity type (same keys as number_formats)
        created_at:
          type: string
          format: date-time
        updated_at:
          type: string
          format: date-time
    AccountUser:
      type: object
      properties:
        id:
          type: integer
        display_name:
          type: string
          nullable: true
        display_phone:
          type: string
          nullable: true
        display_email:
          type: string
          nullable: true
        invited_email:
          type: string
          nullable: true
          description: Email address the user was invited with. Set for pending account users; null after acceptance or when not applicable.
        status:
          type: string
          enum:
            - active
            - blocked
            - pending
        role:
          type: string
          enum:
            - user
            - admin
        abilities:
          type: array
          nullable: true
          description: |
            Ability strings for this account user. Included when listing or getting users (admin editing).
            Omitted in embedded contexts (e.g. documents, projects, service orders) to avoid leaking permission data.
          items:
            type: string
            example: users.read
        user:
          $ref: "#/components/schemas/User"
          nullable: true
          description: Present when the account user is linked to a user (active or pending with existing user); null when pending and not yet accepted.
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
      required:
        - id
        - status
        - role
    AccountingBookingAccount:
      type: object
      title: AccountingBookingAccount
      description: Semantic DATEV booking role mapped to a ledger account from the active chart (SKR + custom accounts).
      properties:
        role:
          type: string
          title: BookingAccountRole
          description: |
            Semantic ledger role for DATEV export account mapping.
            Roles marked for future use (expense_*) are reserved for upcoming expense receipts (Kostenbelege).
          enum:
            - receivables
            - payables
            - revenue_standard
            - revenue_reduced
            - vat_output_standard
            - vat_output_reduced
            - dunning_fee_revenue
            - expense_general
            - expense_payables
            - vat_input_standard
            - vat_input_reduced
        number:
          type: string
          description: Ledger account number from the kontenrahmen (SKR standard or custom account).
        name:
          type: string
          description: Resolved account label from the kontenrahmen (read-only on save).
      required:
        - role
        - number
    AddressLine1:
      type: string
      description: First line of the address (Street and House number)
      maxLength: 255
      nullable: true
    AddressLine2:
      type: string
      description: Second line of the address
      maxLength: 255
      nullable: true
    ApplyCreditNoteToInvoice200Response:
      type: object
      title: ApplyCreditNoteToInvoice200Response
      properties:
        credit_note:
          $ref: "#/components/schemas/CreditNote"
        invoice:
          $ref: "#/components/schemas/Invoice"
        settlement:
          $ref: "#/components/schemas/PayableSettlement"
      required:
        - credit_note
        - invoice
        - settlement
    ApplyCreditNoteToInvoiceRequest:
      type: object
      title: ApplyCreditNoteToInvoiceRequest
      properties:
        invoice_id:
          type: integer
          description: Required when the credit note has no invoice_id. Must match the linked invoice otherwise.
        amount_cents:
          type: integer
          minimum: 1
          description: Amount to offset in cents. Defaults to min(invoice amount_open, credit note amount_open).
        settlement_type:
          type: string
          enum:
            - full_cancellation
            - partial_reduction
          description: Defaults based on amounts when omitted.
        settlement_date:
          type: string
          format: date
        note:
          type: string
          nullable: true
          maxLength: 2000
    AttachTasksToGroupRequest:
      type: object
      properties:
        task_ids:
          type: array
          items:
            type: integer
            minimum: 0
          minItems: 1
      required:
        - task_ids
    BankAccount:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        iban:
          $ref: "#/components/schemas/BankIban"
        bic:
          $ref: "#/components/schemas/BankBic"
        currency_code:
          type: string
          maxLength: 3
          nullable: true
        is_active:
          type: boolean
        is_manual:
          type: boolean
          description: True = manual account (create transactions manually); false = externally synced (e.g. bank/CSV).
        booking_account_number:
          type: integer
          nullable: true
          description: Ledger account number for DATEV export.
        created_at:
          $ref: "#/components/schemas/CreatedAt"
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
      required:
        - id
        - name
        - is_active
        - is_manual
    BankBic:
      type: string
      maxLength: 11
      description: Bank BIC/SWIFT code
      nullable: true
    BankIban:
      type: string
      maxLength: 50
      description: Bank IBAN
      nullable: true
    BankTransaction:
      type: object
      properties:
        id:
          type: integer
        bank_account_id:
          type: integer
        transaction_date:
          $ref: "#/components/schemas/DateTime"
          description: Bank booking date (Buchungsdatum) for sorting, filters, and payments
        value_date:
          $ref: "#/components/schemas/DateString"
          nullable: true
          description: Value date (Wertstellungsdatum / Valuta) for export and reference
        amount_cents:
          type: integer
          description: Signed; positive = credit, negative = debit
        currency_code:
          type: string
          maxLength: 3
          nullable: true
        counterparty_name:
          type: string
          nullable: true
        counterparty_account_number:
          type: string
          maxLength: 34
          nullable: true
        counterparty_bank_code:
          type: string
          maxLength: 8
          nullable: true
        reference:
          type: string
          nullable: true
        memo:
          type: string
          nullable: true
        source:
          type: string
          description: manual, csv, api
        external_id:
          type: string
          nullable: true
        assignment_status:
          type: string
          description: Derived from allocations, linked transfer, is_private, and is_no_assignment_required. open, partially_assigned, fully_assigned, private, no_assignment_required, transfer
          enum:
            - open
            - partially_assigned
            - fully_assigned
            - private
            - no_assignment_required
            - transfer
        amount_assignable_cents:
          type: integer
          description: Amount in cents that can still be assigned to payables (0 when fully assigned, private, or no assignment required)
        is_private:
          type: boolean
          description: User-marked as private (no business assignment)
          default: false
        is_no_assignment_required:
          type: boolean
          description: User-marked as not requiring document assignment (e.g. zero-amount transactions)
          default: false
        auto_detected:
          type: boolean
          description: Automatically detected e.g. by import or matching
          default: false
        locked_at:
          $ref: "#/components/schemas/DateTime"
          nullable: true
          description: GoBD lock timestamp; non-null means the transaction is locked (festgeschrieben) and immutable.
        linked_transfer:
          $ref: "#/components/schemas/LinkedBankTransactionTransfer"
          nullable: true
          description: Paired counter-transaction when marked as internal account transfer (Umbuchung)
        created_at:
          $ref: "#/components/schemas/CreatedAt"
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
      required:
        - id
        - bank_account_id
        - transaction_date
        - amount_cents
        - source
        - assignment_status
        - amount_assignable_cents
        - is_private
        - is_no_assignment_required
        - auto_detected
    BankTransactionAssignmentSuggestion:
      type: object
      properties:
        bank_transaction:
          $ref: "#/components/schemas/BankTransaction"
        suggestion:
          $ref: "#/components/schemas/PayableDocumentSuggestion"
        suggestions:
          type: array
          description: All matching documents for this transaction, best match first
          items:
            $ref: "#/components/schemas/PayableDocumentSuggestion"
      required:
        - bank_transaction
        - suggestion
        - suggestions
    BookingAccountCatalogAccount:
      type: object
      properties:
        id:
          type: integer
        source:
          $ref: "#/components/schemas/BookingAccountSource"
          default: catalog
        name:
          type: string
        description:
          type: string
          nullable: true
        account_type:
          $ref: "#/components/schemas/BookingAccountCatalogType"
        resolved_ledger_number:
          type: string
          nullable: true
          description: Ledger account number for the account's active chart of accounts
        has_skr03:
          type: boolean
        has_skr04:
          type: boolean
        is_depreciable:
          type: boolean
          description: Whether positions booked to this account are eligible for depreciation (AfA)
        sort_order:
          type: integer
      required:
        - id
        - name
        - account_type
        - has_skr03
        - has_skr04
        - is_depreciable
        - sort_order
    BookingAccountCatalogAccountTypeGroup:
      type: object
      properties:
        account_type:
          $ref: "#/components/schemas/BookingAccountCatalogType"
        categories:
          type: array
          items:
            $ref: "#/components/schemas/BookingAccountCatalogCategory"
      required:
        - account_type
        - categories
    BookingAccountCatalogCategory:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        description:
          type: string
          nullable: true
        account_type:
          $ref: "#/components/schemas/BookingAccountCatalogType"
        sort_order:
          type: integer
        accounts:
          type: array
          items:
            $ref: "#/components/schemas/BookingAccountCatalogAccount"
      required:
        - id
        - name
        - account_type
        - sort_order
        - accounts
    BookingAccountCatalogType:
      type: string
      enum:
        - expense
        - revenue
        - tax
        - other
      description: Booking account catalog account type (Kontoart)
    BookingAccountSource:
      type: string
      description: Origin of a booking account selection
      enum:
        - catalog
        - custom
        - manual
    BulkContactsGroupsRequest:
      type: object
      properties:
        contact_ids:
          type: array
          items:
            type: integer
            minimum: 0
          minItems: 1
        group_ids:
          type: array
          items:
            type: integer
            minimum: 0
          minItems: 1
    CancelInvoiceRequest:
      type: object
      title: CancelInvoiceRequest
      properties:
        auto_finalize:
          type: boolean
          default: true
          description: Finalize the credit note immediately (assign number, generate PDF).
        auto_settle:
          type: boolean
          default: true
          description: When the invoice has an open amount, offset it against the credit note without bank movement.
    City:
      type: string
      description: City of the address.
      maxLength: 255
      nullable: true
    Comment:
      type: object
      properties:
        id:
          type: integer
        user_id:
          type: integer
        entity_type:
          type: string
          enum:
            - Contact
            - Project
            - Task
            - CustomDocument
            - Quote
            - ServiceObject
            - ServiceOrder
        entity_id:
          type: integer
        user:
          $ref: "#/components/schemas/UserInfo"
        entity:
          $ref: "#/components/schemas/GenericEntity"
        text:
          type: string
          maxLength: 65535
          description: HTML
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
        uploads:
          type: array
          items:
            type: object
            title: CommentUpload
            properties:
              id:
                type: integer
              file_ext:
                type: string
              file_type:
                type: string
              file_bytes:
                type: number
              file_name:
                type: string
              url:
                $ref: "#/components/schemas/WebLink"
            required:
              - id
              - file_ext
              - file_type
              - file_bytes
              - file_name
              - url
      required:
        - id
        - text
    Contact:
      type: object
      properties:
        id:
          type: integer
        parent_id:
          type: integer
        parent:
          type: object
          title: ContactParent
          properties:
            id:
              type: integer
            parent_id:
              type: integer
            type:
              $ref: "#/components/schemas/Contact/properties/type"
            is_organisation:
              $ref: "#/components/schemas/Contact/properties/is_organisation"
            name:
              $ref: "#/components/schemas/Contact/properties/name"
            company_name:
              $ref: "#/components/schemas/Contact/properties/company_name"
            gender:
              $ref: "#/components/schemas/Contact/properties/gender"
            title:
              $ref: "#/components/schemas/Contact/properties/title"
            first_name:
              $ref: "#/components/schemas/Contact/properties/first_name"
            last_name:
              $ref: "#/components/schemas/Contact/properties/last_name"
            additional_name:
              $ref: "#/components/schemas/Contact/properties/additional_name"
            position:
              $ref: "#/components/schemas/Contact/properties/position"
            birthdate:
              $ref: "#/components/schemas/Contact/properties/birthdate"
            address_line_1:
              $ref: "#/components/schemas/AddressLine1"
            address_line_2:
              $ref: "#/components/schemas/AddressLine2"
            zip:
              $ref: "#/components/schemas/Zip"
            city:
              $ref: "#/components/schemas/City"
            state:
              $ref: "#/components/schemas/State"
            country_code:
              $ref: "#/components/schemas/CountryCode"
            phones:
              $ref: "#/components/schemas/Phones"
            emails:
              $ref: "#/components/schemas/Emails"
            websites:
              $ref: "#/components/schemas/Websites"
            reference_key:
              $ref: "#/components/schemas/ReferenceKey"
            contact_number:
              $ref: "#/components/schemas/Contact/properties/contact_number"
            debtor_number:
              $ref: "#/components/schemas/Contact/properties/debtor_number"
            creditor_number:
              $ref: "#/components/schemas/Contact/properties/creditor_number"
            bank_iban:
              $ref: "#/components/schemas/BankIban"
            bank_bic:
              $ref: "#/components/schemas/BankBic"
            sepa_creditor_id:
              $ref: "#/components/schemas/SepaCreditorId"
            vat_id:
              $ref: "#/components/schemas/VatId"
            tax_id:
              $ref: "#/components/schemas/TaxId"
            cash_discount_days:
              $ref: "#/components/schemas/Contact/properties/cash_discount_days"
            cash_discount_rate:
              $ref: "#/components/schemas/Contact/properties/cash_discount_rate"
            payment_term_days:
              $ref: "#/components/schemas/Contact/properties/payment_term_days"
            quote_due_days:
              $ref: "#/components/schemas/Contact/properties/quote_due_days"
            customer_discount_rate:
              $ref: "#/components/schemas/Contact/properties/customer_discount_rate"
            payment_terms:
              type: string
            delivery_terms:
              type: string
            internal_note:
              $ref: "#/components/schemas/MediumText"
            updated_at:
              $ref: "#/components/schemas/UpdatedAt"
            created_at:
              $ref: "#/components/schemas/CreatedAt"
            custom_data:
              $ref: "#/components/schemas/CustomData"
            buyer_reference:
              type: string
          required:
            - id
            - type
            - is_organisation
            - name
        type:
          type: string
          enum:
            - organisation
            - person
        is_organisation:
          type: boolean
        name:
          type: string
          minLength: 3
          maxLength: 255
          nullable: false
        company_name:
          type: string
          maxLength: 255
          nullable: true
          description: Company name (used as name_line_3 in document addresses).
        gender:
          type: string
          enum:
            - female
            - male
            - diverse
          nullable: true
        title:
          type: string
          description: Title of the contact (e.g., Mr., Mrs.).
          maxLength: 64
          nullable: true
        first_name:
          type: string
          maxLength: 128
          nullable: true
        last_name:
          type: string
          maxLength: 128
          nullable: true
        additional_name:
          type: string
          maxLength: 128
          nullable: true
        position:
          type: string
          description: Position of the contact in the organisation.
          maxLength: 128
          nullable: true
        birthdate:
          type: string
          format: date
          description: Birthdate of the contact in ISO 8601 format.
          nullable: true
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        phones:
          $ref: "#/components/schemas/Phones"
        emails:
          $ref: "#/components/schemas/Emails"
        websites:
          $ref: "#/components/schemas/Websites"
        reference_key:
          $ref: "#/components/schemas/ReferenceKey"
        contact_number:
          type: integer
          minimum: 0
          maximum: 99999999
          nullable: true
        debtor_number:
          type: integer
          minimum: 0
          maximum: 99999999
          nullable: true
        creditor_number:
          type: integer
          minimum: 0
          maximum: 99999999
          nullable: true
        bank_iban:
          $ref: "#/components/schemas/BankIban"
        bank_bic:
          $ref: "#/components/schemas/BankBic"
        sepa_creditor_id:
          $ref: "#/components/schemas/SepaCreditorId"
        vat_id:
          $ref: "#/components/schemas/VatId"
        tax_id:
          $ref: "#/components/schemas/TaxId"
        cash_discount_days:
          type: integer
          description: Cash discount days for the contact.
          minimum: 0
          maximum: 255
          nullable: true
        cash_discount_rate:
          type: number
          format: float
          description: Cash discount percentage for the contact.
          nullable: true
        payment_term_days:
          type: integer
          minimum: 0
          maximum: 255
          nullable: true
        quote_due_days:
          type: integer
          minimum: 0
          maximum: 255
          nullable: true
        customer_discount_rate:
          type: number
          format: float
          description: Customer-specific discount percentage.
          nullable: true
        payment_terms:
          type: string
        delivery_terms:
          type: string
        buyer_reference:
          type: string
        internal_note:
          $ref: "#/components/schemas/MediumText"
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
        group_ids:
          $ref: "#/components/schemas/IdList"
        groups:
          type: array
          description: List of groups associated with the contact.
          items:
            type: object
            title: ContactGroupItem
            properties:
              id:
                type: integer
                description: Unique identifier for the group.
              name:
                type: string
                description: Name of the group.
            required:
              - id
              - name
        fields:
          type: array
          description: List of contact field values
          items:
            type: object
            title: ContactFieldValueItem
            properties:
              id:
                type: integer
                description: Field ID
              key:
                type: string
                description: Field key
              value:
                description: Value of the field
            required:
              - id
              - key
              - value
        custom_data:
          $ref: "#/components/schemas/CustomData"
        avatar:
          $ref: "#/components/schemas/MediaItemUrl"
        status:
          type: string
          enum:
            - active
            - archived
          description: Contact lifecycle status. List endpoints default to active contacts when omitted.
      required:
        - id
        - type
        - is_organisation
        - name
        - status
    ContactField:
      type: object
      properties:
        id:
          type: integer
        key:
          type: string
        name:
          type: string
        description:
          type: string
        type:
          type: string
        select_values:
          type: array
          items:
            type: string
        default_value:
          description: default value
        ordering:
          type: integer
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
      required:
        - id
        - key
        - name
        - type
    ContactGroup:
      type: object
      properties:
        id:
          type: integer
          description: Unique identifier for the group.
        name:
          type: string
          description: Name of the group.
        contacts_count:
          type: integer
          description: Amount of contacts assigned to this group
      required:
        - id
        - name
        - contacts_count
    ContactInfo:
      type: object
      title: ContactInfo
      properties:
        name:
          type: string
        avatar:
          type: object
          title: ContactInfoAvatar
          properties:
            url:
              type: string
    CostCenter:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        code:
          type: string
        booking_account_number:
          type: integer
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
      required:
        - id
        - name
    CountryCode:
      type: string
      description: ISO country code of the address.
      minLength: 3
      maxLength: 3
      nullable: true
    CreateBankAccountRequest:
      type: object
      properties:
        name:
          type: string
          maxLength: 255
        iban:
          type: string
          maxLength: 50
          nullable: true
        bic:
          type: string
          maxLength: 11
          nullable: true
        currency_code:
          type: string
          maxLength: 3
          nullable: true
        is_active:
          type: boolean
          nullable: true
        is_manual:
          type: boolean
          nullable: true
          description: True = manual account (create transactions manually); false = externally synced.
        booking_account_number:
          type: integer
          nullable: true
          description: Ledger account number for DATEV export.
      required:
        - name
    CreateBankTransactionRequest:
      type: object
      properties:
        bank_account_id:
          type: integer
        transaction_date:
          $ref: "#/components/schemas/DateTime"
          description: Bank booking date (Buchungsdatum)
        value_date:
          $ref: "#/components/schemas/DateString"
          nullable: true
          description: Value date (Wertstellungsdatum / Valuta)
        amount_cents:
          type: integer
        reference:
          type: string
          nullable: true
        counterparty_name:
          type: string
          nullable: true
        counterparty_account_number:
          type: string
          maxLength: 34
          nullable: true
        counterparty_bank_code:
          type: string
          maxLength: 8
          nullable: true
        memo:
          type: string
          nullable: true
        source:
          type: string
          maxLength: 32
          nullable: true
        external_id:
          type: string
          nullable: true
        currency_code:
          type: string
          maxLength: 3
          nullable: true
        is_private:
          type: boolean
          default: false
          nullable: true
        auto_detected:
          type: boolean
          default: false
          nullable: true
      required:
        - bank_account_id
        - transaction_date
        - amount_cents
    CreateCommentRequest:
      type: object
      properties:
        entity_type:
          type: string
        entity_id:
          type: integer
        text:
          type: string
          maxLength: 65535
          description: HTML
        uploads[]:
          type: array
          items:
            type: string
            format: binary
            description: The file to be uploaded.
      required:
        - entity_type
        - entity_id
        - text
    CreateContactFieldRequest:
      type: object
      properties:
        key:
          type: string
          minLength: 3
          maxLength: 255
        name:
          type: string
          minLength: 3
          maxLength: 255
        description:
          type: string
          minLength: 1
          maxLength: 255
          nullable: true
        type:
          type: string
        select_values:
          type: array
          minItems: 1
          items:
            type: string
            maxLength: 255
          nullable: true
        default_value:
          description: default value
          nullable: true
        ordering:
          type: integer
          nullable: true
          minimum: 0
      required:
        - key
        - name
        - type
    CreateContactGroupRequest:
      type: object
      properties:
        name:
          type: string
          minLength: 3
          maxLength: 255
          nullable: false
      required:
        - name
    CreateContactRequest:
      type: object
      title: CreateContactRequest
      properties:
        parent_id:
          type: integer
          minimum: 0
          nullable: true
        type:
          $ref: "#/components/schemas/Contact/properties/type"
        name:
          $ref: "#/components/schemas/Contact/properties/name"
        company_name:
          $ref: "#/components/schemas/Contact/properties/company_name"
        gender:
          $ref: "#/components/schemas/Contact/properties/gender"
        title:
          $ref: "#/components/schemas/Contact/properties/title"
        first_name:
          $ref: "#/components/schemas/Contact/properties/first_name"
        last_name:
          $ref: "#/components/schemas/Contact/properties/last_name"
        additional_name:
          $ref: "#/components/schemas/Contact/properties/additional_name"
        position:
          $ref: "#/components/schemas/Contact/properties/position"
        birthdate:
          $ref: "#/components/schemas/Contact/properties/birthdate"
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        phones:
          $ref: "#/components/schemas/Phones"
        emails:
          $ref: "#/components/schemas/Emails"
        websites:
          $ref: "#/components/schemas/Websites"
        reference_key:
          $ref: "#/components/schemas/ReferenceKey"
        contact_number:
          $ref: "#/components/schemas/Contact/properties/contact_number"
        debtor_number:
          $ref: "#/components/schemas/Contact/properties/debtor_number"
        creditor_number:
          $ref: "#/components/schemas/Contact/properties/creditor_number"
        bank_iban:
          $ref: "#/components/schemas/BankIban"
        bank_bic:
          $ref: "#/components/schemas/BankBic"
        sepa_creditor_id:
          $ref: "#/components/schemas/SepaCreditorId"
        vat_id:
          $ref: "#/components/schemas/VatId"
        tax_id:
          $ref: "#/components/schemas/TaxId"
        cash_discount_days:
          $ref: "#/components/schemas/Contact/properties/cash_discount_days"
        cash_discount_rate:
          $ref: "#/components/schemas/Contact/properties/cash_discount_rate"
        payment_term_days:
          $ref: "#/components/schemas/Contact/properties/payment_term_days"
        quote_due_days:
          $ref: "#/components/schemas/Contact/properties/quote_due_days"
        customer_discount_rate:
          $ref: "#/components/schemas/Contact/properties/customer_discount_rate"
        payment_terms:
          type: string
          nullable: true
        delivery_terms:
          type: string
          nullable: true
        buyer_reference:
          type: string
        internal_note:
          $ref: "#/components/schemas/MediumText"
        group_ids:
          $ref: "#/components/schemas/IdList"
        fields:
          type: array
          items:
            type: object
            title: CreateContactRequestFieldItem
            properties:
              id:
                type: integer
                description: Id of the field
              value:
                description: Value of the field
            required:
              - id
        custom_data:
          $ref: "#/components/schemas/CustomData"
      required:
        - type
        - name
    CreateCostCenterRequest:
      type: object
      properties:
        name:
          type: string
        code:
          type: string
          nullable: true
        booking_account_number:
          type: integer
          nullable: true
      required:
        - name
    CreateCreditNoteRequest:
      type: object
      properties:
        formatted_number:
          type: string
          nullable: true
        date:
          type: string
        contact_id:
          type: integer
        cost_center_id:
          type: integer
          nullable: true
        project_id:
          type: integer
          nullable: true
        service_contract_id:
          type: integer
          nullable: true
        service_order_id:
          type: integer
          nullable: true
        account_user_id:
          type: integer
          nullable: true
        invoice_id:
          type: integer
          nullable: true
          description: Invoice this credit note refers to
        reference:
          type: string
          nullable: true
        name_line_1:
          type: string
          nullable: true
        name_line_2:
          type: string
          nullable: true
        name_line_3:
          type: string
          nullable: true
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        buyer_email:
          type: string
          nullable: true
        buyer_reference:
          type: string
          nullable: true
        currency_code:
          type: string
        exchange_rate:
          type: string
          nullable: true
          description: Optional exchange rate to EUR (foreign units per 1 EUR, ECB convention). When omitted, it is prefilled from the daily ECB rate for the document date.
        due_date:
          type: string
        positions_price_input_mode:
          $ref: "#/components/schemas/Quote/properties/positions_price_input_mode"
        positions:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentPosition"
        adjustments:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentAdjustment"
        cash_discount_days:
          type: integer
          nullable: true
        cash_discount_rate:
          type: number
          nullable: true
        payment_method_code:
          type: string
        vat_rule_code:
          type: string
        payment_terms:
          type: string
          nullable: true
        delivery_terms:
          type: string
          nullable: true
        subject:
          type: string
          nullable: true
        text_top:
          type: string
          nullable: true
        text_bottom:
          type: string
          nullable: true
        print_background_id:
          type: integer
          nullable: true
        print_layout_id:
          type: integer
          nullable: true
        print_options:
          $ref: "#/components/schemas/PrintOptions"
        service_object_ids:
          $ref: "#/components/schemas/Quote/properties/service_object_ids"
        e_invoice:
          type: boolean
          nullable: true
          description: When true, PDF is generated with embedded ZUGFeRD 2.2 (EN16931) XML
        e_invoice_allowance_reason_code:
          type: string
          nullable: true
          maxLength: 10
          description: UNCL 5189 code for e-invoice (e.g. 65 Minderleistung, 95 Honorar, 100 Provision)
        source_document:
          $ref: "#/components/schemas/DocumentReference"
      required:
        - date
        - due_date
        - contact_id
    CreateCustomDocumentRequest:
      type: object
      properties:
        formatted_number:
          type: string
          nullable: true
        date:
          type: string
        contact_id:
          type: integer
        project_id:
          type: integer
          nullable: true
        service_contract_id:
          type: integer
          nullable: true
        service_order_id:
          type: integer
          nullable: true
        account_user_id:
          type: integer
          nullable: true
        reference:
          type: string
          nullable: true
        name_line_1:
          type: string
          nullable: true
        name_line_2:
          type: string
          nullable: true
        name_line_3:
          type: string
          nullable: true
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        subject:
          type: string
        text:
          type: string
        print_background_id:
          type: integer
          nullable: true
        print_layout_id:
          type: integer
          nullable: true
        print_options:
          $ref: "#/components/schemas/PrintOptions"
        service_object_ids:
          $ref: "#/components/schemas/Quote/properties/service_object_ids"
        source_document:
          $ref: "#/components/schemas/DocumentReference"
      required:
        - date
        - contact_id
    CreateDeliveryNoteRequest:
      type: object
      properties:
        formatted_number:
          type: string
          nullable: true
        date:
          $ref: "#/components/schemas/DateString"
        contact_id:
          type: integer
        project_id:
          type: integer
          nullable: true
        service_contract_id:
          type: integer
          nullable: true
        service_order_id:
          type: integer
          nullable: true
        account_user_id:
          type: integer
          nullable: true
        reference:
          type: string
          nullable: true
        name_line_1:
          type: string
          nullable: true
        name_line_2:
          type: string
          nullable: true
        name_line_3:
          type: string
          nullable: true
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        buyer_email:
          type: string
          nullable: true
        buyer_reference:
          type: string
          nullable: true
        currency_code:
          type: string
        exchange_rate:
          type: string
          nullable: true
          description: Optional exchange rate to EUR (foreign units per 1 EUR, ECB convention). When omitted, it is prefilled from the daily ECB rate for the document date.
        positions_price_input_mode:
          $ref: "#/components/schemas/Quote/properties/positions_price_input_mode"
        positions:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentPosition"
        adjustments:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentAdjustment"
        cash_discount_days:
          type: integer
          nullable: true
        cash_discount_rate:
          type: number
          nullable: true
        payment_method_code:
          type: string
        vat_rule_code:
          type: string
        payment_terms:
          type: string
          nullable: true
        delivery_terms:
          type: string
          nullable: true
        subject:
          type: string
          nullable: true
        text_top:
          type: string
          nullable: true
        text_bottom:
          type: string
          nullable: true
        print_background_id:
          type: integer
          nullable: true
        print_layout_id:
          type: integer
          nullable: true
        print_options:
          $ref: "#/components/schemas/PrintOptions"
        service_object_ids:
          $ref: "#/components/schemas/Quote/properties/service_object_ids"
        source_document:
          $ref: "#/components/schemas/DocumentReference"
      required:
        - date
        - contact_id
    CreateDocumentLinkRequest:
      type: object
      description: Create a manual related link from the route document to the target
      properties:
        target:
          $ref: "#/components/schemas/DocumentReference"
      required:
        - target
    CreateDocumentPaymentRequest:
      type: object
      required:
        - payment_date
        - amount_cents
      properties:
        bank_transaction_id:
          type: integer
          nullable: true
          description: Link payment to an existing bank transaction. If omitted, bank_account_id is required and a new transaction is created in that account.
        bank_account_id:
          type: integer
          nullable: true
          description: Required when bank_transaction_id is omitted; the bank account in which to create the new transaction.
        payment_date:
          $ref: "#/components/schemas/DateString"
          description: Date the payment was received (or made for credit notes)
        amount_cents:
          type: integer
          description: Signed; positive = incoming, negative = outgoing (e.g. credit note payout)
        currency_code:
          type: string
          maxLength: 3
          nullable: true
        note:
          type: string
          nullable: true
          description: Optional note on the payment record (not the bank transaction reference).
        reference:
          type: string
          nullable: true
          description: Bank transaction reference (Verwendungszweck) when a new manual transaction is created. Ignored when bank_transaction_id is set.
        counterparty_name:
          type: string
          maxLength: 255
          nullable: true
          description: Counterparty (Auftraggeber/Empfänger) for a newly created manual bank transaction. Ignored when bank_transaction_id is set.
    CreateDunningRequest:
      type: object
      description: Request to create a dunning (draft). Contact and address are taken from the invoice. Either invoice_id or dunning_id is required; dunning_id creates the next dunning level from an existing dunning (and closes the source).
      properties:
        invoice_id:
          type: integer
          description: Invoice this dunning is for (required; when creating from dunning, use source dunning's invoice_id)
        dunning_id:
          type: integer
          nullable: true
          description: Create next dunning from this dunning (invoice and level+1 taken from it; source dunning and other open dunnings for same invoice are closed)
        dunning_level:
          type: integer
          minimum: 0
          maximum: 10
          nullable: true
          description: 0 = payment reminder, 1+ = dunning level; if omitted, next level is determined automatically
        dunning_fee_amount:
          type: integer
          minimum: 0
          nullable: true
          description: Dunning fee in cents; if omitted, taken from document configuration (levels 0–3)
        date:
          type: string
          format: date
          nullable: true
          description: Dunning date (YYYY-MM-DD); default is today
        due_date:
          type: string
          format: date
          nullable: true
          description: Due date (YYYY-MM-DD); otherwise from configuration
        subject:
          type: string
          nullable: true
          description: Subject line; otherwise from text templates
        text_top:
          type: string
          nullable: true
          description: Header text (HTML)
        text_bottom:
          type: string
          nullable: true
          description: Footer text (HTML)
        currency_code:
          type: string
          minLength: 3
          maxLength: 3
          nullable: true
          description: Currency code (e.g. EUR); otherwise from invoice or account
        exchange_rate:
          type: string
          nullable: true
          description: Optional exchange rate to EUR (foreign units per 1 EUR, ECB convention). When omitted, it is prefilled from the daily ECB rate for the document date.
        print_background_id:
          type: integer
          minimum: 0
          nullable: true
          description: Letterhead/print background template
        print_layout_id:
          type: integer
          minimum: 0
          nullable: true
          description: Print layout
        print_options:
          $ref: "#/components/schemas/PrintOptions"
        service_object_ids:
          $ref: "#/components/schemas/Quote/properties/service_object_ids"
      required:
        - invoice_id
    CreateFileFolderRequest:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 128
          nullable: false
        hex_color:
          type: string
          minLength: 3
          maxLength: 7
          nullable: true
        parent_id:
          type: integer
          minimum: 0
          nullable: true
      required:
        - name
    CreateFileRequest:
      type: object
      properties:
        file:
          type: string
          format: binary
          description: The file to be uploaded.
        folder_id:
          type: integer
          nullable: true
        category:
          type: string
          maxLength: 32
          nullable: true
        date:
          type: string
          format: date
          nullable: true
        reference_number:
          type: string
          nullable: true
        contact_id:
          type: integer
          nullable: true
        file_name:
          type: string
          nullable: true
        notes:
          type: string
          nullable: true
      required:
        - file
    CreateInvoiceRequest:
      type: object
      properties:
        formatted_number:
          type: string
          nullable: true
        date:
          type: string
        contact_id:
          type: integer
        cost_center_id:
          type: integer
          nullable: true
        project_id:
          type: integer
          nullable: true
        service_contract_id:
          type: integer
          nullable: true
        service_order_id:
          type: integer
          nullable: true
        account_user_id:
          type: integer
          nullable: true
        reference:
          type: string
          nullable: true
        name_line_1:
          type: string
          nullable: true
        name_line_2:
          type: string
          nullable: true
        name_line_3:
          type: string
          nullable: true
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        buyer_email:
          type: string
          nullable: true
        buyer_reference:
          type: string
          nullable: true
        currency_code:
          type: string
        exchange_rate:
          type: string
          nullable: true
          description: Optional exchange rate to EUR (foreign units per 1 EUR, ECB convention). When omitted, it is prefilled from the daily ECB rate for the document date.
        due_date:
          $ref: "#/components/schemas/DateString"
        delivery_date:
          $ref: "#/components/schemas/DateStringNullable"
        service_date_from:
          $ref: "#/components/schemas/DateStringNullable"
        service_date_to:
          $ref: "#/components/schemas/DateStringNullable"
        positions_price_input_mode:
          $ref: "#/components/schemas/Quote/properties/positions_price_input_mode"
        positions:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentPosition"
        adjustments:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentAdjustment"
        cash_discount_days:
          type: integer
          nullable: true
        cash_discount_rate:
          type: number
          nullable: true
        payment_method_code:
          type: string
        vat_rule_code:
          type: string
        payment_terms:
          type: string
          nullable: true
        delivery_terms:
          type: string
          nullable: true
        subject:
          type: string
          nullable: true
        text_top:
          type: string
          nullable: true
        text_bottom:
          type: string
          nullable: true
        print_background_id:
          type: integer
          nullable: true
        print_layout_id:
          type: integer
          nullable: true
        print_options:
          $ref: "#/components/schemas/PrintOptions"
        service_object_ids:
          $ref: "#/components/schemas/Quote/properties/service_object_ids"
        e_invoice:
          type: boolean
          nullable: true
          description: When true, the PDF is generated with embedded ZUGFeRD 2.2 (EN16931) XML
        source_document:
          $ref: "#/components/schemas/DocumentReference"
          description: When set, creates a derived_from link from the source to this new invoice
      required:
        - date
        - due_date
        - contact_id
    CreateLocationRequest:
      type: object
      properties:
        name:
          type: string
          maxLength: 255
        code:
          type: string
          maxLength: 64
          nullable: true
        description:
          type: string
          nullable: true
        address_line_1:
          type: string
          maxLength: 255
          nullable: true
        address_line_2:
          type: string
          maxLength: 255
          nullable: true
        zip:
          type: string
          maxLength: 32
          nullable: true
        city:
          type: string
          maxLength: 255
          nullable: true
        state:
          type: string
          maxLength: 255
          nullable: true
        country_code:
          type: string
          maxLength: 3
          nullable: true
        phone:
          type: string
          maxLength: 24
          nullable: true
        email:
          type: string
          format: email
          maxLength: 255
          nullable: true
        website:
          type: string
          format: uri
          maxLength: 255
          nullable: true
        internal_note:
          type: string
          nullable: true
        active:
          type: boolean
          nullable: true
      required:
        - name
    CreateMediaFileRequest:
      type: object
      properties:
        entity_type:
          type: string
        entity_id:
          type: integer
        key:
          type: string
        description:
          type: string
          maxLength: 200
          nullable: true
        file:
          type: string
          format: binary
          description: |
            The file to be uploaded. 
            Supported formats: JPG, JPEG, PNG, PDF.
            PDF files will be automatically converted to JPEG images (first page only).
            Maximum file size: 10 MB.
      required:
        - file
        - entity_type
        - entity_id
        - key
    CreateOrderConfirmationRequest:
      type: object
      properties:
        formatted_number:
          type: string
          nullable: true
        date:
          $ref: "#/components/schemas/DateString"
        contact_id:
          type: integer
        project_id:
          type: integer
          nullable: true
        service_contract_id:
          type: integer
          nullable: true
        service_order_id:
          type: integer
          nullable: true
        account_user_id:
          type: integer
          nullable: true
        reference:
          type: string
          nullable: true
        name_line_1:
          type: string
          nullable: true
        name_line_2:
          type: string
          nullable: true
        name_line_3:
          type: string
          nullable: true
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        buyer_email:
          type: string
          nullable: true
        buyer_reference:
          type: string
          nullable: true
        currency_code:
          type: string
        exchange_rate:
          type: string
          nullable: true
          description: Optional exchange rate to EUR (foreign units per 1 EUR, ECB convention). When omitted, it is prefilled from the daily ECB rate for the document date.
        positions_price_input_mode:
          $ref: "#/components/schemas/Quote/properties/positions_price_input_mode"
        positions:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentPosition"
        adjustments:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentAdjustment"
        cash_discount_days:
          type: integer
          nullable: true
        cash_discount_rate:
          type: number
          nullable: true
        payment_method_code:
          type: string
        vat_rule_code:
          type: string
        payment_terms:
          type: string
          nullable: true
        delivery_terms:
          type: string
          nullable: true
        subject:
          type: string
          nullable: true
        text_top:
          type: string
          nullable: true
        text_bottom:
          type: string
          nullable: true
        print_background_id:
          type: integer
          nullable: true
        print_layout_id:
          type: integer
          nullable: true
        print_options:
          $ref: "#/components/schemas/PrintOptions"
        service_object_ids:
          $ref: "#/components/schemas/Quote/properties/service_object_ids"
        source_document:
          $ref: "#/components/schemas/DocumentReference"
      required:
        - date
        - contact_id
    CreatePersonnelRequest:
      type: object
      properties:
        location_id:
          type: integer
          nullable: true
        contact_id:
          type: integer
          nullable: true
        account_user_id:
          type: integer
          nullable: true
        first_name:
          type: string
          maxLength: 128
        last_name:
          type: string
          maxLength: 128
        title:
          type: string
          maxLength: 64
          nullable: true
        gender:
          type: string
          enum:
            - male
            - female
            - diverse
          nullable: true
        position:
          type: string
          maxLength: 128
          nullable: true
        department:
          type: string
          maxLength: 128
          nullable: true
        employee_number:
          type: string
          maxLength: 64
          nullable: true
        phone:
          type: string
          maxLength: 24
          nullable: true
        mobile:
          type: string
          maxLength: 24
          nullable: true
        email:
          type: string
          format: email
          maxLength: 255
          nullable: true
        hire_date:
          type: string
          format: date
          nullable: true
        termination_date:
          type: string
          format: date
          nullable: true
        internal_note:
          type: string
          nullable: true
        active:
          type: boolean
          nullable: true
      required:
        - first_name
        - last_name
    CreatePrintBackgroundRequest:
      type: object
      properties:
        name:
          type: string
        is_default:
          type: boolean
          nullable: true
        is_default_custom_document:
          type: boolean
          nullable: true
        is_default_quote:
          type: boolean
          nullable: true
        is_default_order_confirmation:
          type: boolean
          nullable: true
        is_default_delivery_note:
          type: boolean
          nullable: true
        is_default_invoice:
          type: boolean
          nullable: true
        is_default_dunning:
          type: boolean
          nullable: true
        is_default_credit_note:
          type: boolean
          nullable: true
      required:
        - name
    CreatePrintLayoutRequest:
      type: object
      properties:
        name:
          type: string
        layout_name:
          type: string
          enum:
            - default
            - classic
            - modern
            - elegant
            - minimal
            - accent
        custom_layout:
          type: string
          nullable: true
        is_default:
          type: boolean
          nullable: true
        is_default_custom_document:
          type: boolean
          nullable: true
        is_default_quote:
          type: boolean
          nullable: true
        is_default_order_confirmation:
          type: boolean
          nullable: true
        is_default_delivery_note:
          type: boolean
          nullable: true
        is_default_invoice:
          type: boolean
          nullable: true
        is_default_dunning:
          type: boolean
          nullable: true
        is_default_credit_note:
          type: boolean
          nullable: true
        show_logo:
          type: boolean
          nullable: true
        show_logo_text:
          type: boolean
          nullable: true
        logo_text:
          type: string
          nullable: true
        footer_content:
          type: string
          nullable: true
        show_header:
          type: boolean
          nullable: true
        show_footer:
          type: boolean
          nullable: true
        show_page_numbers:
          type: boolean
          nullable: true
        show_folding_marks:
          type: boolean
          nullable: true
        show_amounts:
          type: boolean
          nullable: true
        show_item_prices:
          type: boolean
          nullable: true
        show_item_totals:
          type: boolean
          nullable: true
        show_item_tax_rate:
          type: boolean
          nullable: true
        show_item_sku:
          type: boolean
          nullable: true
        show_totals:
          type: boolean
          nullable: true
        show_terms:
          type: boolean
          nullable: true
        show_contact_number:
          type: boolean
          nullable: true
        show_contact_person:
          type: boolean
          nullable: true
        show_signature_field:
          type: boolean
          nullable: true
        color_accent:
          type: string
          nullable: true
        color_primary:
          type: string
          nullable: true
        color_secondary:
          type: string
          nullable: true
      required:
        - name
        - layout_name
    CreateProductRequest:
      type: object
      properties:
        sku:
          type: string
        name:
          type: string
        description:
          type: string
        type:
          type: string
          enum:
            - physical
            - virtual
            - service
        unit_code:
          $ref: "#/components/schemas/Product/properties/unit_code"
        tax_rate:
          type: number
        price_net:
          type: integer
        purchase_price_net:
          type: integer
        has_stock:
          type: boolean
        internal_note:
          type: string
      required:
        - name
    CreateProjectRequest:
      type: object
      properties:
        number:
          type: integer
          nullable: true
          description: Sequential number; omit to assign next free number
        formatted_number:
          type: string
          nullable: true
          description: Display number; omit to generate from account service number format
        name:
          type: string
        hex_color:
          type: string
          nullable: true
        description:
          type: string
          nullable: true
        status:
          type: string
          enum:
            - pending
            - active
            - completed
            - archived
        start_date:
          type: string
          format: date
          nullable: true
        end_date:
          type: string
          format: date
          nullable: true
        contact_id:
          type: integer
          nullable: true
      required:
        - name
        - status
    CreateQuoteRequest:
      type: object
      properties:
        formatted_number:
          type: string
          nullable: true
        date:
          type: string
        contact_id:
          type: integer
        service_contract_id:
          type: integer
          nullable: true
        project_id:
          type: integer
          nullable: true
        service_order_id:
          type: integer
          nullable: true
        account_user_id:
          type: integer
          nullable: true
        reference:
          type: string
          nullable: true
        name_line_1:
          type: string
          nullable: true
        name_line_2:
          type: string
          nullable: true
        name_line_3:
          type: string
          nullable: true
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        buyer_email:
          type: string
          nullable: true
        buyer_reference:
          type: string
          nullable: true
        currency_code:
          type: string
        exchange_rate:
          type: string
          nullable: true
          description: Optional exchange rate to EUR (foreign units per 1 EUR, ECB convention). When omitted, it is prefilled from the daily ECB rate for the document date.
        due_date:
          type: string
        positions_price_input_mode:
          $ref: "#/components/schemas/Quote/properties/positions_price_input_mode"
        positions:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentPosition"
        adjustments:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentAdjustment"
        cash_discount_days:
          type: integer
          nullable: true
        cash_discount_rate:
          type: number
          nullable: true
        payment_method_code:
          type: string
        vat_rule_code:
          type: string
        payment_terms:
          type: string
          nullable: true
        delivery_terms:
          type: string
          nullable: true
        subject:
          type: string
          nullable: true
        text_top:
          type: string
          nullable: true
        text_bottom:
          type: string
          nullable: true
        print_background_id:
          type: integer
          nullable: true
        print_layout_id:
          type: integer
          nullable: true
        print_options:
          $ref: "#/components/schemas/PrintOptions"
        service_object_ids:
          $ref: "#/components/schemas/Quote/properties/service_object_ids"
        source_document:
          $ref: "#/components/schemas/DocumentReference"
          description: When set, creates a derived_from link from the source to this new quote
    CreateReceiptRequest:
      type: object
      properties:
        receipt_type:
          type: string
          enum:
            - expense
            - income
        status:
          type: string
          enum:
            - draft
            - open
        date:
          $ref: "#/components/schemas/DateString"
        contact_id:
          type: integer
          nullable: true
        cost_center_id:
          type: integer
          nullable: true
        project_id:
          type: integer
          nullable: true
        service_order_id:
          type: integer
          nullable: true
        account_user_id:
          type: integer
          nullable: true
        reference:
          type: string
          nullable: true
        issuer_reference:
          type: string
          nullable: true
        currency_code:
          type: string
        exchange_rate:
          type: string
          nullable: true
          description: Optional exchange rate to EUR (foreign units per 1 EUR, ECB convention). When omitted, it is prefilled from the daily ECB rate for the receipt date.
        due_date:
          $ref: "#/components/schemas/DateStringNullable"
        delivery_date:
          $ref: "#/components/schemas/DateStringNullable"
        service_date_from:
          $ref: "#/components/schemas/DateStringNullable"
        service_date_to:
          $ref: "#/components/schemas/DateStringNullable"
        positions_price_input_mode:
          $ref: "#/components/schemas/Quote/properties/positions_price_input_mode"
        positions:
          type: array
          minItems: 1
          description: Required unless creating a draft with file_hash (document-only capture).
          items:
            $ref: "#/components/schemas/Receipt/properties/positions/items"
        vat_rule_code:
          type: string
          nullable: true
        file_hash:
          type: string
          description: SHA-256 hash returned by analyzeReceiptFile; attaches the staged upload to the receipt.
          pattern: ^[a-f0-9]{64}$
        start_analysis:
          type: boolean
          default: true
          description: When true and a file is attached on a draft receipt, analysis starts automatically after save.
      required:
        - receipt_type
        - date
    CreateRecurringReceiptRequest:
      type: object
      properties:
        name:
          type: string
        receipt_type:
          type: string
          enum:
            - expense
            - income
        status:
          type: string
          enum:
            - active
            - inactive
        automatic_generation:
          type: boolean
          nullable: true
        auto_approve:
          type: boolean
          nullable: true
        contact_id:
          type: integer
          nullable: true
        cost_center_id:
          type: integer
          nullable: true
        project_id:
          type: integer
          nullable: true
        service_order_id:
          type: integer
          nullable: true
        account_user_id:
          type: integer
          nullable: true
        due_days:
          type: integer
          nullable: true
        reference:
          type: string
          nullable: true
        issuer_reference:
          type: string
          nullable: true
        vat_rule_code:
          type: string
          nullable: true
        currency_code:
          type: string
        exchange_rate:
          type: string
          nullable: true
        positions_price_input_mode:
          $ref: "#/components/schemas/Quote/properties/positions_price_input_mode"
        positions:
          type: array
          minItems: 1
          items:
            $ref: "#/components/schemas/Receipt/properties/positions/items"
        file_hash:
          type: string
          nullable: true
          description: Hash of a previously staged/uploaded document (see analyzeReceiptFile) to attach to the template.
        first_period_start:
          $ref: "#/components/schemas/DateString"
        end_date:
          $ref: "#/components/schemas/DateStringNullable"
        interval_amount:
          type: integer
          minimum: 1
          maximum: 999
        interval_unit:
          type: string
          enum:
            - day
            - week
            - month
            - year
        last_created_period_start:
          $ref: "#/components/schemas/DateStringNullable"
      required:
        - name
        - receipt_type
        - status
        - first_period_start
        - interval_amount
        - interval_unit
        - positions
    CreateServiceContractRequest:
      type: object
      properties:
        number:
          type: integer
          nullable: true
          description: Sequential number; omit to assign next free number
        formatted_number:
          type: string
          nullable: true
          description: Display number; omit to generate from account service number format
        contact_id:
          type: integer
        cost_center_id:
          type: integer
          nullable: true
        project_id:
          type: integer
          nullable: true
        account_user_id:
          type: integer
          nullable: true
        name_line_1:
          type: string
          nullable: true
        name_line_2:
          type: string
          nullable: true
        name_line_3:
          type: string
          nullable: true
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        buyer_email:
          type: string
          nullable: true
        buyer_reference:
          type: string
          nullable: true
        first_period_start:
          type: string
          format: date
          description: Start of first billing period (Datum erste Periode)
        end_date:
          type: string
          format: date
          nullable: true
          description: End of last billing period (End-Datum)
        interval_amount:
          type: integer
          minimum: 1
          maximum: 999
        interval_unit:
          type: string
          enum:
            - day
            - week
            - month
            - year
        positions_price_input_mode:
          $ref: "#/components/schemas/Quote/properties/positions_price_input_mode"
        positions:
          type: array
          nullable: true
          description: Optional. Omit or send null for none.
          items:
            $ref: "#/components/schemas/DocumentPosition"
        adjustments:
          type: array
          nullable: true
          description: Optional. Omit or send null for none.
          items:
            $ref: "#/components/schemas/DocumentAdjustment"
        subject:
          type: string
          nullable: true
        reference:
          type: string
          nullable: true
        currency_code:
          type: string
        cash_discount_days:
          type: integer
          nullable: true
        cash_discount_rate:
          type: number
          nullable: true
        payment_method_code:
          type: string
          nullable: true
        payment_terms:
          type: string
          nullable: true
        delivery_terms:
          type: string
          nullable: true
        vat_rule_code:
          type: string
          nullable: true
        text_top:
          type: string
          nullable: true
        text_bottom:
          type: string
          nullable: true
        print_background_id:
          type: integer
          nullable: true
        print_layout_id:
          type: integer
          nullable: true
        print_options:
          $ref: "#/components/schemas/PrintOptions"
        recurring_document_type:
          type: string
          description: Whether this contract generates invoices or service orders (mutually exclusive).
          enum:
            - invoice
            - service_order
        automatic_generation:
          type: boolean
          description: When true, scheduled/manual processing may create documents for this contract.
        last_created_period_start:
          type: string
          format: date
          nullable: true
          description: Start date of the last billing period for which a document was created; used for scheduling. Optional on create.
        service_object_ids:
          type: array
          nullable: true
          items:
            type: integer
        service_order_assignee_account_user_id:
          type: integer
          nullable: true
          description: Default field assignee (Bearbeiter) for service orders created from this contract.
        invoice_mode:
          type: string
          description: Required; for service_order contracts use automatic_draft as a placeholder (automation follows recurring_document_type).
          enum:
            - automatic_draft
            - automatic_send_email
        invoice_anchor:
          type: string
          description: When in billing period to create invoice (first, middle, or last day).
          enum:
            - first
            - middle
            - last
        payment_term_days:
          type: integer
          minimum: 0
          maximum: 365
          nullable: true
          description: Zahlungsziel in Tagen für erstellte Rechnungen.
        email_to:
          type: array
          nullable: true
          items:
            type: string
            format: email
        email_cc:
          type: array
          nullable: true
          items:
            type: string
            format: email
        email_bcc:
          type: array
          nullable: true
          items:
            type: string
            format: email
        email_subject:
          type: string
          nullable: true
        email_message:
          type: string
          nullable: true
        email_copy_to_self:
          type: boolean
        status:
          type: string
          enum:
            - active
            - inactive
      required:
        - contact_id
        - first_period_start
        - interval_amount
        - interval_unit
        - currency_code
        - recurring_document_type
        - automatic_generation
        - invoice_mode
        - status
    CreateServiceObjectRequest:
      type: object
      properties:
        number:
          type: integer
          nullable: true
          description: Sequential number; omit to assign next free number
        formatted_number:
          type: string
          nullable: true
          description: Display number; omit to generate from account service number format
        name:
          type: string
        type:
          type: string
          enum:
            - machine
            - building
            - device
            - vehicle
            - other
        serial_number:
          type: string
          nullable: true
        location:
          type: string
          nullable: true
        status:
          type: string
          enum:
            - active
            - inactive
        installed_at:
          type: string
          format: date
          nullable: true
        contact_id:
          type: integer
          nullable: true
        internal_description:
          type: string
          nullable: true
        portal_description:
          type: string
          nullable: true
      required:
        - name
        - type
    CreateServiceOrderAppointmentRequest:
      type: object
      properties:
        service_order_id:
          type: integer
          description: Service order this appointment belongs to
        starts_at:
          type: string
          description: Parseable datetime (e.g. Y-m-d H:i or ISO local)
        ends_at:
          type: string
          description: Must be after starts_at
        assignee_account_user_id:
          type: integer
          nullable: true
        status:
          type: string
          enum:
            - planned
            - confirmed
            - completed
            - cancelled
          description: Defaults to planned when omitted
      required:
        - service_order_id
        - starts_at
        - ends_at
    CreateServiceOrderRequest:
      type: object
      properties:
        number:
          type: integer
          nullable: true
        formatted_number:
          type: string
          nullable: true
        date:
          type: string
        status:
          type: string
          enum:
            - open
            - planned
            - in_progress
            - done
            - invoiced
            - cancelled
        contact_id:
          type: integer
          nullable: true
        cost_center_id:
          type: integer
          nullable: true
        project_id:
          type: integer
          nullable: true
        service_contract_id:
          type: integer
          nullable: true
        account_user_id:
          type: integer
          nullable: true
        assignee_account_user_id:
          type: integer
          nullable: true
        reference:
          type: string
          nullable: true
        service_location:
          type: string
          nullable: true
        name_line_1:
          type: string
          nullable: true
        name_line_2:
          type: string
          nullable: true
        name_line_3:
          type: string
          nullable: true
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        buyer_email:
          type: string
          nullable: true
        buyer_reference:
          type: string
          nullable: true
        currency_code:
          type: string
        vat_rule_code:
          type: string
        positions_price_input_mode:
          $ref: "#/components/schemas/Quote/properties/positions_price_input_mode"
        positions:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentPosition"
        adjustments:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentAdjustment"
        taxes:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentTax"
        sum_net:
          type: integer
          nullable: true
        sum_tax:
          type: integer
          nullable: true
        sum_gross:
          type: integer
          nullable: true
        amount_open:
          type: integer
          nullable: true
        cash_discount_days:
          type: integer
          nullable: true
        cash_discount_rate:
          type: number
          nullable: true
        payment_method_code:
          type: string
          nullable: true
        payment_terms:
          type: string
          nullable: true
        delivery_terms:
          type: string
          nullable: true
        subject:
          type: string
          nullable: true
        text_top:
          type: string
          nullable: true
        text_bottom:
          type: string
          nullable: true
        print_background_id:
          type: integer
          nullable: true
        print_layout_id:
          type: integer
          nullable: true
        print_options:
          $ref: "#/components/schemas/PrintOptions"
        service_date_from:
          $ref: "#/components/schemas/DateStringNullable"
        service_date_to:
          $ref: "#/components/schemas/DateStringNullable"
        service_object_ids:
          type: array
          nullable: true
          items:
            type: integer
      required:
        - date
        - currency_code
        - vat_rule_code
    CreateServiceProtocolRequest:
      type: object
      properties:
        number:
          type: integer
          nullable: true
        formatted_number:
          type: string
          nullable: true
        name:
          type: string
        description:
          type: string
          nullable: true
        date:
          $ref: "#/components/schemas/DateTime"
        account_user_id:
          type: integer
          nullable: true
        service_order_id:
          type: integer
          nullable: true
        service_object_ids:
          $ref: "#/components/schemas/Quote/properties/service_object_ids"
      required:
        - name
        - date
    CreateServiceProtocolTemplateRequest:
      type: object
      properties:
        name:
          type: string
        content:
          type: string
      required:
        - name
        - content
    CreateTaskGroupRequest:
      type: object
      properties:
        name:
          type: string
        ordering:
          type: integer
          nullable: true
        entity_type:
          type: string
        entity_id:
          type: integer
      required:
        - name
        - entity_type
        - entity_id
    CreateTaskRequest:
      type: object
      properties:
        name:
          type: string
        description:
          type: string
          nullable: true
        account_user_id:
          type: integer
          nullable: true
        closed:
          type: boolean
          nullable: true
        due_at:
          $ref: "#/components/schemas/DateTime"
        priority_type:
          $ref: "#/components/schemas/Task/properties/priority_type"
        task_group_id:
          type: integer
      required:
        - name
        - task_group_id
    CreateTextTemplateRequest:
      type: object
      properties:
        name:
          type: string
        type:
          $ref: "#/components/schemas/TextTemplate/properties/type"
        document_type:
          $ref: "#/components/schemas/TextTemplate/properties/document_type"
        position:
          $ref: "#/components/schemas/TextTemplate/properties/position"
        is_default:
          type: boolean
          nullable: true
        visible_for_me:
          type: boolean
          nullable: true
        content:
          type: string
      required:
        - name
        - type
        - position
        - content
    CreateWarehouseRequest:
      type: object
      properties:
        location_id:
          type: integer
          nullable: true
        name:
          type: string
          maxLength: 255
        code:
          type: string
          maxLength: 64
          nullable: true
        description:
          type: string
          nullable: true
        address_line_1:
          type: string
          maxLength: 255
          nullable: true
        address_line_2:
          type: string
          maxLength: 255
          nullable: true
        zip:
          type: string
          maxLength: 32
          nullable: true
        city:
          type: string
          maxLength: 255
          nullable: true
        state:
          type: string
          maxLength: 255
          nullable: true
        country_code:
          type: string
          maxLength: 3
          nullable: true
        phone:
          type: string
          maxLength: 24
          nullable: true
        email:
          type: string
          format: email
          maxLength: 255
          nullable: true
        internal_note:
          type: string
          nullable: true
        active:
          type: boolean
          nullable: true
      required:
        - name
    CreatedAt:
      type: string
      format: date-time
      example: 2025-01-14T13:51:15.000Z
      description: Creation timestamp in ISO 8601 format.
    CreditNote:
      type: object
      properties:
        id:
          type: integer
        number:
          type: integer
        formatted_number:
          type: string
        date:
          type: string
        status:
          type: string
          enum:
            - draft
            - open
            - partially_paid
            - paid
        locked_at:
          type: string
          format: date-time
          nullable: true
          description: GoBD lock timestamp; non-null means the record is locked (festgeschrieben) and immutable.
        project_id:
          type: integer
        project:
          $ref: "#/components/schemas/Project"
        service_contract_id:
          type: integer
          nullable: true
        service_contract:
          $ref: "#/components/schemas/ServiceContract"
        service_order_id:
          type: integer
          nullable: true
        service_order:
          $ref: "#/components/schemas/ServiceOrder"
        service_object_ids:
          $ref: "#/components/schemas/Quote/properties/service_object_ids"
        service_objects:
          $ref: "#/components/schemas/Quote/properties/service_objects"
        account_user_id:
          type: integer
        account_user:
          $ref: "#/components/schemas/AccountUser"
        contact_id:
          type: integer
        contact:
          $ref: "#/components/schemas/Contact"
        cost_center_id:
          type: integer
          nullable: true
        cost_center:
          $ref: "#/components/schemas/CostCenter"
        invoice_id:
          type: integer
          nullable: true
        invoice:
          $ref: "#/components/schemas/Invoice"
        name_line_1:
          type: string
        name_line_2:
          type: string
        name_line_3:
          type: string
          nullable: true
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        buyer_email:
          type: string
        buyer_reference:
          type: string
        due_date:
          type: string
        subject:
          type: string
        reference:
          type: string
        cash_discount_days:
          type: integer
        cash_discount_rate:
          type: number
        payment_method_code:
          type: string
        payment_terms:
          type: string
        delivery_terms:
          type: string
        vat_rule_code:
          type: string
        currency_code:
          type: string
        exchange_rate:
          type: string
          description: Exchange rate to the EUR base currency (foreign units per 1 EUR, ECB convention). Prefilled from the daily ECB rate for the document date and editable. 1 for EUR.
        sum_net:
          type: integer
        sum_tax:
          type: integer
        sum_gross:
          type: integer
        sum_net_base:
          type: integer
          description: Net amount in EUR base-currency cents (currency-safe for reports)
        sum_tax_base:
          type: integer
          description: Tax amount in EUR base-currency cents
        sum_gross_base:
          type: integer
          description: Gross amount in EUR base-currency cents
        amount_open:
          type: integer
          nullable: true
          description: Open amount in cents
        amount_open_base:
          type: integer
          nullable: true
          description: Open amount in EUR base-currency cents
        payments:
          type: array
          description: Payments (outgoing, negative amount_cents) recorded against this credit note
          items:
            $ref: "#/components/schemas/DocumentPayment"
        payments_count:
          type: integer
          nullable: true
          description: Number of payments linked to this credit note. Present on list responses when the count was loaded.
        positions_price_input_mode:
          $ref: "#/components/schemas/Quote/properties/positions_price_input_mode"
        positions:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentPosition"
        adjustments:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentAdjustment"
        taxes:
          type: array
          items:
            $ref: "#/components/schemas/DocumentTax"
        text_top:
          type: string
        text_bottom:
          type: string
        print_background_id:
          type: integer
        print_layout_id:
          type: integer
        print_options:
          $ref: "#/components/schemas/PrintOptions"
        file_id:
          type: integer
        file:
          $ref: "#/components/schemas/FileItem"
        sent_as:
          type: string
        sent_at:
          type: string
        e_invoice:
          type: boolean
        e_invoice_allowance_reason_code:
          type: string
          nullable: true
          description: UNCL 5189 code for credit note category in e-invoice (e.g. 65 Minderleistung, 95 Honorar, 100 Provision)
        related_documents:
          type: array
          items:
            $ref: "#/components/schemas/RelatedDocumentSummary"
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
      required:
        - id
        - date
        - status
        - contact_id
        - due_date
        - subject
    CustomData:
      type: object
      additionalProperties: true
      nullable: true
    CustomDocument:
      type: object
      properties:
        id:
          type: integer
        number:
          type: integer
        formatted_number:
          type: string
        date:
          type: string
        status:
          type: string
          enum:
            - draft
            - saved
            - sent
        sent_as:
          type: string
        sent_at:
          type: string
        contact_id:
          type: integer
        contact:
          $ref: "#/components/schemas/Contact"
        project_id:
          type: integer
        project:
          $ref: "#/components/schemas/Project"
        service_contract_id:
          type: integer
          nullable: true
        service_contract:
          $ref: "#/components/schemas/ServiceContract"
        service_order_id:
          type: integer
          nullable: true
        service_order:
          $ref: "#/components/schemas/ServiceOrder"
        service_object_ids:
          $ref: "#/components/schemas/Quote/properties/service_object_ids"
        service_objects:
          $ref: "#/components/schemas/Quote/properties/service_objects"
        account_user_id:
          type: integer
        account_user:
          $ref: "#/components/schemas/AccountUser"
        reference:
          type: string
        name_line_1:
          type: string
        name_line_2:
          type: string
        name_line_3:
          type: string
          nullable: true
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        subject:
          type: string
        text:
          type: string
        print_background_id:
          type: integer
        print_layout_id:
          type: integer
        print_options:
          $ref: "#/components/schemas/PrintOptions"
        file_id:
          type: integer
        file:
          $ref: "#/components/schemas/FileItem"
        related_documents:
          type: array
          items:
            $ref: "#/components/schemas/RelatedDocumentSummary"
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
      required:
        - id
        - date
        - status
        - contact_id
        - subject
        - text
    CustomLedgerAccount:
      type: object
      title: CustomLedgerAccount
      properties:
        id:
          type: integer
        number:
          type: string
        name:
          type: string
        account_class:
          type: string
          enum:
            - expense
            - revenue
            - asset
            - liability
            - tax_input
            - tax_output
            - person
            - bank
            - depreciation
            - other
        parent_class:
          type: string
          nullable: true
        sort_order:
          type: integer
          nullable: true
        booking_account_catalog_category_id:
          type: integer
          nullable: true
          description: Platform booking account catalog category this custom account belongs to
        is_depreciable:
          type: boolean
          description: Whether positions booked to this account are eligible for depreciation (AfA)
        created_at:
          $ref: "#/components/schemas/CreatedAt"
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
      required:
        - number
        - name
        - account_class
    DateString:
      type: string
      example: 2025-01-14T00:00:00.000Z
      description: Date in Y-m-d format
    DateStringNullable:
      type: string
      example: 2025-01-14T00:00:00.000Z
      description: Date in Y-m-d format
      nullable: true
    DateTime:
      type: string
      example: 2025-01-14T13:51:15.000Z
      description: Timestamp in W3C format, will be saved in UTC time +00:00
    DeliveryNote:
      type: object
      properties:
        id:
          type: integer
        number:
          type: integer
        formatted_number:
          type: string
        date:
          $ref: "#/components/schemas/DateString"
        status:
          type: string
          enum:
            - draft
            - open
            - accepted
            - rejected
        project_id:
          type: integer
        project:
          $ref: "#/components/schemas/Project"
        service_contract_id:
          type: integer
          nullable: true
        service_contract:
          $ref: "#/components/schemas/ServiceContract"
        service_order_id:
          type: integer
          nullable: true
        service_order:
          $ref: "#/components/schemas/ServiceOrder"
        service_object_ids:
          $ref: "#/components/schemas/Quote/properties/service_object_ids"
        service_objects:
          $ref: "#/components/schemas/Quote/properties/service_objects"
        account_user_id:
          type: integer
        account_user:
          $ref: "#/components/schemas/AccountUser"
        contact_id:
          type: integer
        contact:
          $ref: "#/components/schemas/Contact"
        name_line_1:
          type: string
        name_line_2:
          type: string
        name_line_3:
          type: string
          nullable: true
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        buyer_email:
          type: string
        buyer_reference:
          type: string
        subject:
          type: string
        reference:
          type: string
        cash_discount_days:
          type: integer
        cash_discount_rate:
          type: number
        payment_method_code:
          type: string
        payment_terms:
          type: string
        delivery_terms:
          type: string
        vat_rule_code:
          type: string
        currency_code:
          type: string
        exchange_rate:
          type: string
          description: Exchange rate to the EUR base currency (foreign units per 1 EUR, ECB convention). Prefilled from the daily ECB rate for the document date and editable. 1 for EUR.
        sum_net:
          type: integer
        sum_tax:
          type: integer
        sum_gross:
          type: integer
        sum_net_base:
          type: integer
          description: Net amount in EUR base-currency cents
        sum_tax_base:
          type: integer
          description: Tax amount in EUR base-currency cents
        sum_gross_base:
          type: integer
          description: Gross amount in EUR base-currency cents
        positions_price_input_mode:
          $ref: "#/components/schemas/Quote/properties/positions_price_input_mode"
        positions:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentPosition"
        adjustments:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentAdjustment"
        taxes:
          type: array
          items:
            $ref: "#/components/schemas/DocumentTax"
        text_top:
          type: string
        text_bottom:
          type: string
        print_background_id:
          type: integer
        print_layout_id:
          type: integer
        print_options:
          $ref: "#/components/schemas/PrintOptions"
        file_id:
          type: integer
        file:
          $ref: "#/components/schemas/FileItem"
        sent_as:
          type: string
        sent_at:
          type: string
        related_documents:
          type: array
          items:
            $ref: "#/components/schemas/RelatedDocumentSummary"
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
      required:
        - id
        - date
        - status
        - contact_id
        - subject
    DetachTasksFromGroupRequest:
      type: object
      properties:
        task_ids:
          type: array
          items:
            type: integer
            minimum: 0
          minItems: 1
      required:
        - task_ids
    DocumentAdjustment:
      type: object
      properties:
        type:
          type: string
          enum:
            - surcharge
            - discount
        title:
          type: string
        description:
          type: string
        rate:
          type: number
          nullable: true
        value:
          type: integer
          nullable: true
      required:
        - type
        - title
    DocumentLinkType:
      type: string
      enum:
        - derived_from
        - related
      description: derived_from = target was created from source; related = manual association (bidirectional)
    DocumentPayment:
      type: object
      description: Payment record linking a payable (invoice, credit note, dunning, receipt) to an optional bank transaction.
      properties:
        id:
          type: integer
        payable_type:
          type: string
          description: API entity type of the document (Invoice, CreditNote, Dunning, Receipt)
        payable_id:
          type: integer
        amount_cents:
          type: integer
          description: Signed; positive = incoming payment, negative = outgoing (e.g. credit note payout)
        currency_code:
          type: string
          maxLength: 3
          nullable: true
        payment_date:
          $ref: "#/components/schemas/DateString"
        note:
          type: string
          nullable: true
        bank_transaction_id:
          type: integer
          nullable: true
          description: Set when this payment is linked to a bank transaction
        payment_kind:
          type: string
          enum:
            - bank
            - clearing
          default: bank
          description: bank = real bank payment; clearing = invoice/credit note offset without bank movement
        settlement_id:
          type: integer
          nullable: true
          description: Set for clearing payments that belong to a payable settlement
        settlement_credit_note_id:
          type: integer
          nullable: true
          description: Credit note id for clearing payments; use with settlement_id to reverse the offset from invoice views
        bank_transaction:
          nullable: true
          allOf:
            - $ref: "#/components/schemas/DocumentPaymentBankTransactionSummary"
          description: Present when bank_transaction_id is set and relation was loaded
        created_at:
          $ref: "#/components/schemas/CreatedAt"
      required:
        - id
        - payable_type
        - payable_id
        - amount_cents
        - payment_date
    DocumentPaymentBankTransactionSummary:
      type: object
      description: Bank transaction linked to a document payment (subset of fields for display).
      properties:
        id:
          type: integer
        bank_account_id:
          type: integer
        bank_account_name:
          type: string
          nullable: true
        transaction_date:
          type: string
          description: Timestamp in ISO 8601 format
        amount_cents:
          type: integer
          description: Signed total amount of the bank transaction
        counterparty_name:
          type: string
          nullable: true
        reference:
          type: string
          nullable: true
        source:
          type: string
          description: manual, csv, api
      required:
        - id
        - bank_account_id
        - transaction_date
        - amount_cents
        - source
    DocumentPosition:
      type: object
      properties:
        position:
          type: string
        product_sku:
          type: string
        title:
          type: string
        description:
          type: string
        quantity:
          type: number
        unit_code:
          $ref: "#/components/schemas/Product/properties/unit_code"
        price_unit:
          type: integer
        discount_rate:
          type: number
          nullable: true
        discount_value:
          type: integer
          nullable: true
        tax_rate:
          type: number
        is_optional:
          type: boolean
        ledger_account_number:
          type: string
          nullable: true
          description: Ledger account number (receipt positions)
        ledger_account_name:
          type: string
          nullable: true
          description: Ledger account name snapshot (receipt positions)
        chart_of_accounts:
          type: string
          enum:
            - deu-skr03
            - deu-skr04
          nullable: true
          description: Chart of accounts snapshot (receipt positions)
      required:
        - position
        - title
    DocumentReference:
      type: object
      description: Polymorphic reference to a business document in the account
      properties:
        type:
          type: string
          enum:
            - quote
            - order_confirmation
            - delivery_note
            - invoice
            - credit_note
            - custom_document
        id:
          type: integer
          minimum: 1
      required:
        - type
        - id
    DocumentSend:
      type: object
      properties:
        sent_as:
          type: string
          enum:
            - mail
            - email
            - download
            - print
      required:
        - sent_as
    DocumentTax:
      type: object
      properties:
        rate:
          type: number
        total:
          type: integer
      required:
        - rate
        - total
    Dunning:
      type: object
      properties:
        id:
          type: integer
        formatted_number:
          type: string
          description: Display number (e.g. invoice formatted_number + '-' + dunning_level)
        date:
          type: string
        status:
          type: string
          enum:
            - draft
            - open
            - closed
        locked_at:
          type: string
          format: date-time
          nullable: true
          description: GoBD lock timestamp; non-null means the record is locked (festgeschrieben) and immutable.
        invoice_id:
          type: integer
        invoice:
          $ref: "#/components/schemas/Invoice"
        service_object_ids:
          $ref: "#/components/schemas/Quote/properties/service_object_ids"
        service_objects:
          $ref: "#/components/schemas/Quote/properties/service_objects"
        dunning_level:
          type: integer
          minimum: 0
          maximum: 10
          description: 0 = payment reminder, 1+ = dunning level
        dunning_fee_amount:
          type: integer
          description: Dunning fee in cents (no line items)
        amount_dunned:
          type: integer
          nullable: true
          description: Open invoice amount in cents at issue time (print/display only). Not used for payment allocation.
        amount_open:
          type: integer
          nullable: true
          description: "Open amount in cents: dunning fees only (for payment allocation). Not invoice total."
        payments:
          type: array
          description: Payments recorded against this dunning
          items:
            $ref: "#/components/schemas/DocumentPayment"
        payments_count:
          type: integer
          nullable: true
          description: Number of payments linked to this dunning. Present on list responses when the count was loaded.
        due_date:
          type: string
        subject:
          type: string
        currency_code:
          type: string
        exchange_rate:
          type: string
          description: Exchange rate to the EUR base currency (foreign units per 1 EUR, ECB convention). Prefilled from the daily ECB rate for the document date and editable. 1 for EUR.
        text_top:
          type: string
        text_bottom:
          type: string
        print_background_id:
          type: integer
        print_layout_id:
          type: integer
        print_options:
          $ref: "#/components/schemas/PrintOptions"
        file_id:
          type: integer
        file:
          $ref: "#/components/schemas/FileItem"
        sent_as:
          type: string
        sent_at:
          type: string
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
      required:
        - id
        - date
        - status
        - invoice_id
        - dunning_level
        - due_date
        - subject
    EInvoiceXml:
      type: object
      required:
        - xml
      properties:
        xml:
          type: string
          description: ZUGFeRD 2.2 (EN 16931) CII XML for the document
    EmailAddress:
      type: string
      maxLength: 255
      format: email
      example: user@example.com
      nullable: true
    Emails:
      type: array
      items:
        type: object
        title: EmailListEntry
        properties:
          value:
            $ref: "#/components/schemas/EmailAddress"
          name:
            type: string
            nullable: true
      nullable: true
      minItems: 0
      maxItems: 10
    ErrorResponse:
      type: object
      properties:
        message:
          type: string
          description: Description of the error
          example: The password field is required.
        errors:
          type: object
          description: Dynamic list of errors
          additionalProperties:
            type: array
            items:
              type: string
              example: The field is required.
          example:
            password:
              - The password field is required.
            email:
              - The email field must be a valid email address.
    FileFolder:
      type: object
      properties:
        id:
          type: integer
        parent_id:
          type: integer
        name:
          type: string
        protected:
          type: boolean
        hex_color:
          type: string
        files_count:
          type: integer
        child_folders_count:
          type: integer
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
      required:
        - id
        - name
        - files_count
        - child_folders_count
    FileFolderTreeItem:
      type: object
      properties:
        id:
          type: integer
        key:
          type: string
        root:
          type: boolean
        parent_id:
          type: integer
        name:
          type: string
        hex_color:
          type: string
        protected:
          type: boolean
        system_key:
          type: string
          nullable: true
          description: Internal folder key for system-managed folders (e.g. ai_assistant, ai_assistant_user_123).
        files_count:
          type: integer
        child_folders_count:
          type: integer
        children:
          type: array
          description: |
            A recursive structure containing child folders. The nesting can go up to a maximum of 20 levels.
          items:
            type: object
            additionalProperties: true
      required:
        - id
        - key
        - root
        - name
        - files_count
        - child_folders_count
    FileItem:
      type: object
      properties:
        id:
          type: integer
        category:
          type: string
        date:
          type: string
        reference_number:
          type: string
        protected:
          type: boolean
        new:
          type: boolean
        file_ext:
          type: string
        file_type:
          type: string
        file_bytes:
          type: integer
        file_name:
          type: string
        url:
          type: string
        thumbnail_url:
          type: string
        scanned_at:
          type: string
        is_xml:
          type: boolean
        owner_entity_label:
          type: string
          nullable: true
          description: Cached display label of the linked owner entity (e.g. invoice number).
        owner_entity_type:
          type: string
          nullable: true
          description: API entity type of the owner (e.g. Invoice, Receipt).
        owner_entity_id:
          type: integer
          nullable: true
          description: ID of the owner entity within the account.
        notes:
          type: string
        folder_id:
          type: integer
        folder:
          $ref: "#/components/schemas/Folder"
        contact_id:
          type: integer
        contact:
          $ref: "#/components/schemas/ContactInfo"
        created_user_id:
          type: integer
        created_by:
          $ref: "#/components/schemas/UserInfo"
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
        deleted_at:
          $ref: "#/components/schemas/CreatedAt"
      required:
        - id
        - file_name
    Folder:
      type: object
      properties:
        name:
          type: string
        path:
          type: string
          nullable: true
          description: Full folder path from root to the file's folder (parent segments joined with " / ").
      required:
        - name
    GenericEntity:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
    GetFileDownloadLink200Response:
      type: object
      title: GetFileDownloadLink200Response
      properties:
        url:
          type: string
      required:
        - url
    GetFileFoldersTree200Response:
      type: object
      title: GetFileFoldersTree200Response
      allOf:
        - $ref: "#/components/schemas/FileFolderTreeItem"
    GetNextContact200Response:
      type: object
      title: GetNextContact200Response
      properties:
        number:
          type: integer
      required:
        - number
    GetNextCustomDocument200Response:
      type: object
      title: GetNextCustomDocument200Response
      properties:
        number:
          type: integer
        formatted_number:
          type: string
        format:
          type: string
        text:
          $ref: "#/components/schemas/GetNextCustomDocument200ResponseText"
      required:
        - number
        - formatted_number
        - format
    GetNextCustomDocument200ResponseText:
      type: object
      title: GetNextCustomDocument200ResponseText
      properties:
        subject:
          type: string
        top:
          type: string
        bottom:
          type: string
    GetNextServiceContractNumber200Response:
      type: object
      title: GetNextServiceContractNumber200Response
      properties:
        number:
          type: integer
        formatted_number:
          type: string
        format:
          type: string
      required:
        - number
        - formatted_number
        - format
    GetNextServiceObjectNumber200Response:
      type: object
      properties:
        number:
          type: integer
        formatted_number:
          type: string
        format:
          type: string
      required:
        - number
        - formatted_number
        - format
    GetNextServiceOrderNumber200Response:
      type: object
      properties:
        number:
          type: integer
        formatted_number:
          type: string
        format:
          type: string
      required:
        - number
        - formatted_number
        - format
    GetNextServiceProtocolNumber200Response:
      type: object
      properties:
        number:
          type: integer
        formatted_number:
          type: string
        format:
          type: string
      required:
        - number
        - formatted_number
        - format
    GlobalSearchGroup:
      type: object
      title: GlobalSearchGroup
      required:
        - entity_type
        - items
      properties:
        entity_type:
          type: string
          enum:
            - Contact
            - Quote
            - OrderConfirmation
            - DeliveryNote
            - Invoice
            - CreditNote
            - CustomDocument
            - Receipt
            - Dunning
            - Project
            - ServiceContract
            - ServiceObject
            - ServiceProtocol
            - ServiceOrder
            - FileFolder
            - File
        items:
          type: array
          items:
            $ref: "#/components/schemas/GlobalSearchItem"
    GlobalSearchItem:
      type: object
      title: GlobalSearchItem
      required:
        - id
        - title
      properties:
        id:
          type: integer
        title:
          type: string
        subtitle:
          type: string
          nullable: true
        date:
          type: string
          nullable: true
          description: Relevant calendar date for the result as ISO `YYYY-MM-DD`, when available (e.g. document/file date or, as a fallback, the creation date). Shown as secondary metadata in the global search results.
    IdList:
      type: array
      items:
        type: integer
        minimum: 0
      nullable: true
      minItems: 0
    Invoice:
      type: object
      properties:
        id:
          type: integer
        number:
          type: integer
        formatted_number:
          type: string
        date:
          type: string
        status:
          type: string
          enum:
            - draft
            - open
            - partially_paid
            - paid
            - cancelled
        locked_at:
          type: string
          format: date-time
          nullable: true
          description: GoBD lock timestamp; non-null means the record is locked (festgeschrieben) and immutable.
        project_id:
          type: integer
        project:
          $ref: "#/components/schemas/Project"
        service_contract_id:
          type: integer
          nullable: true
        service_contract:
          $ref: "#/components/schemas/ServiceContract"
        service_order_id:
          type: integer
          nullable: true
        service_order:
          $ref: "#/components/schemas/ServiceOrder"
        service_object_ids:
          $ref: "#/components/schemas/Quote/properties/service_object_ids"
        service_objects:
          $ref: "#/components/schemas/Quote/properties/service_objects"
        account_user_id:
          type: integer
        account_user:
          $ref: "#/components/schemas/AccountUser"
        contact_id:
          type: integer
        contact:
          $ref: "#/components/schemas/Contact"
        cost_center_id:
          type: integer
          nullable: true
        cost_center:
          $ref: "#/components/schemas/CostCenter"
        name_line_1:
          type: string
        name_line_2:
          type: string
        name_line_3:
          type: string
          nullable: true
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        buyer_email:
          type: string
        buyer_reference:
          type: string
        due_date:
          $ref: "#/components/schemas/DateString"
        delivery_date:
          $ref: "#/components/schemas/DateStringNullable"
        service_date_from:
          $ref: "#/components/schemas/DateStringNullable"
        service_date_to:
          $ref: "#/components/schemas/DateStringNullable"
        service_contract_period_from:
          $ref: "#/components/schemas/DateStringNullable"
          description: When set with service_contract_id, this invoice is assigned to this billing period of the contract
        service_contract_period_to:
          $ref: "#/components/schemas/DateStringNullable"
          description: When set with service_contract_id, this invoice is assigned to this billing period of the contract
        subject:
          type: string
        reference:
          type: string
        cash_discount_days:
          type: integer
        cash_discount_rate:
          type: number
        payment_method_code:
          type: string
        payment_terms:
          type: string
        delivery_terms:
          type: string
        vat_rule_code:
          type: string
        currency_code:
          type: string
        exchange_rate:
          type: string
          description: Exchange rate to the EUR base currency (foreign units per 1 EUR, ECB convention). Prefilled from the daily ECB rate for the document date and editable. 1 for EUR.
        sum_net:
          type: integer
        sum_tax:
          type: integer
        sum_gross:
          type: integer
        sum_net_base:
          type: integer
          description: Net amount in EUR base-currency cents (currency-safe for reports)
        sum_tax_base:
          type: integer
          description: Tax amount in EUR base-currency cents
        sum_gross_base:
          type: integer
          description: Gross amount in EUR base-currency cents
        amount_open:
          type: integer
          nullable: true
          description: Open amount in cents; updated when payments are recorded
        amount_open_base:
          type: integer
          nullable: true
          description: Open amount in EUR base-currency cents
        payments:
          type: array
          description: Payments recorded against this invoice
          items:
            $ref: "#/components/schemas/DocumentPayment"
        payments_count:
          type: integer
          nullable: true
          description: Number of payments linked to this invoice. Present on list responses when the count was loaded.
        positions_price_input_mode:
          $ref: "#/components/schemas/Quote/properties/positions_price_input_mode"
        positions:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentPosition"
        adjustments:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentAdjustment"
        taxes:
          type: array
          items:
            $ref: "#/components/schemas/DocumentTax"
        text_top:
          type: string
        text_bottom:
          type: string
        print_background_id:
          type: integer
        print_layout_id:
          type: integer
        print_options:
          $ref: "#/components/schemas/PrintOptions"
        file_id:
          type: integer
        file:
          $ref: "#/components/schemas/FileItem"
        sent_as:
          type: string
        sent_at:
          type: string
        credit_notes:
          type: array
          description: Credit notes (Gutschriften) linked to this invoice
          items:
            $ref: "#/components/schemas/CreditNote"
        dunnings:
          type: array
          description: Dunnings (Mahnungen) linked to this invoice
          items:
            $ref: "#/components/schemas/Dunning"
        has_credit_notes:
          type: boolean
          description: True when at least one credit note (Gutschrift) is linked to this invoice
        related_documents:
          type: array
          description: Linked business documents (derived_from or manual related)
          items:
            $ref: "#/components/schemas/RelatedDocumentSummary"
        e_invoice:
          type: boolean
          description: When true, the PDF is generated with embedded ZUGFeRD 2.2 (EN16931) XML
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
      required:
        - id
        - date
        - status
        - contact_id
        - due_date
        - subject
    LinkPayableRequest:
      type: object
      title: LinkPayableRequest
      properties:
        payable_type:
          type: string
          enum:
            - Invoice
            - CreditNote
            - Dunning
            - Receipt
        payable_id:
          type: integer
          minimum: 1
        amount_cents:
          type: integer
      required:
        - payable_type
        - payable_id
        - amount_cents
    LinkTransferRequest:
      type: object
      properties:
        linked_bank_transaction_id:
          type: integer
          minimum: 1
          description: Counterpart transaction on another bank account with opposite sign and matching amount
      required:
        - linked_bank_transaction_id
    LinkedBankTransactionTransfer:
      type: object
      description: Summary of the paired bank transaction in an internal account transfer (Umbuchung).
      properties:
        id:
          type: integer
        bank_account_id:
          type: integer
        transaction_date:
          $ref: "#/components/schemas/DateTime"
        amount_cents:
          type: integer
          description: Signed; positive = credit, negative = debit
        currency_code:
          type: string
          maxLength: 3
          nullable: true
        counterparty_name:
          type: string
          nullable: true
        reference:
          type: string
          nullable: true
      required:
        - id
        - bank_account_id
        - transaction_date
        - amount_cents
    LinkedPayable:
      type: object
      title: LinkedPayable
      description: A payable (invoice, credit note, dunning, receipt) linked to a bank transaction.
      properties:
        id:
          type: integer
          description: Document payment id
        payable_type:
          type: string
          enum:
            - Invoice
            - CreditNote
            - Dunning
            - Receipt
        payable_id:
          type: integer
        amount_cents:
          type: integer
        currency_code:
          type: string
          nullable: true
        payment_date:
          $ref: "#/components/schemas/DateString"
        payable_label:
          type: string
          description: Display label e.g. invoice number
        contact_id:
          type: integer
          nullable: true
        contact_name:
          type: string
          nullable: true
        contact_avatar:
          $ref: "#/components/schemas/ContactInfo/properties/avatar"
          nullable: true
        document_date:
          type: string
          format: date
          nullable: true
        amount_total_cents:
          type: integer
          description: Total document amount in cents
        amount_open_cents:
          type: integer
          description: Open amount on the document in cents
      required:
        - id
        - payable_type
        - payable_id
        - amount_cents
        - payment_date
        - payable_label
        - amount_total_cents
        - amount_open_cents
    ListBankAccounts200Response:
      type: object
      title: ListBankAccounts200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/BankAccount"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListBankTransactionAssignmentSuggestions200Response:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/BankTransactionAssignmentSuggestion"
        meta:
          type: object
          properties:
            scanned_count:
              type: integer
              description: Number of open transactions scanned for matches
            matched_count:
              type: integer
              description: Number of transactions with at least one suggestion
          required:
            - scanned_count
            - matched_count
      required:
        - data
        - meta
    ListBankTransactions200Response:
      type: object
      title: ListBankTransactions200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/BankTransaction"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListBookingAccountCatalog200Response:
      type: object
      properties:
        chart_of_accounts:
          type: string
          enum:
            - deu-skr03
            - deu-skr04
        account_types:
          type: array
          items:
            $ref: "#/components/schemas/BookingAccountCatalogAccountTypeGroup"
      required:
        - chart_of_accounts
        - account_types
    ListComments200Response:
      type: object
      title: ListComments200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/Comment"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListContactFields200Response:
      type: object
      title: ListContactFields200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/ContactField"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListContactGroups200Response:
      type: object
      title: ListContactGroups200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/ContactGroup"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListContacts200Response:
      type: object
      title: ListContacts200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/Contact"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListCostCenters200Response:
      type: object
      title: ListCostCenters200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/CostCenter"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListCreditNotes200Response:
      type: object
      title: ListCreditNotes200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/CreditNote"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListCustomDocuments200Response:
      type: object
      title: ListCustomDocuments200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/CustomDocument"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListCustomLedgerAccounts200Response:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/CustomLedgerAccount"
      required:
        - data
    ListDeliveryNotes200Response:
      type: object
      title: ListDeliveryNotes200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/DeliveryNote"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListDunnings200Response:
      type: object
      title: ListDunnings200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/Dunning"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListFileCategories200Response:
      type: object
      title: ListFileCategories200Response
      properties:
        items:
          type: array
          items:
            $ref: "#/components/schemas/ListFileCategories200ResponseItemsInner"
    ListFileCategories200ResponseItemsInner:
      type: object
      title: ListFileCategories200ResponseItemsInner
      properties:
        category:
          type: string
        files_count:
          type: integer
    ListFileFolders200Response:
      type: object
      title: ListFileFolders200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/FileFolder"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListFiles200Response:
      type: object
      title: ListFiles200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/FileItem"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListInvoices200Response:
      type: object
      title: ListInvoices200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/Invoice"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListLinkedPayables200Response:
      type: object
      title: ListLinkedPayables200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/LinkedPayable"
      required:
        - data
    ListMediaFiles200Response:
      type: object
      title: ListMediaFiles200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/MediaFile"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListOrderConfirmations200Response:
      type: object
      title: ListOrderConfirmations200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/OrderConfirmation"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListPayableDocumentSuggestions200Response:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/PayableDocumentSuggestion"
      required:
        - data
    ListPersonnel200Response:
      type: object
      title: ListPersonnel200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/Personnel"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListPrintBackgrounds200Response:
      type: object
      title: ListPrintBackgrounds200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/PrintBackground"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListPrintLayouts200Response:
      type: object
      title: ListPrintLayouts200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/PrintLayout"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListProducts200Response:
      type: object
      title: ListProducts200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/Product"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListProjects200Response:
      type: object
      title: ListProjects200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/Project"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListQuotes200Response:
      type: object
      title: ListQuotes200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/Quote"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListReceipts200Response:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/Receipt"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListRecurringReceipts200Response:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/RecurringReceipt"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListServiceContracts200Response:
      type: object
      title: ListServiceContracts200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/ServiceContract"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListServiceObjects200Response:
      type: object
      title: ListServiceObjects200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/ServiceObject"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListServiceOrderAppointments200Response:
      type: object
      title: ListServiceOrderAppointments200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/ServiceOrderAppointment"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListServiceOrders200Response:
      type: object
      title: ListServiceOrders200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/ServiceOrder"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListServiceProtocolTemplates200Response:
      type: object
      title: ListServiceProtocolTemplates200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/ServiceProtocolTemplate"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListServiceProtocols200Response:
      type: object
      title: ListServiceProtocols200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/ServiceProtocol"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListTaskGroups200Response:
      type: object
      title: ListTaskGroups200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/TaskGroup"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListTasks200Response:
      type: object
      title: ListTasks200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/Task"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListTextTemplates200Response:
      type: object
      title: ListTextTemplates200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/TextTemplate"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    ListTransferCandidates200Response:
      type: object
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/LinkedBankTransactionTransfer"
      required:
        - data
    ListWarehouses200Response:
      type: object
      title: ListWarehouses200Response
      properties:
        data:
          type: array
          items:
            $ref: "#/components/schemas/Warehouse"
        meta:
          $ref: "#/components/schemas/PaginationMetaData"
      required:
        - data
        - meta
    Location:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        code:
          type: string
          nullable: true
        description:
          $ref: "#/components/schemas/MediumText"
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        phone:
          $ref: "#/components/schemas/Phone"
        email:
          $ref: "#/components/schemas/EmailAddress"
        website:
          $ref: "#/components/schemas/WebLink"
        internal_note:
          $ref: "#/components/schemas/MediumText"
        active:
          type: boolean
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
      required:
        - id
        - name
        - active
    MediaFile:
      type: object
      properties:
        id:
          type: integer
        user_id:
          type: integer
        entity_type:
          type: string
          enum:
            - Account
            - Contact
            - PrintLayout
            - PrintBackground
            - ServiceProtocol
            - ServiceObject
            - ServiceOrder
        entity_id:
          type: integer
        key:
          type: string
        is_public:
          type: boolean
        file_ext:
          type: string
          description: "File extension (e.g., 'jpg', 'png', 'pdf'). Note: PDFs are converted to 'jpg' upon upload."
        file_type:
          type: string
          description: "MIME type (e.g., 'image/jpeg', 'image/png', 'application/pdf'). Note: PDFs are converted to 'image/jpeg' upon upload."
        file_bytes:
          type: number
        user:
          $ref: "#/components/schemas/UserInfo"
        entity:
          $ref: "#/components/schemas/GenericEntity"
        description:
          type: string
        url:
          type: string
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
      required:
        - id
        - text
        - url
    MediaItemUrl:
      type: object
      additionalProperties: true
      properties:
        id:
          type: integer
        url:
          type: string
          example: http://example.com/image.jpg
    MediumText:
      type: string
      maxLength: 65535
      description: HTML
      nullable: true
    OrderConfirmation:
      type: object
      properties:
        id:
          type: integer
        number:
          type: integer
        formatted_number:
          type: string
        date:
          $ref: "#/components/schemas/DateString"
        status:
          type: string
          enum:
            - draft
            - open
            - accepted
            - rejected
        project_id:
          type: integer
        project:
          $ref: "#/components/schemas/Project"
        service_contract_id:
          type: integer
          nullable: true
        service_contract:
          $ref: "#/components/schemas/ServiceContract"
        service_order_id:
          type: integer
          nullable: true
        service_order:
          $ref: "#/components/schemas/ServiceOrder"
        service_object_ids:
          $ref: "#/components/schemas/Quote/properties/service_object_ids"
        service_objects:
          $ref: "#/components/schemas/Quote/properties/service_objects"
        account_user_id:
          type: integer
        account_user:
          $ref: "#/components/schemas/AccountUser"
        contact_id:
          type: integer
        contact:
          $ref: "#/components/schemas/Contact"
        name_line_1:
          type: string
        name_line_2:
          type: string
        name_line_3:
          type: string
          nullable: true
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        buyer_email:
          type: string
        buyer_reference:
          type: string
        subject:
          type: string
        reference:
          type: string
        cash_discount_days:
          type: integer
        cash_discount_rate:
          type: number
        payment_method_code:
          type: string
        payment_terms:
          type: string
        delivery_terms:
          type: string
        vat_rule_code:
          type: string
        currency_code:
          type: string
        exchange_rate:
          type: string
          description: Exchange rate to the EUR base currency (foreign units per 1 EUR, ECB convention). Prefilled from the daily ECB rate for the document date and editable. 1 for EUR.
        sum_net:
          type: integer
        sum_tax:
          type: integer
        sum_gross:
          type: integer
        sum_net_base:
          type: integer
          description: Net amount in EUR base-currency cents
        sum_tax_base:
          type: integer
          description: Tax amount in EUR base-currency cents
        sum_gross_base:
          type: integer
          description: Gross amount in EUR base-currency cents
        positions_price_input_mode:
          $ref: "#/components/schemas/Quote/properties/positions_price_input_mode"
        positions:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentPosition"
        adjustments:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentAdjustment"
        taxes:
          type: array
          items:
            $ref: "#/components/schemas/DocumentTax"
        text_top:
          type: string
        text_bottom:
          type: string
        print_background_id:
          type: integer
        print_layout_id:
          type: integer
        print_options:
          $ref: "#/components/schemas/PrintOptions"
        file_id:
          type: integer
        file:
          $ref: "#/components/schemas/FileItem"
        sent_as:
          type: string
        sent_at:
          type: string
        related_documents:
          type: array
          items:
            $ref: "#/components/schemas/RelatedDocumentSummary"
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
      required:
        - id
        - date
        - status
        - contact_id
        - subject
    OrderDir:
      type: string
      enum:
        - asc
        - desc
      example: asc
    OverageMetric:
      type: string
      title: OverageMetric
      description: How overage is measured for a feature.
      enum:
        - monthly_count
        - end_of_month_capacity
    OverageUnit:
      type: string
      title: OverageUnit
      description: Billing unit for on-demand overage usage.
      enum:
        - document
        - receipt
        - credit
        - gigabyte
    Page:
      type: integer
      minimum: 1
      example: 1
    PaginationMetaData:
      type: object
      properties:
        current_page:
          type: integer
          description: The current page number.
          example: 1
        last_page:
          type: integer
          description: The last page number.
          example: 1
        per_page:
          type: integer
          description: The number of items per page.
          example: 15
        total:
          type: integer
          description: The total number of items.
          example: 1
        items_from:
          type: integer
          description: The starting item number on the current page.
          example: 1
        items_to:
          type: integer
          description: The ending item number on the current page.
          example: 1
      required:
        - current_page
        - last_page
        - per_page
        - total
        - items_from
        - items_to
    PayableDocumentSuggestion:
      type: object
      properties:
        payable_type:
          type: string
          enum:
            - Invoice
            - CreditNote
            - Dunning
        payable_id:
          type: integer
        payable_label:
          type: string
        contact_id:
          type: integer
          nullable: true
        contact_name:
          type: string
          nullable: true
        contact_first_name:
          type: string
          nullable: true
        contact_last_name:
          type: string
          nullable: true
        contact_company_name:
          type: string
          nullable: true
        contact_number:
          type: integer
          nullable: true
        contact_avatar:
          $ref: "#/components/schemas/ContactInfo/properties/avatar"
          nullable: true
        amount_total_cents:
          type: integer
          description: Total document amount in cents (e.g. sum gross or dunning fee)
        document_date:
          type: string
          format: date
          nullable: true
        document_subject:
          type: string
          nullable: true
          description: Document subject or title when available (invoice, credit note, dunning)
        amount_open_cents:
          type: integer
          description: Open amount on the document in cents
        currency_code:
          type: string
          nullable: true
        match_reasons:
          type: array
          description: Why this document was suggested (amount exact match, counterparty name, and/or document number in reference/memo)
          items:
            type: string
            enum:
              - amount
              - counterparty
              - document_number
        suggested_amount_cents:
          type: integer
          description: Suggested booking amount in cents (positive, capped by open amount and assignable remainder)
      required:
        - payable_type
        - payable_id
        - payable_label
        - amount_total_cents
        - amount_open_cents
        - match_reasons
        - suggested_amount_cents
    PayableSettlement:
      type: object
      description: Offset (Verrechnung) between an invoice and a credit note without bank movement.
      properties:
        id:
          type: integer
        invoice_id:
          type: integer
        credit_note_id:
          type: integer
        amount_cents:
          type: integer
          description: Applied amount in cents (positive)
        settlement_type:
          type: string
          enum:
            - full_cancellation
            - partial_reduction
        settlement_date:
          $ref: "#/components/schemas/DateString"
        note:
          type: string
          nullable: true
        created_at:
          $ref: "#/components/schemas/CreatedAt"
      required:
        - id
        - invoice_id
        - credit_note_id
        - amount_cents
        - settlement_type
        - settlement_date
    PerPage:
      type: integer
      minimum: 1
      maximum: 100
      example: 15
    Personnel:
      type: object
      title: Personnel
      properties:
        id:
          type: integer
        location_id:
          type: integer
          nullable: true
        location:
          $ref: "#/components/schemas/Personnel/properties/contact"
        contact_id:
          type: integer
          nullable: true
        contact:
          type: object
          title: IdNameEmbed
          nullable: true
          properties:
            id:
              type: integer
            name:
              type: string
        account_user_id:
          type: integer
          nullable: true
        account_user:
          type: object
          title: PersonnelAccountUserEmbed
          nullable: true
          properties:
            id:
              type: integer
            display_name:
              type: string
        first_name:
          type: string
        last_name:
          type: string
        title:
          type: string
          nullable: true
        gender:
          type: string
          enum:
            - male
            - female
            - diverse
          nullable: true
        position:
          type: string
          nullable: true
        department:
          type: string
          nullable: true
        employee_number:
          type: string
          nullable: true
        phone:
          type: string
          nullable: true
        mobile:
          type: string
          nullable: true
        email:
          type: string
          format: email
          nullable: true
        hire_date:
          type: string
          format: date
          nullable: true
        termination_date:
          type: string
          format: date
          nullable: true
        internal_note:
          $ref: "#/components/schemas/MediumText"
        active:
          type: boolean
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
      required:
        - id
        - first_name
        - last_name
        - active
    Phone:
      type: string
      maxLength: 24
      description: Phone number in E.164 format.
      example: "+4915123456789"
      pattern: ^\+?[1-9]\d{1,14}$
      nullable: true
    Phones:
      type: array
      items:
        type: object
        title: PhoneListEntry
        properties:
          value:
            $ref: "#/components/schemas/Phone"
          name:
            type: string
            nullable: true
      nullable: true
      minItems: 0
      maxItems: 10
    PrintBackground:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        is_default:
          type: boolean
        is_default_custom_document:
          type: boolean
        is_default_quote:
          type: boolean
        is_default_order_confirmation:
          type: boolean
        is_default_delivery_note:
          type: boolean
        is_default_invoice:
          type: boolean
        is_default_dunning:
          type: boolean
        is_default_credit_note:
          type: boolean
        mediaFile:
          $ref: "#/components/schemas/MediaItemUrl"
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
      required:
        - id
        - name
    PrintLayout:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        layout_name:
          type: string
          enum:
            - default
            - classic
            - modern
            - elegant
            - minimal
            - accent
        custom_layout:
          type: string
        is_default:
          type: boolean
        is_default_custom_document:
          type: boolean
        is_default_quote:
          type: boolean
        is_default_order_confirmation:
          type: boolean
        is_default_delivery_note:
          type: boolean
        is_default_invoice:
          type: boolean
        is_default_dunning:
          type: boolean
        is_default_credit_note:
          type: boolean
        show_logo:
          type: boolean
        show_logo_text:
          type: boolean
        logo_text:
          type: string
        footer_content:
          type: string
        show_header:
          type: boolean
        show_footer:
          type: boolean
        show_page_numbers:
          type: boolean
        show_folding_marks:
          type: boolean
        show_amounts:
          type: boolean
        show_item_prices:
          type: boolean
        show_item_totals:
          type: boolean
        show_item_tax_rate:
          type: boolean
        show_item_sku:
          type: boolean
        show_totals:
          type: boolean
        show_terms:
          type: boolean
        show_contact_number:
          type: boolean
        show_contact_person:
          type: boolean
        show_signature_field:
          type: boolean
        color_accent:
          type: string
        color_primary:
          type: string
        color_secondary:
          type: string
        preview:
          $ref: "#/components/schemas/MediaItemUrl"
        logo:
          $ref: "#/components/schemas/MediaItemUrl"
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
      required:
        - id
        - name
        - layout_name
        - is_default
    PrintLayoutTemplate:
      type: object
      properties:
        layout_name:
          type: string
          enum:
            - default
            - classic
            - modern
            - elegant
            - minimal
            - accent
        content:
          type: string
      required:
        - layout_name
        - content
    PrintOptions:
      type: object
      nullable: true
      properties:
        show_logo:
          type: boolean
          nullable: true
          description: Show logo
        show_logo_text:
          type: boolean
          nullable: true
          description: Show logo text
        show_header:
          type: boolean
          nullable: true
          description: Show header
        show_footer:
          type: boolean
          nullable: true
          description: Show footer
        show_page_numbers:
          type: boolean
          nullable: true
          description: Show page numbers
        show_folding_marks:
          type: boolean
          nullable: true
          description: Show folding marks
        show_item_quantities:
          type: boolean
          nullable: true
          description: Show item quantities
        show_item_prices:
          type: boolean
          nullable: true
          description: Show item prices
        show_item_totals:
          type: boolean
          nullable: true
          description: Show item totals
        show_item_tax_rate:
          type: boolean
          nullable: true
          description: Show item tax rate
        show_item_sku:
          type: boolean
          nullable: true
          description: Show item SKU
        show_totals:
          type: boolean
          nullable: true
          description: Show totals
        show_terms:
          type: boolean
          nullable: true
          description: Show terms
        show_contact_number:
          type: boolean
          nullable: true
          description: Show contact number
        show_signature_field:
          type: boolean
          nullable: true
          description: Show signature field
    Product:
      type: object
      properties:
        id:
          type: integer
        sku:
          type: string
        name:
          type: string
        description:
          type: string
        type:
          type: string
          enum:
            - physical
            - virtual
            - service
        unit_code:
          type: string
          nullable: true
          enum:
            - C62
            - HUR
            - DAY
            - KGM
            - GRM
            - LTR
            - CMT
            - MTR
            - MTK
            - MTQ
            - KMT
            - TNE
            - PAC
            - PR
            - BOX
            - RO
            - SET
            - PCE
            - MIN
            - SEC
            - MLT
            - MMT
            - P1
            - ZZ
          description: |
            UN/CEFACT unit of measure code (Recommendation 20/21). Null allowed for optional positions.
            Code meanings:
            - C62: unit (piece)
            - HUR: hour
            - DAY: day
            - KGM: kilogram
            - GRM: gram
            - LTR: litre
            - CMT: centimetre
            - MTR: metre
            - MTK: square metre
            - MTQ: cubic metre
            - KMT: kilometre
            - TNE: tonne (metric)
            - PAC: package
            - PR: pair
            - BOX: box
            - RO: roll
            - SET: set
            - PCE: page
            - MIN: minute
            - SEC: second
            - MLT: millilitre
            - MMT: millimetre
            - P1: percent
            - ZZ: lump sum (generic / no unit)
        tax_rate:
          type: number
        price_net:
          type: integer
        purchase_price_net:
          type: integer
        has_stock:
          type: boolean
        internal_note:
          type: string
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
      required:
        - id
        - name
    Project:
      type: object
      properties:
        id:
          type: integer
        number:
          type: integer
          description: Sequential project number per account (internal)
        formatted_number:
          type: string
          description: Display number (account format), unique per account
        name:
          type: string
        hex_color:
          type: string
        description:
          type: string
        status:
          type: string
        start_date:
          type: string
        end_date:
          type: string
        contact_id:
          type: integer
        contact:
          $ref: "#/components/schemas/Contact"
        account_user_id:
          type: integer
        account_user:
          $ref: "#/components/schemas/AccountUser"
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
      required:
        - id
        - number
        - formatted_number
        - name
    Quote:
      type: object
      properties:
        id:
          type: integer
        number:
          type: integer
        formatted_number:
          type: string
        date:
          type: string
        status:
          type: string
          enum:
            - draft
            - open
            - accepted
            - rejected
        project_id:
          type: integer
        project:
          $ref: "#/components/schemas/Project"
        service_contract_id:
          type: integer
          nullable: true
        service_contract:
          $ref: "#/components/schemas/ServiceContract"
        service_order_id:
          type: integer
          nullable: true
        service_order:
          $ref: "#/components/schemas/ServiceOrder"
        service_object_ids:
          type: array
          nullable: true
          items:
            type: integer
        service_objects:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/ServiceObject"
        account_user_id:
          type: integer
        account_user:
          $ref: "#/components/schemas/AccountUser"
        contact_id:
          type: integer
        contact:
          $ref: "#/components/schemas/Contact"
        name_line_1:
          type: string
        name_line_2:
          type: string
        name_line_3:
          type: string
          nullable: true
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        buyer_email:
          type: string
        buyer_reference:
          type: string
        due_date:
          type: string
        subject:
          type: string
        reference:
          type: string
        cash_discount_days:
          type: integer
        cash_discount_rate:
          type: number
        payment_method_code:
          type: string
        payment_terms:
          type: string
        delivery_terms:
          type: string
        vat_rule_code:
          type: string
        currency_code:
          type: string
        exchange_rate:
          type: string
          description: Exchange rate to the EUR base currency (foreign units per 1 EUR, ECB convention). Prefilled from the daily ECB rate for the document date and editable. 1 for EUR.
        sum_net:
          type: integer
        sum_tax:
          type: integer
        sum_gross:
          type: integer
        sum_net_base:
          type: integer
          description: Net amount in EUR base-currency cents
        sum_tax_base:
          type: integer
          description: Tax amount in EUR base-currency cents
        sum_gross_base:
          type: integer
          description: Gross amount in EUR base-currency cents
        positions_price_input_mode:
          type: string
          enum:
            - net
            - gross
          default: net
          description: Whether position unit prices were entered as net or gross (display preference; price_unit is always stored net).
        positions:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentPosition"
        adjustments:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentAdjustment"
        taxes:
          type: array
          items:
            $ref: "#/components/schemas/DocumentTax"
        text_top:
          type: string
        text_bottom:
          type: string
        print_background_id:
          type: integer
        print_layout_id:
          type: integer
        print_options:
          $ref: "#/components/schemas/PrintOptions"
        file_id:
          type: integer
        file:
          $ref: "#/components/schemas/FileItem"
        sent_as:
          type: string
        sent_at:
          type: string
        related_documents:
          type: array
          items:
            $ref: "#/components/schemas/RelatedDocumentSummary"
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
      required:
        - id
        - date
        - status
        - contact_id
        - due_date
        - subject
    Receipt:
      type: object
      properties:
        id:
          type: integer
        receipt_type:
          type: string
          enum:
            - expense
            - income
        status:
          type: string
          enum:
            - draft
            - open
            - partially_paid
            - paid
            - cancelled
        locked_at:
          type: string
          format: date-time
          nullable: true
          description: GoBD lock timestamp; non-null means the record is locked (festgeschrieben) and immutable.
        date:
          $ref: "#/components/schemas/DateString"
        project_id:
          type: integer
          nullable: true
        project:
          $ref: "#/components/schemas/Project"
        service_order_id:
          type: integer
          nullable: true
        service_order:
          $ref: "#/components/schemas/ServiceOrder"
        account_user_id:
          type: integer
          nullable: true
        account_user:
          $ref: "#/components/schemas/AccountUser"
        contact_id:
          type: integer
          nullable: true
        contact:
          $ref: "#/components/schemas/Contact"
        cost_center_id:
          type: integer
          nullable: true
        cost_center:
          $ref: "#/components/schemas/CostCenter"
        recurring_receipt_id:
          type: integer
          nullable: true
          description: Set when this receipt was generated from a recurring receipt template (Dauerbeleg).
        recurring_receipt:
          type: object
          nullable: true
          description: Lightweight origin info of the recurring receipt template this receipt was generated from.
          properties:
            id:
              type: integer
            name:
              type: string
          required:
            - id
            - name
        recurring_receipt_period_from:
          $ref: "#/components/schemas/DateStringNullable"
        recurring_receipt_period_to:
          $ref: "#/components/schemas/DateStringNullable"
        due_date:
          $ref: "#/components/schemas/DateStringNullable"
        delivery_date:
          $ref: "#/components/schemas/DateStringNullable"
        service_date_from:
          $ref: "#/components/schemas/DateStringNullable"
        service_date_to:
          $ref: "#/components/schemas/DateStringNullable"
        reference:
          type: string
          nullable: true
        issuer_reference:
          type: string
          nullable: true
        vat_rule_code:
          type: string
          nullable: true
        currency_code:
          type: string
        exchange_rate:
          type: string
          description: Exchange rate to the EUR base currency (foreign units per 1 EUR, ECB convention). Prefilled from the daily ECB rate for the receipt date and editable. 1 for EUR.
        sum_net:
          type: integer
        sum_tax:
          type: integer
        sum_gross:
          type: integer
        sum_net_base:
          type: integer
          description: Net amount in EUR base-currency cents (currency-safe for reports)
        sum_tax_base:
          type: integer
          description: Tax amount in EUR base-currency cents
        sum_gross_base:
          type: integer
          description: Gross amount in EUR base-currency cents
        amount_open:
          type: integer
        amount_open_base:
          type: integer
          nullable: true
          description: Open amount in EUR base-currency cents
        payments:
          type: array
          description: Payments recorded against this receipt
          items:
            $ref: "#/components/schemas/DocumentPayment"
        payments_count:
          type: integer
          nullable: true
          description: Number of payments linked to this receipt. Present on list responses when the count was loaded.
        positions_price_input_mode:
          $ref: "#/components/schemas/Quote/properties/positions_price_input_mode"
        positions:
          type: array
          nullable: true
          items:
            type: object
            properties:
              id:
                type: integer
                nullable: true
                description: Stable identifier of the persisted receipt position. Returned in responses; send it back on update to preserve position identity. Omit for newly added positions.
              position:
                type: string
              description:
                type: string
              ledger_account_number:
                type: string
                nullable: true
                description: Ledger account number (category / account)
              ledger_account_name:
                type: string
                nullable: true
                description: Ledger account name snapshot
              booking_account_source:
                $ref: "#/components/schemas/BookingAccountSource"
                nullable: true
                description: Origin of the booking account reference or snapshot
              booking_account_catalog_id:
                type: integer
                nullable: true
                description: Selected platform booking account catalog entry
              custom_ledger_account_id:
                type: integer
                nullable: true
                description: Selected tenant custom ledger account
              booking_account_type:
                $ref: "#/components/schemas/BookingAccountCatalogType"
                nullable: true
                description: Snapshot of catalog account type at save time
              booking_account_catalog_category_id:
                type: integer
                nullable: true
                description: Snapshot of catalog category id at save time
              booking_account_catalog_category_name:
                type: string
                nullable: true
                description: Snapshot of catalog category name at save time
              chart_of_accounts:
                type: string
                enum:
                  - deu-skr03
                  - deu-skr04
                nullable: true
                description: Chart of accounts snapshot
              price_unit:
                type: integer
                description: Net line amount in cents (quantity is always 1)
              tax_rate:
                type: number
              depreciation_method:
                type: string
                nullable: true
                enum:
                  - linear
                  - gwg
                description: Depreciation method when this position is treated as a fixed asset
              depreciation_useful_life_years:
                type: integer
                nullable: true
                minimum: 1
                maximum: 100
                description: Useful life in years (required for linear depreciation)
              depreciation_afa_ledger_account_number:
                type: string
                nullable: true
                readOnly: true
                description: Snapshot of the mapped AfA expense ledger account
              depreciation_afa_ledger_account_name:
                type: string
                nullable: true
                readOnly: true
                description: Snapshot of the mapped AfA expense ledger account name
            required:
              - position
              - description
              - price_unit
              - tax_rate
        taxes:
          type: array
          items:
            $ref: "#/components/schemas/DocumentTax"
        file_id:
          type: integer
          nullable: true
        file:
          $ref: "#/components/schemas/FileItem"
        e_invoice:
          type: boolean
          description: Whether the attached document is a ZUGFeRD e-invoice (detected from embedded XML in the PDF).
        created_at:
          $ref: "#/components/schemas/CreatedAt"
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
      required:
        - id
        - receipt_type
        - status
        - date
        - currency_code
        - exchange_rate
        - sum_net
        - sum_tax
        - sum_gross
        - sum_net_base
        - sum_tax_base
        - sum_gross_base
        - amount_open
    RecurringReceipt:
      type: object
      description: Recurring receipt (Dauerbeleg) template. Periodically generates receipts using the same fields as a regular receipt plus a service-contract-style interval schedule.
      properties:
        id:
          type: integer
        name:
          type: string
          description: Display name of the template.
        receipt_type:
          type: string
          enum:
            - expense
            - income
        status:
          type: string
          enum:
            - active
            - inactive
        automatic_generation:
          type: boolean
          description: When true, the scheduler generates receipts automatically for due periods.
        auto_approve:
          type: boolean
          description: When true, generated receipts are created with status "open" instead of "draft".
        project_id:
          type: integer
          nullable: true
        project:
          $ref: "#/components/schemas/Project"
        service_order_id:
          type: integer
          nullable: true
        account_user_id:
          type: integer
          nullable: true
        contact_id:
          type: integer
          nullable: true
        contact:
          $ref: "#/components/schemas/Contact"
        cost_center_id:
          type: integer
          nullable: true
        cost_center:
          $ref: "#/components/schemas/CostCenter"
        due_days:
          type: integer
          nullable: true
          description: Offset in days added to the period start to compute the generated receipt's due date.
        reference:
          type: string
          nullable: true
        issuer_reference:
          type: string
          nullable: true
        vat_rule_code:
          type: string
          nullable: true
        currency_code:
          type: string
        exchange_rate:
          type: string
          description: Exchange rate to the EUR base currency. 1 for EUR.
        positions_price_input_mode:
          $ref: "#/components/schemas/Quote/properties/positions_price_input_mode"
        positions:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/Receipt/properties/positions/items"
        file_id:
          type: integer
          nullable: true
          description: Optional source document attached to the template. Copied to each generated receipt.
        file:
          $ref: "#/components/schemas/FileItem"
        e_invoice:
          type: boolean
          description: Whether the attached document is a ZUGFeRD e-invoice (detected from embedded XML in the PDF).
        first_period_start:
          $ref: "#/components/schemas/DateString"
        end_date:
          $ref: "#/components/schemas/DateStringNullable"
        interval_amount:
          type: integer
          description: Number of interval units between periods (1-999).
        interval_unit:
          type: string
          enum:
            - day
            - week
            - month
            - year
        last_created_period_start:
          $ref: "#/components/schemas/DateStringNullable"
        next_run_date:
          $ref: "#/components/schemas/DateStringNullable"
        receipts_count:
          type: integer
          nullable: true
          description: Number of receipts generated from this template. Present when the count was loaded.
        created_at:
          $ref: "#/components/schemas/CreatedAt"
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
      required:
        - id
        - name
        - receipt_type
        - status
        - automatic_generation
        - auto_approve
        - currency_code
        - exchange_rate
        - first_period_start
        - interval_amount
        - interval_unit
    ReferenceKey:
      type: string
      maxLength: 128
      nullable: true
    RelatedDocumentSummary:
      type: object
      description: Summary of a document linked to the current document (for display in detail views)
      properties:
        link_id:
          type: integer
          description: ID of the link row (for deleting manual related links)
        type:
          type: string
          enum:
            - quote
            - order_confirmation
            - delivery_note
            - invoice
            - credit_note
            - custom_document
        id:
          type: integer
        formatted_number:
          type: string
          nullable: true
        date:
          $ref: "#/components/schemas/DateStringNullable"
        status:
          type: string
        link_type:
          $ref: "#/components/schemas/DocumentLinkType"
      required:
        - link_id
        - type
        - id
        - status
        - link_type
    SepaCreditorId:
      type: string
      minLength: 3
      maxLength: 32
      nullable: true
    ServiceContract:
      type: object
      title: ServiceContract
      properties:
        id:
          type: integer
        number:
          type: integer
          description: Sequential service contract number per account (internal)
        formatted_number:
          type: string
          description: Display number (account format), unique per account
        contact_id:
          type: integer
        contact:
          $ref: "#/components/schemas/Contact"
        cost_center_id:
          type: integer
          nullable: true
        cost_center:
          $ref: "#/components/schemas/CostCenter"
        project_id:
          type: integer
          nullable: true
        project:
          $ref: "#/components/schemas/Project"
        account_user_id:
          type: integer
          nullable: true
        name_line_1:
          type: string
          nullable: true
        name_line_2:
          type: string
          nullable: true
        name_line_3:
          type: string
          nullable: true
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        buyer_email:
          type: string
          nullable: true
        buyer_reference:
          type: string
          nullable: true
        first_period_start:
          type: string
          format: date
          description: Start of first billing period (Datum erste Periode). When resuming after a pause, set to the desired restart date.
        end_date:
          type: string
          format: date
          nullable: true
          description: End of last billing period (End-Datum). To pause, set to the last day to bill.
        interval_amount:
          type: integer
          minimum: 1
          maximum: 999
          description: Length of each billing period in interval_unit steps from the period start (e.g. 3 with unit month = quarterly from first_period_start).
        interval_unit:
          type: string
          enum:
            - day
            - week
            - month
            - year
        positions_price_input_mode:
          $ref: "#/components/schemas/Quote/properties/positions_price_input_mode"
        positions:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentPosition"
        adjustments:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentAdjustment"
        subject:
          type: string
          nullable: true
        reference:
          type: string
          nullable: true
        currency_code:
          type: string
        cash_discount_days:
          type: integer
          nullable: true
        cash_discount_rate:
          type: number
          nullable: true
        payment_method_code:
          type: string
          nullable: true
        payment_terms:
          type: string
          nullable: true
        delivery_terms:
          type: string
          nullable: true
        vat_rule_code:
          type: string
          nullable: true
        text_top:
          type: string
          nullable: true
        text_bottom:
          type: string
          nullable: true
        print_background_id:
          type: integer
          nullable: true
        print_layout_id:
          type: integer
          nullable: true
        print_options:
          $ref: "#/components/schemas/PrintOptions"
        status:
          type: string
          enum:
            - active
            - inactive
        recurring_document_type:
          type: string
          enum:
            - invoice
            - service_order
          description: Generates either invoices or service orders from this contract, not both.
        automatic_generation:
          type: boolean
          description: When true, scheduled/manual processing may create documents for this contract.
        last_created_period_start:
          type: string
          format: date
          nullable: true
          description: Start date of the last billing period for which a document was created (manual or automatic).
        service_object_ids:
          type: array
          description: Service object IDs copied to automatically created service orders.
          items:
            type: integer
        service_order_assignee_account_user_id:
          type: integer
          nullable: true
          description: |
            Default field assignee (Bearbeiter) for service orders created from this contract (manual or automatic).
        service_order_assignee:
          $ref: "#/components/schemas/AccountUser"
          nullable: true
          description: Present when loaded (e.g. single-resource responses).
        invoice_mode:
          type: string
          description: How automatically created invoices are handled when recurring_document_type is invoice. Does not enable automation by itself; use automatic_generation.
          enum:
            - automatic_draft
            - automatic_send_email
        invoice_anchor:
          type: string
          description: When in billing period to create invoice (first day, middle, or last day). Used by billing job.
          enum:
            - first
            - middle
            - last
        payment_term_days:
          type: integer
          minimum: 0
          maximum: 365
          nullable: true
          description: Zahlungsziel in Tagen für aus diesem Vertrag erstellte Rechnungen. Fehlt der Wert, wird die Konten-Standard-Einstellung verwendet.
        email_to:
          type: array
          nullable: true
          items:
            type: string
            format: email
        email_cc:
          type: array
          nullable: true
          items:
            type: string
            format: email
        email_bcc:
          type: array
          nullable: true
          items:
            type: string
            format: email
        email_subject:
          type: string
          nullable: true
        email_message:
          type: string
          nullable: true
        email_copy_to_self:
          type: boolean
        next_billing_period_from:
          type: string
          format: date
          nullable: true
          description: Computed; start of next billing period (read-only)
        next_billing_period_to:
          type: string
          format: date
          nullable: true
          description: Computed; end of next billing period (read-only)
        next_invoice_due_date:
          type: string
          format: date
          nullable: true
          description: Computed; anchor date when next invoice should be created (read-only)
        next_order_due_date:
          type: string
          format: date
          nullable: true
          description: Computed when recurring_document_type is service_order; first day of the next billing period (read-only)
        last_billing:
          description: Latest invoice or service order for this contract (read-only; matches recurring_document_type)
          $ref: "#/components/schemas/ServiceContractLastBillingNullable"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
      required:
        - id
        - number
        - formatted_number
        - contact_id
        - first_period_start
        - interval_amount
        - interval_unit
        - currency_code
        - status
        - recurring_document_type
        - automatic_generation
        - invoice_mode
        - invoice_anchor
    ServiceContractLastBillingNullable:
      title: ServiceContractLastBillingNullable
      description: Latest invoice or service order for this contract (read-only; matches recurring_document_type)
      nullable: true
      allOf:
        - type: object
          title: ServiceContractLastBilling
          description: Latest invoice or service order created for this contract's billing periods (matches recurring_document_type).
          required:
            - document_type
            - id
            - formatted_number
          properties:
            document_type:
              type: string
              enum:
                - invoice
                - service_order
            id:
              type: integer
            formatted_number:
              type: string
            service_contract_period_from:
              type: string
              format: date
              nullable: true
            service_contract_period_to:
              type: string
              format: date
              nullable: true
    ServiceObject:
      type: object
      properties:
        id:
          type: integer
        number:
          type: integer
          description: Sequential number per account (internal)
        formatted_number:
          type: string
          description: Display number (account format), unique per account
        name:
          type: string
        type:
          type: string
          description: Category (machine, building, device, vehicle, other)
          enum:
            - machine
            - building
            - device
            - vehicle
            - other
        serial_number:
          type: string
          nullable: true
        location:
          type: string
          nullable: true
        status:
          type: string
          enum:
            - active
            - inactive
        installed_at:
          type: string
          format: date
          nullable: true
        internal_description:
          type: string
          nullable: true
          description: Internal description (panel only)
        portal_description:
          type: string
          nullable: true
          description: Description visible in the contact portal
        media_files:
          type: array
          items:
            $ref: "#/components/schemas/MediaFile"
        contact_id:
          type: integer
          nullable: true
        contact:
          $ref: "#/components/schemas/Contact"
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
      required:
        - id
        - number
        - formatted_number
        - name
        - type
        - status
    ServiceOrder:
      type: object
      description: |
        Service order (Auftrag): document fields aligned with invoices except due/delivery dates,
        file, sent/paid/e-invoice; includes workflow status and service period.
      properties:
        id:
          type: integer
        number:
          type: integer
        formatted_number:
          type: string
        date:
          type: string
        status:
          type: string
          enum:
            - open
            - planned
            - in_progress
            - done
            - invoiced
            - cancelled
        project_id:
          type: integer
          nullable: true
        project:
          $ref: "#/components/schemas/Project"
        service_contract_id:
          type: integer
          nullable: true
        service_contract:
          $ref: "#/components/schemas/ServiceContract"
        account_user_id:
          type: integer
          nullable: true
          description: |
            Contact person on the order (Ansprechpartner), same role as on invoices and service contracts;
            propagated to documents created from this order.
        account_user:
          $ref: "#/components/schemas/AccountUser"
        assignee_account_user_id:
          type: integer
          nullable: true
          description: |
            Field / dispatch assignee (Bearbeiter) for scheduling; may differ from the contact person; not copied to documents.
        assignee:
          $ref: "#/components/schemas/AccountUser"
        contact_id:
          type: integer
          nullable: true
        contact:
          $ref: "#/components/schemas/Contact"
        cost_center_id:
          type: integer
          nullable: true
        cost_center:
          $ref: "#/components/schemas/CostCenter"
        name_line_1:
          type: string
          nullable: true
        name_line_2:
          type: string
          nullable: true
        name_line_3:
          type: string
          nullable: true
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        buyer_email:
          type: string
          nullable: true
        buyer_reference:
          type: string
          nullable: true
        service_contract_period_from:
          $ref: "#/components/schemas/DateStringNullable"
          description: When set with service_contract_id, this order is assigned to this billing period of the contract
        service_contract_period_to:
          $ref: "#/components/schemas/DateStringNullable"
          description: When set with service_contract_id, this order is assigned to this billing period of the contract
        subject:
          type: string
          nullable: true
        reference:
          type: string
          nullable: true
        service_location:
          type: string
          nullable: true
          description: On-site service location (Einsatzort); multiline plain text, not part of the printed document address block
        cash_discount_days:
          type: integer
          nullable: true
        cash_discount_rate:
          type: number
          nullable: true
        payment_method_code:
          type: string
          nullable: true
        payment_terms:
          type: string
          nullable: true
        delivery_terms:
          type: string
          nullable: true
        vat_rule_code:
          type: string
          nullable: true
        currency_code:
          type: string
        sum_net:
          type: integer
        sum_tax:
          type: integer
        sum_gross:
          type: integer
        amount_open:
          type: integer
          nullable: true
        positions_price_input_mode:
          $ref: "#/components/schemas/Quote/properties/positions_price_input_mode"
        positions:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentPosition"
        adjustments:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentAdjustment"
        taxes:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentTax"
        text_top:
          type: string
          nullable: true
        text_bottom:
          type: string
          nullable: true
        print_background_id:
          type: integer
          nullable: true
        print_layout_id:
          type: integer
          nullable: true
        print_options:
          $ref: "#/components/schemas/PrintOptions"
        service_date_from:
          $ref: "#/components/schemas/DateStringNullable"
          description: Document service period start (date only), like invoices; scheduling uses appointments
        service_date_to:
          $ref: "#/components/schemas/DateStringNullable"
          description: Document service period end (date only), like invoices; scheduling uses appointments
        appointments:
          type: array
          nullable: true
          description: Loaded on service order detail and list; scheduled Gantt tasks map to these rows
          items:
            $ref: "#/components/schemas/ServiceOrderAppointment"
        service_object_ids:
          type: array
          items:
            type: integer
        service_objects:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/ServiceObject"
        media_files:
          type: array
          items:
            $ref: "#/components/schemas/MediaFile"
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
      required:
        - id
        - number
        - formatted_number
        - date
        - status
        - currency_code
        - sum_net
        - sum_tax
        - sum_gross
    ServiceOrderAppointment:
      type: object
      title: ServiceOrderAppointment
      description: Scheduled dispatch / visit window for a service order (Gantt bar source)
      properties:
        id:
          type: integer
        service_order_id:
          type: integer
        service_order:
          description: Parent order summary; always present when returned from the API.
          type: object
          title: ServiceOrderAppointmentParentSummary
          properties:
            id:
              type: integer
            formatted_number:
              type: string
            subject:
              type: string
              nullable: true
            service_location:
              type: string
              nullable: true
            contact_name:
              type: string
              nullable: true
              description: Contact display name for scheduling views without loading full contact
            status:
              type: string
              enum:
                - open
                - planned
                - in_progress
                - done
                - invoiced
                - cancelled
          required:
            - id
            - formatted_number
            - status
        starts_at:
          type: string
          description: Local datetime without timezone (Y-m-dTH:i:s)
          example: 2025-01-14T09:00:00
        ends_at:
          type: string
          description: Local datetime without timezone (Y-m-dTH:i:s)
          example: 2025-01-14T17:00:00
        assignee_account_user_id:
          type: integer
          nullable: true
        status:
          type: string
          enum:
            - planned
            - confirmed
            - completed
            - cancelled
        assignee:
          $ref: "#/components/schemas/AccountUser"
          nullable: true
        created_at:
          $ref: "#/components/schemas/CreatedAt"
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
      required:
        - id
        - service_order_id
        - service_order
        - starts_at
        - ends_at
        - status
    ServiceProtocol:
      type: object
      properties:
        id:
          type: integer
        number:
          type: integer
        formatted_number:
          type: string
        date:
          $ref: "#/components/schemas/DateTime"
          nullable: true
        name:
          type: string
        description:
          type: string
          nullable: true
        account_user_id:
          type: integer
          nullable: true
        account_user:
          $ref: "#/components/schemas/AccountUser"
        service_order_id:
          type: integer
          nullable: true
        service_order:
          $ref: "#/components/schemas/ServiceOrder"
        service_object_ids:
          $ref: "#/components/schemas/Quote/properties/service_object_ids"
        service_objects:
          $ref: "#/components/schemas/Quote/properties/service_objects"
        media_files:
          type: array
          items:
            $ref: "#/components/schemas/MediaFile"
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
      required:
        - id
        - number
        - formatted_number
        - name
    ServiceProtocolTemplate:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        content:
          type: string
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
      required:
        - id
        - name
        - content
    SortTasksInGroupRequest:
      type: object
      properties:
        ordering:
          type: integer
          description: Set the target ordering index, all other tasks ordering will be incremented.
          nullable: true
        task_ids:
          type: array
          items:
            type: integer
            minimum: 0
          minItems: 1
      required:
        - task_ids
    State:
      type: string
      description: State or region of the address.
      maxLength: 255
      nullable: true
    Task:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        description:
          type: string
        due_at:
          $ref: "#/components/schemas/DateTime"
        priority_type:
          type: string
          enum:
            - none
            - minor
            - major
            - critical
            - blocker
        closed:
          type: boolean
        closed_at:
          $ref: "#/components/schemas/DateTime"
        created_user_id:
          type: integer
        created_by:
          $ref: "#/components/schemas/User"
        account_user_id:
          type: integer
        account_user:
          $ref: "#/components/schemas/AccountUser"
        task_groups:
          type: array
          items:
            $ref: "#/components/schemas/TaskGroup"
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
      required:
        - id
        - name
    TaskGroup:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        ordering:
          type: integer
        entity_type:
          type: string
        entity_id:
          type: integer
        entity:
          $ref: "#/components/schemas/GenericEntity"
        tasks_count:
          type: integer
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
      required:
        - id
        - name
    TaxId:
      type: string
      maxLength: 50
      description: Tax ID
      nullable: true
    TextTemplate:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        type:
          type: string
          enum:
            - document
            - email
            - generic
        document_type:
          type: string
          nullable: true
          enum:
            - all
            - custom_document
            - quote
            - order_confirmation
            - delivery_note
            - invoice
            - dunning
            - credit_note
            - accounting_export
        position:
          type: string
          enum:
            - subject
            - top
            - bottom
        is_default:
          type: boolean
        visible_for_me:
          type: boolean
        content:
          type: string
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
      required:
        - id
        - name
        - type
        - position
        - content
    Time:
      type: string
      example: 831
      description: Time in hours and minutes
    UpdateAccountRequest:
      type: object
      properties:
        name:
          $ref: "#/components/schemas/Account/properties/name"
        company_name:
          $ref: "#/components/schemas/Account/properties/company_name"
        director_name:
          $ref: "#/components/schemas/Account/properties/director_name"
        legal_form:
          $ref: "#/components/schemas/Account/properties/legal_form"
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        phone:
          $ref: "#/components/schemas/Phone"
        email:
          $ref: "#/components/schemas/EmailAddress"
        website:
          $ref: "#/components/schemas/WebLink"
        website_contact:
          $ref: "#/components/schemas/WebLink"
        website_imprint:
          $ref: "#/components/schemas/WebLink"
        website_support:
          $ref: "#/components/schemas/WebLink"
        website_privacy_policy:
          $ref: "#/components/schemas/WebLink"
        website_terms_of_service:
          $ref: "#/components/schemas/WebLink"
        district_court:
          $ref: "#/components/schemas/Account/properties/district_court"
        trading_register_number:
          $ref: "#/components/schemas/Account/properties/trading_register_number"
        bank_iban:
          $ref: "#/components/schemas/BankIban"
        bank_bic:
          $ref: "#/components/schemas/BankBic"
        sepa_creditor_id:
          $ref: "#/components/schemas/SepaCreditorId"
        vat_id:
          $ref: "#/components/schemas/VatId"
        tax_id:
          $ref: "#/components/schemas/TaxId"
        industry:
          $ref: "#/components/schemas/Account/properties/industry"
        employees:
          $ref: "#/components/schemas/Account/properties/employees"
    UpdateBankAccountRequest:
      type: object
      properties:
        name:
          type: string
          maxLength: 255
          nullable: true
        iban:
          type: string
          maxLength: 50
          nullable: true
        bic:
          type: string
          maxLength: 11
          nullable: true
        currency_code:
          type: string
          maxLength: 3
          nullable: true
        is_active:
          type: boolean
          nullable: true
        is_manual:
          type: boolean
          nullable: true
          description: True = manual account; false = externally synced.
        booking_account_number:
          type: integer
          nullable: true
          description: Ledger account number for DATEV export.
    UpdateBankTransactionRequest:
      type: object
      properties:
        bank_account_id:
          type: integer
          minimum: 1
          nullable: true
        transaction_date:
          $ref: "#/components/schemas/DateTime"
          nullable: true
        value_date:
          $ref: "#/components/schemas/DateString"
          nullable: true
        amount_cents:
          type: integer
          nullable: true
        reference:
          type: string
          nullable: true
        counterparty_name:
          type: string
          nullable: true
        counterparty_account_number:
          type: string
          maxLength: 34
          nullable: true
        counterparty_bank_code:
          type: string
          maxLength: 8
          nullable: true
        memo:
          type: string
          nullable: true
        currency_code:
          type: string
          maxLength: 3
          nullable: true
        is_private:
          type: boolean
          nullable: true
        is_no_assignment_required:
          type: boolean
          nullable: true
        auto_detected:
          type: boolean
          nullable: true
    UpdateCommentRequest:
      type: object
      properties:
        text:
          $ref: "#/components/schemas/MediumText"
      required:
        - text
    UpdateContactFieldRequest:
      type: object
      properties:
        key:
          type: string
          minLength: 3
          maxLength: 255
          nullable: true
        name:
          type: string
          minLength: 3
          maxLength: 255
          nullable: true
        description:
          type: string
          minLength: 1
          maxLength: 255
          nullable: true
        type:
          type: string
          nullable: true
        select_values:
          type: array
          minItems: 1
          items:
            type: string
            maxLength: 255
          nullable: true
        default_value:
          description: default value
          nullable: true
        ordering:
          type: integer
          nullable: true
          minimum: 0
    UpdateContactGroupRequest:
      type: object
      properties:
        name:
          type: string
          minLength: 3
          maxLength: 255
          nullable: false
    UpdateContactRequest:
      type: object
      properties:
        parent_id:
          type: integer
          minimum: 0
          nullable: true
        type:
          $ref: "#/components/schemas/Contact/properties/type"
        name:
          $ref: "#/components/schemas/Contact/properties/name"
        company_name:
          $ref: "#/components/schemas/Contact/properties/company_name"
        gender:
          $ref: "#/components/schemas/Contact/properties/gender"
        title:
          $ref: "#/components/schemas/Contact/properties/title"
        first_name:
          $ref: "#/components/schemas/Contact/properties/first_name"
        last_name:
          $ref: "#/components/schemas/Contact/properties/last_name"
        additional_name:
          $ref: "#/components/schemas/Contact/properties/additional_name"
        position:
          $ref: "#/components/schemas/Contact/properties/position"
        birthdate:
          $ref: "#/components/schemas/Contact/properties/birthdate"
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        phones:
          $ref: "#/components/schemas/Phones"
        emails:
          $ref: "#/components/schemas/Emails"
        websites:
          $ref: "#/components/schemas/Websites"
        reference_key:
          $ref: "#/components/schemas/ReferenceKey"
        contact_number:
          $ref: "#/components/schemas/Contact/properties/contact_number"
        debtor_number:
          $ref: "#/components/schemas/Contact/properties/debtor_number"
        creditor_number:
          $ref: "#/components/schemas/Contact/properties/creditor_number"
        bank_iban:
          $ref: "#/components/schemas/BankIban"
        bank_bic:
          $ref: "#/components/schemas/BankBic"
        sepa_creditor_id:
          $ref: "#/components/schemas/SepaCreditorId"
        vat_id:
          $ref: "#/components/schemas/VatId"
        tax_id:
          $ref: "#/components/schemas/TaxId"
        cash_discount_days:
          $ref: "#/components/schemas/Contact/properties/cash_discount_days"
        cash_discount_rate:
          $ref: "#/components/schemas/Contact/properties/cash_discount_rate"
        payment_term_days:
          $ref: "#/components/schemas/Contact/properties/payment_term_days"
        quote_due_days:
          $ref: "#/components/schemas/Contact/properties/quote_due_days"
        customer_discount_rate:
          $ref: "#/components/schemas/Contact/properties/customer_discount_rate"
        payment_terms:
          type: string
          nullable: true
        delivery_terms:
          type: string
          nullable: true
        buyer_reference:
          type: string
        internal_note:
          $ref: "#/components/schemas/MediumText"
        group_ids:
          $ref: "#/components/schemas/IdList"
        fields:
          type: array
          items:
            $ref: "#/components/schemas/UpdateContactRequestFieldItem"
        custom_data:
          $ref: "#/components/schemas/CustomData"
    UpdateContactRequestFieldItem:
      title: UpdateContactRequestFieldItem
      type: object
      properties:
        id:
          type: integer
          description: Id of the field
        value:
          description: Value of the field
      required:
        - id
    UpdateCostCenterRequest:
      type: object
      properties:
        name:
          type: string
          nullable: true
        code:
          type: string
          nullable: true
        booking_account_number:
          type: integer
          nullable: true
    UpdateCreditNoteRequest:
      type: object
      properties:
        formatted_number:
          type: string
          nullable: true
        date:
          type: string
          nullable: true
        contact_id:
          type: integer
          nullable: true
        cost_center_id:
          type: integer
          nullable: true
        project_id:
          type: integer
          nullable: true
        service_contract_id:
          type: integer
          nullable: true
        service_order_id:
          type: integer
          nullable: true
        account_user_id:
          type: integer
          nullable: true
        invoice_id:
          type: integer
          nullable: true
          description: Invoice this credit note refers to
        reference:
          type: string
          nullable: true
        name_line_1:
          type: string
          nullable: true
        name_line_2:
          type: string
          nullable: true
        name_line_3:
          type: string
          nullable: true
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        buyer_email:
          type: string
          nullable: true
        buyer_reference:
          type: string
          nullable: true
        currency_code:
          type: string
          nullable: true
        exchange_rate:
          type: string
          nullable: true
          description: Optional exchange rate to EUR (foreign units per 1 EUR, ECB convention). When omitted, it is prefilled from the daily ECB rate for the document date.
        due_date:
          type: string
          nullable: true
        positions_price_input_mode:
          $ref: "#/components/schemas/Quote/properties/positions_price_input_mode"
        positions:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentPosition"
        adjustments:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentAdjustment"
        cash_discount_days:
          type: integer
          nullable: true
        cash_discount_rate:
          type: number
          nullable: true
        payment_method_code:
          type: string
          nullable: true
        vat_rule_code:
          type: string
          nullable: true
        payment_terms:
          type: string
          nullable: true
        delivery_terms:
          type: string
          nullable: true
        subject:
          type: string
          nullable: true
        text_top:
          type: string
          nullable: true
        text_bottom:
          type: string
          nullable: true
        print_background_id:
          type: integer
          nullable: true
        print_layout_id:
          type: integer
          nullable: true
        print_options:
          $ref: "#/components/schemas/PrintOptions"
        service_object_ids:
          $ref: "#/components/schemas/Quote/properties/service_object_ids"
        e_invoice:
          type: boolean
          nullable: true
          description: When true, PDF is generated with embedded ZUGFeRD 2.2 (EN16931) XML
        e_invoice_allowance_reason_code:
          type: string
          nullable: true
          maxLength: 10
          description: UNCL 5189 code for e-invoice (e.g. 65 Minderleistung, 95 Honorar, 100 Provision)
    UpdateCustomDocumentRequest:
      type: object
      properties:
        formatted_number:
          type: string
          nullable: true
        date:
          type: string
          nullable: true
        contact_id:
          type: integer
          nullable: true
        project_id:
          type: integer
          nullable: true
        service_contract_id:
          type: integer
          nullable: true
        service_order_id:
          type: integer
          nullable: true
        account_user_id:
          type: integer
          nullable: true
        reference:
          type: string
          nullable: true
        name_line_1:
          type: string
          nullable: true
        name_line_2:
          type: string
          nullable: true
        name_line_3:
          type: string
          nullable: true
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        subject:
          type: string
          nullable: true
        text:
          type: string
          nullable: true
        print_background_id:
          type: integer
          nullable: true
        print_layout_id:
          type: integer
          nullable: true
        print_options:
          $ref: "#/components/schemas/PrintOptions"
        service_object_ids:
          $ref: "#/components/schemas/Quote/properties/service_object_ids"
    UpdateDeliveryNoteRequest:
      type: object
      properties:
        formatted_number:
          type: string
          nullable: true
        date:
          $ref: "#/components/schemas/DateString"
          nullable: true
        contact_id:
          type: integer
          nullable: true
        project_id:
          type: integer
          nullable: true
        service_contract_id:
          type: integer
          nullable: true
        service_order_id:
          type: integer
          nullable: true
        account_user_id:
          type: integer
          nullable: true
        reference:
          type: string
          nullable: true
        name_line_1:
          type: string
          nullable: true
        name_line_2:
          type: string
          nullable: true
        name_line_3:
          type: string
          nullable: true
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        buyer_email:
          type: string
          nullable: true
        buyer_reference:
          type: string
          nullable: true
        currency_code:
          type: string
          nullable: true
        exchange_rate:
          type: string
          nullable: true
          description: Optional exchange rate to EUR (foreign units per 1 EUR, ECB convention). When omitted, it is prefilled from the daily ECB rate for the document date.
        positions_price_input_mode:
          $ref: "#/components/schemas/Quote/properties/positions_price_input_mode"
        positions:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentPosition"
        adjustments:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentAdjustment"
        cash_discount_days:
          type: integer
          nullable: true
        cash_discount_rate:
          type: number
          nullable: true
        payment_method_code:
          type: string
          nullable: true
        vat_rule_code:
          type: string
          nullable: true
        payment_terms:
          type: string
          nullable: true
        delivery_terms:
          type: string
          nullable: true
        subject:
          type: string
          nullable: true
        text_top:
          type: string
          nullable: true
        text_bottom:
          type: string
          nullable: true
        print_background_id:
          type: integer
          nullable: true
        print_layout_id:
          type: integer
          nullable: true
        print_options:
          $ref: "#/components/schemas/PrintOptions"
        service_object_ids:
          $ref: "#/components/schemas/Quote/properties/service_object_ids"
    UpdateDunningRequest:
      type: object
      description: Request to update a dunning (draft only). invoice_id cannot be changed. Display number is derived from invoice + dunning level.
      properties:
        date:
          type: string
          format: date
          nullable: true
          description: Dunning date (YYYY-MM-DD)
        due_date:
          type: string
          format: date
          nullable: true
          description: Due date (YYYY-MM-DD)
        subject:
          type: string
          nullable: true
          description: Subject line
        text_top:
          type: string
          nullable: true
          description: Header text (HTML)
        text_bottom:
          type: string
          nullable: true
          description: Footer text (HTML)
        dunning_level:
          type: integer
          minimum: 0
          maximum: 10
          nullable: true
          description: 0 = payment reminder, 1+ = dunning level
        dunning_fee_amount:
          type: integer
          minimum: 0
          nullable: true
          description: Dunning fee in cents
        currency_code:
          type: string
          minLength: 3
          maxLength: 3
          nullable: true
          description: Currency code (e.g. EUR)
        exchange_rate:
          type: string
          nullable: true
          description: Optional exchange rate to EUR (foreign units per 1 EUR, ECB convention). When omitted, it is prefilled from the daily ECB rate for the document date.
        print_background_id:
          type: integer
          minimum: 0
          nullable: true
          description: Letterhead/print background template
        print_layout_id:
          type: integer
          minimum: 0
          nullable: true
          description: Print layout
        print_options:
          $ref: "#/components/schemas/PrintOptions"
        service_object_ids:
          $ref: "#/components/schemas/Quote/properties/service_object_ids"
    UpdateFileFolderRequest:
      type: object
      properties:
        name:
          type: string
          minLength: 1
          maxLength: 128
          nullable: false
        hex_color:
          type: string
          minLength: 3
          maxLength: 7
          nullable: true
        parent_id:
          type: integer
          minimum: 0
          nullable: true
    UpdateFileRequest:
      type: object
      properties:
        folder_id:
          type: integer
          nullable: true
        category:
          type: string
          maxLength: 32
          nullable: true
        date:
          type: string
          format: date
          nullable: true
        reference_number:
          type: string
          nullable: true
        contact_id:
          type: integer
          nullable: true
        file_name:
          type: string
          nullable: true
        notes:
          type: string
          nullable: true
    UpdateInvoiceRequest:
      type: object
      properties:
        formatted_number:
          type: string
          nullable: true
        date:
          type: string
          nullable: true
        contact_id:
          type: integer
          nullable: true
        cost_center_id:
          type: integer
          nullable: true
        project_id:
          type: integer
          nullable: true
        service_contract_id:
          type: integer
          nullable: true
        service_order_id:
          type: integer
          nullable: true
        account_user_id:
          type: integer
          nullable: true
        reference:
          type: string
          nullable: true
        name_line_1:
          type: string
          nullable: true
        name_line_2:
          type: string
          nullable: true
        name_line_3:
          type: string
          nullable: true
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        buyer_email:
          type: string
          nullable: true
        buyer_reference:
          type: string
          nullable: true
        currency_code:
          type: string
          nullable: true
        exchange_rate:
          type: string
          nullable: true
          description: Optional exchange rate to EUR (foreign units per 1 EUR, ECB convention). When omitted, it is prefilled from the daily ECB rate for the document date.
        due_date:
          type: string
          nullable: true
        positions_price_input_mode:
          $ref: "#/components/schemas/Quote/properties/positions_price_input_mode"
        positions:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentPosition"
        adjustments:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentAdjustment"
        cash_discount_days:
          type: integer
          nullable: true
        cash_discount_rate:
          type: number
          nullable: true
        payment_method_code:
          type: string
          nullable: true
        vat_rule_code:
          type: string
          nullable: true
        payment_terms:
          type: string
          nullable: true
        delivery_terms:
          type: string
          nullable: true
        subject:
          type: string
          nullable: true
        text_top:
          type: string
          nullable: true
        text_bottom:
          type: string
          nullable: true
        print_background_id:
          type: integer
          nullable: true
        print_layout_id:
          type: integer
          nullable: true
        print_options:
          $ref: "#/components/schemas/PrintOptions"
        service_object_ids:
          $ref: "#/components/schemas/Quote/properties/service_object_ids"
        e_invoice:
          type: boolean
          nullable: true
          description: When true, the PDF is generated with embedded ZUGFeRD 2.2 (EN16931) XML
        service_date_from:
          $ref: "#/components/schemas/DateStringNullable"
        service_date_to:
          $ref: "#/components/schemas/DateStringNullable"
    UpdateLocationRequest:
      type: object
      properties:
        name:
          type: string
          maxLength: 255
          nullable: true
        code:
          type: string
          maxLength: 64
          nullable: true
        description:
          type: string
          nullable: true
        address_line_1:
          type: string
          maxLength: 255
          nullable: true
        address_line_2:
          type: string
          maxLength: 255
          nullable: true
        zip:
          type: string
          maxLength: 32
          nullable: true
        city:
          type: string
          maxLength: 255
          nullable: true
        state:
          type: string
          maxLength: 255
          nullable: true
        country_code:
          type: string
          maxLength: 3
          nullable: true
        phone:
          type: string
          maxLength: 24
          nullable: true
        email:
          type: string
          format: email
          maxLength: 255
          nullable: true
        website:
          type: string
          format: uri
          maxLength: 255
          nullable: true
        internal_note:
          type: string
          nullable: true
        active:
          type: boolean
          nullable: true
    UpdateMediaFileRequest:
      type: object
      properties:
        description:
          type: string
          maxLength: 200
          nullable: true
    UpdateOrderConfirmationRequest:
      type: object
      properties:
        formatted_number:
          type: string
          nullable: true
        date:
          $ref: "#/components/schemas/DateString"
          nullable: true
        contact_id:
          type: integer
          nullable: true
        project_id:
          type: integer
          nullable: true
        service_contract_id:
          type: integer
          nullable: true
        service_order_id:
          type: integer
          nullable: true
        account_user_id:
          type: integer
          nullable: true
        reference:
          type: string
          nullable: true
        name_line_1:
          type: string
          nullable: true
        name_line_2:
          type: string
          nullable: true
        name_line_3:
          type: string
          nullable: true
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        buyer_email:
          type: string
          nullable: true
        buyer_reference:
          type: string
          nullable: true
        currency_code:
          type: string
          nullable: true
        exchange_rate:
          type: string
          nullable: true
          description: Optional exchange rate to EUR (foreign units per 1 EUR, ECB convention). When omitted, it is prefilled from the daily ECB rate for the document date.
        positions_price_input_mode:
          $ref: "#/components/schemas/Quote/properties/positions_price_input_mode"
        positions:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentPosition"
        adjustments:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentAdjustment"
        cash_discount_days:
          type: integer
          nullable: true
        cash_discount_rate:
          type: number
          nullable: true
        payment_method_code:
          type: string
          nullable: true
        vat_rule_code:
          type: string
          nullable: true
        payment_terms:
          type: string
          nullable: true
        delivery_terms:
          type: string
          nullable: true
        subject:
          type: string
          nullable: true
        text_top:
          type: string
          nullable: true
        text_bottom:
          type: string
          nullable: true
        print_background_id:
          type: integer
          nullable: true
        print_layout_id:
          type: integer
          nullable: true
        print_options:
          $ref: "#/components/schemas/PrintOptions"
        service_object_ids:
          $ref: "#/components/schemas/Quote/properties/service_object_ids"
    UpdatePersonnelRequest:
      type: object
      properties:
        location_id:
          type: integer
          nullable: true
        contact_id:
          type: integer
          nullable: true
        account_user_id:
          type: integer
          nullable: true
        first_name:
          type: string
          maxLength: 128
          nullable: true
        last_name:
          type: string
          maxLength: 128
          nullable: true
        title:
          type: string
          maxLength: 64
          nullable: true
        gender:
          type: string
          enum:
            - male
            - female
            - diverse
          nullable: true
        position:
          type: string
          maxLength: 128
          nullable: true
        department:
          type: string
          maxLength: 128
          nullable: true
        employee_number:
          type: string
          maxLength: 64
          nullable: true
        phone:
          type: string
          maxLength: 24
          nullable: true
        mobile:
          type: string
          maxLength: 24
          nullable: true
        email:
          type: string
          format: email
          maxLength: 255
          nullable: true
        hire_date:
          type: string
          format: date
          nullable: true
        termination_date:
          type: string
          format: date
          nullable: true
        internal_note:
          type: string
          nullable: true
        active:
          type: boolean
          nullable: true
    UpdatePrintBackgroundRequest:
      type: object
      properties:
        name:
          type: string
          nullable: true
        is_default:
          type: boolean
          nullable: true
        is_default_custom_document:
          type: boolean
          nullable: true
        is_default_quote:
          type: boolean
          nullable: true
        is_default_order_confirmation:
          type: boolean
          nullable: true
        is_default_delivery_note:
          type: boolean
          nullable: true
        is_default_invoice:
          type: boolean
          nullable: true
        is_default_dunning:
          type: boolean
          nullable: true
        is_default_credit_note:
          type: boolean
          nullable: true
    UpdatePrintLayoutRequest:
      type: object
      properties:
        name:
          type: string
          nullable: true
        layout_name:
          type: string
          nullable: true
          enum:
            - default
            - classic
            - modern
            - elegant
            - minimal
            - accent
        custom_layout:
          type: string
          nullable: true
        is_default:
          type: boolean
          nullable: true
        is_default_custom_document:
          type: boolean
          nullable: true
        is_default_quote:
          type: boolean
          nullable: true
        is_default_order_confirmation:
          type: boolean
          nullable: true
        is_default_delivery_note:
          type: boolean
          nullable: true
        is_default_invoice:
          type: boolean
          nullable: true
        is_default_dunning:
          type: boolean
          nullable: true
        is_default_credit_note:
          type: boolean
          nullable: true
        show_logo:
          type: boolean
          nullable: true
        show_logo_text:
          type: boolean
          nullable: true
        logo_text:
          type: string
          nullable: true
        footer_content:
          type: string
          nullable: true
        show_header:
          type: boolean
          nullable: true
        show_footer:
          type: boolean
          nullable: true
        show_page_numbers:
          type: boolean
          nullable: true
        show_folding_marks:
          type: boolean
          nullable: true
        show_amounts:
          type: boolean
          nullable: true
        show_item_prices:
          type: boolean
          nullable: true
        show_item_totals:
          type: boolean
          nullable: true
        show_item_tax_rate:
          type: boolean
          nullable: true
        show_item_sku:
          type: boolean
          nullable: true
        show_totals:
          type: boolean
          nullable: true
        show_terms:
          type: boolean
          nullable: true
        show_contact_number:
          type: boolean
          nullable: true
        show_contact_person:
          type: boolean
          nullable: true
        show_signature_field:
          type: boolean
          nullable: true
        color_accent:
          type: string
          nullable: true
        color_primary:
          type: string
          nullable: true
        color_secondary:
          type: string
          nullable: true
    UpdateProductRequest:
      type: object
      properties:
        sku:
          type: string
          nullable: true
        name:
          type: string
          nullable: true
        description:
          type: string
          nullable: true
        type:
          type: string
          enum:
            - physical
            - virtual
            - service
          nullable: true
        unit_code:
          $ref: "#/components/schemas/Product/properties/unit_code"
        tax_rate:
          type: number
          nullable: true
        price_net:
          type: integer
          nullable: true
        purchase_price_net:
          type: integer
          nullable: true
        has_stock:
          type: boolean
          nullable: true
        internal_note:
          type: string
          nullable: true
    UpdateProjectRequest:
      type: object
      properties:
        number:
          type: integer
          nullable: true
          description: Sequential project number per account
        formatted_number:
          type: string
          nullable: true
          description: Display number per account
        name:
          type: string
          nullable: true
        hex_color:
          type: string
          nullable: true
        description:
          type: string
          nullable: true
        status:
          type: string
          enum:
            - pending
            - active
            - completed
            - archived
          nullable: true
        start_date:
          type: string
          format: date
          nullable: true
        end_date:
          type: string
          format: date
          nullable: true
        contact_id:
          type: integer
          nullable: true
    UpdateQuoteRequest:
      type: object
      properties:
        formatted_number:
          type: string
          nullable: true
        date:
          type: string
        contact_id:
          type: integer
        project_id:
          type: integer
          nullable: true
        service_order_id:
          type: integer
          nullable: true
        account_user_id:
          type: integer
          nullable: true
        reference:
          type: string
          nullable: true
        name_line_1:
          type: string
          nullable: true
        name_line_2:
          type: string
          nullable: true
        name_line_3:
          type: string
          nullable: true
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        buyer_email:
          type: string
          nullable: true
        buyer_reference:
          type: string
          nullable: true
        currency_code:
          type: string
          nullable: true
        exchange_rate:
          type: string
          nullable: true
          description: Optional exchange rate to EUR (foreign units per 1 EUR, ECB convention). When omitted, it is prefilled from the daily ECB rate for the document date.
        due_date:
          type: string
        positions_price_input_mode:
          $ref: "#/components/schemas/Quote/properties/positions_price_input_mode"
        positions:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentPosition"
        adjustments:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentAdjustment"
        cash_discount_days:
          type: integer
          nullable: true
        cash_discount_rate:
          type: number
          nullable: true
        payment_method_code:
          type: string
          nullable: true
        vat_rule_code:
          type: string
          nullable: true
        payment_terms:
          type: string
          nullable: true
        delivery_terms:
          type: string
          nullable: true
        subject:
          type: string
          nullable: true
        text_top:
          type: string
          nullable: true
        text_bottom:
          type: string
          nullable: true
        print_background_id:
          type: integer
          nullable: true
        print_layout_id:
          type: integer
          nullable: true
        print_options:
          $ref: "#/components/schemas/PrintOptions"
        service_object_ids:
          $ref: "#/components/schemas/Quote/properties/service_object_ids"
    UpdateReceiptRequest:
      type: object
      properties:
        receipt_type:
          type: string
          enum:
            - expense
            - income
        status:
          type: string
          enum:
            - draft
            - open
        date:
          $ref: "#/components/schemas/DateString"
        contact_id:
          type: integer
          nullable: true
        cost_center_id:
          type: integer
          nullable: true
        project_id:
          type: integer
          nullable: true
        service_order_id:
          type: integer
          nullable: true
        account_user_id:
          type: integer
          nullable: true
        reference:
          type: string
          nullable: true
        issuer_reference:
          type: string
          nullable: true
        currency_code:
          type: string
        exchange_rate:
          type: string
          nullable: true
          description: Optional exchange rate to EUR (foreign units per 1 EUR, ECB convention). When omitted, it is prefilled from the daily ECB rate for the receipt date.
        due_date:
          $ref: "#/components/schemas/DateStringNullable"
        delivery_date:
          $ref: "#/components/schemas/DateStringNullable"
        service_date_from:
          $ref: "#/components/schemas/DateStringNullable"
        service_date_to:
          $ref: "#/components/schemas/DateStringNullable"
        positions_price_input_mode:
          $ref: "#/components/schemas/Quote/properties/positions_price_input_mode"
        positions:
          type: array
          minItems: 1
          items:
            $ref: "#/components/schemas/Receipt/properties/positions/items"
        vat_rule_code:
          type: string
          nullable: true
        file_hash:
          type: string
          description: SHA-256 hash returned by analyzeReceiptFile; attaches the staged upload to the receipt.
          pattern: ^[a-f0-9]{64}$
        remove_file:
          type: boolean
          description: When true, removes the currently attached document file from the receipt (draft only).
        start_analysis:
          type: boolean
          default: true
          description: When true and a new file_hash is provided on a draft receipt, analysis starts automatically after save.
    UpdateRecurringReceiptRequest:
      type: object
      description: Partial update; all fields are optional.
      properties:
        name:
          type: string
        receipt_type:
          type: string
          enum:
            - expense
            - income
        status:
          type: string
          enum:
            - active
            - inactive
        automatic_generation:
          type: boolean
          nullable: true
        auto_approve:
          type: boolean
          nullable: true
        contact_id:
          type: integer
          nullable: true
        cost_center_id:
          type: integer
          nullable: true
        project_id:
          type: integer
          nullable: true
        service_order_id:
          type: integer
          nullable: true
        account_user_id:
          type: integer
          nullable: true
        due_days:
          type: integer
          nullable: true
        reference:
          type: string
          nullable: true
        issuer_reference:
          type: string
          nullable: true
        vat_rule_code:
          type: string
          nullable: true
        currency_code:
          type: string
        exchange_rate:
          type: string
          nullable: true
        positions_price_input_mode:
          $ref: "#/components/schemas/Quote/properties/positions_price_input_mode"
        positions:
          type: array
          items:
            $ref: "#/components/schemas/Receipt/properties/positions/items"
        file_hash:
          type: string
          nullable: true
          description: Hash of a previously staged/uploaded document (see analyzeReceiptFile) to attach to the template.
        remove_file:
          type: boolean
          nullable: true
          description: When true, removes the currently attached document from the template.
        first_period_start:
          $ref: "#/components/schemas/DateString"
        end_date:
          $ref: "#/components/schemas/DateStringNullable"
        interval_amount:
          type: integer
          minimum: 1
          maximum: 999
        interval_unit:
          type: string
          enum:
            - day
            - week
            - month
            - year
        last_created_period_start:
          $ref: "#/components/schemas/DateStringNullable"
    UpdateServiceContractRequest:
      type: object
      properties:
        number:
          type: integer
          nullable: true
          description: Sequential service contract number per account
        formatted_number:
          type: string
          nullable: true
          description: Display number per account
        contact_id:
          type: integer
        cost_center_id:
          type: integer
          nullable: true
        project_id:
          type: integer
          nullable: true
        account_user_id:
          type: integer
          nullable: true
        name_line_1:
          type: string
          nullable: true
        name_line_2:
          type: string
          nullable: true
        name_line_3:
          type: string
          nullable: true
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        buyer_email:
          type: string
          nullable: true
        buyer_reference:
          type: string
          nullable: true
        first_period_start:
          type: string
          format: date
          description: Start of first billing period (Datum erste Periode)
        end_date:
          type: string
          format: date
          nullable: true
          description: End of last billing period (End-Datum)
        interval_amount:
          type: integer
          minimum: 1
          maximum: 999
          nullable: true
        interval_unit:
          type: string
          nullable: true
          enum:
            - day
            - week
            - month
            - year
        positions_price_input_mode:
          $ref: "#/components/schemas/Quote/properties/positions_price_input_mode"
        positions:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentPosition"
        adjustments:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentAdjustment"
        subject:
          type: string
          nullable: true
        reference:
          type: string
          nullable: true
        currency_code:
          type: string
        cash_discount_days:
          type: integer
          nullable: true
        cash_discount_rate:
          type: number
          nullable: true
        payment_method_code:
          type: string
          nullable: true
        payment_terms:
          type: string
          nullable: true
        delivery_terms:
          type: string
          nullable: true
        vat_rule_code:
          type: string
          nullable: true
        text_top:
          type: string
          nullable: true
        text_bottom:
          type: string
          nullable: true
        print_background_id:
          type: integer
          nullable: true
        print_layout_id:
          type: integer
          nullable: true
        print_options:
          $ref: "#/components/schemas/PrintOptions"
        status:
          type: string
          enum:
            - active
            - inactive
        recurring_document_type:
          type: string
          enum:
            - invoice
            - service_order
        automatic_generation:
          type: boolean
        last_created_period_start:
          type: string
          format: date
          nullable: true
          description: Start of the last period for which a document was created; may be set manually or by background jobs.
        service_object_ids:
          type: array
          nullable: true
          items:
            type: integer
        service_order_assignee_account_user_id:
          type: integer
          nullable: true
          description: Default field assignee (Bearbeiter) for service orders created from this contract.
        invoice_mode:
          type: string
          enum:
            - automatic_draft
            - automatic_send_email
        invoice_anchor:
          type: string
          enum:
            - first
            - middle
            - last
        payment_term_days:
          type: integer
          minimum: 0
          maximum: 365
          nullable: true
          description: Zahlungsziel in Tagen für erstellte Rechnungen.
        email_to:
          type: array
          nullable: true
          items:
            type: string
            format: email
        email_cc:
          type: array
          nullable: true
          items:
            type: string
            format: email
        email_bcc:
          type: array
          nullable: true
          items:
            type: string
            format: email
        email_subject:
          type: string
          nullable: true
        email_message:
          type: string
          nullable: true
        email_copy_to_self:
          type: boolean
    UpdateServiceObjectRequest:
      type: object
      properties:
        number:
          type: integer
          nullable: true
        formatted_number:
          type: string
          nullable: true
        name:
          type: string
        type:
          type: string
          enum:
            - machine
            - building
            - device
            - vehicle
            - other
        serial_number:
          type: string
          nullable: true
        location:
          type: string
          nullable: true
        status:
          type: string
          enum:
            - active
            - inactive
        installed_at:
          type: string
          format: date
          nullable: true
        contact_id:
          type: integer
          nullable: true
        internal_description:
          type: string
          nullable: true
        portal_description:
          type: string
          nullable: true
    UpdateServiceOrderAppointmentRequest:
      type: object
      properties:
        starts_at:
          type: string
          description: Parseable datetime (e.g. Y-m-d H:i or ISO local)
        ends_at:
          type: string
        assignee_account_user_id:
          type: integer
          nullable: true
        status:
          type: string
          enum:
            - planned
            - confirmed
            - completed
            - cancelled
    UpdateServiceOrderRequest:
      type: object
      properties:
        number:
          type: integer
          nullable: true
        formatted_number:
          type: string
          nullable: true
        date:
          type: string
        status:
          type: string
          enum:
            - open
            - planned
            - in_progress
            - done
            - invoiced
            - cancelled
        contact_id:
          type: integer
          nullable: true
        cost_center_id:
          type: integer
          nullable: true
        project_id:
          type: integer
          nullable: true
        service_contract_id:
          type: integer
          nullable: true
        account_user_id:
          type: integer
          nullable: true
        assignee_account_user_id:
          type: integer
          nullable: true
        reference:
          type: string
          nullable: true
        service_location:
          type: string
          nullable: true
        name_line_1:
          type: string
          nullable: true
        name_line_2:
          type: string
          nullable: true
        name_line_3:
          type: string
          nullable: true
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        buyer_email:
          type: string
          nullable: true
        buyer_reference:
          type: string
          nullable: true
        currency_code:
          type: string
        vat_rule_code:
          type: string
        positions_price_input_mode:
          $ref: "#/components/schemas/Quote/properties/positions_price_input_mode"
        positions:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentPosition"
        adjustments:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentAdjustment"
        taxes:
          type: array
          nullable: true
          items:
            $ref: "#/components/schemas/DocumentTax"
        sum_net:
          type: integer
          nullable: true
        sum_tax:
          type: integer
          nullable: true
        sum_gross:
          type: integer
          nullable: true
        amount_open:
          type: integer
          nullable: true
        cash_discount_days:
          type: integer
          nullable: true
        cash_discount_rate:
          type: number
          nullable: true
        payment_method_code:
          type: string
          nullable: true
        payment_terms:
          type: string
          nullable: true
        delivery_terms:
          type: string
          nullable: true
        subject:
          type: string
          nullable: true
        text_top:
          type: string
          nullable: true
        text_bottom:
          type: string
          nullable: true
        print_background_id:
          type: integer
          nullable: true
        print_layout_id:
          type: integer
          nullable: true
        print_options:
          $ref: "#/components/schemas/PrintOptions"
        service_date_from:
          $ref: "#/components/schemas/DateStringNullable"
        service_date_to:
          $ref: "#/components/schemas/DateStringNullable"
        service_object_ids:
          type: array
          nullable: true
          items:
            type: integer
    UpdateServiceProtocolRequest:
      type: object
      properties:
        number:
          type: integer
          nullable: true
        formatted_number:
          type: string
          nullable: true
        name:
          type: string
        description:
          type: string
          nullable: true
        date:
          $ref: "#/components/schemas/DateTime"
          nullable: true
        account_user_id:
          type: integer
          nullable: true
        service_order_id:
          type: integer
          nullable: true
        service_object_ids:
          $ref: "#/components/schemas/Quote/properties/service_object_ids"
    UpdateServiceProtocolTemplateRequest:
      type: object
      properties:
        name:
          type: string
        content:
          type: string
    UpdateTaskGroupRequest:
      type: object
      properties:
        name:
          type: string
          nullable: true
        ordering:
          type: integer
          nullable: true
    UpdateTaskRequest:
      type: object
      properties:
        name:
          type: string
          nullable: true
        description:
          type: string
          nullable: true
        account_user_id:
          type: integer
          nullable: true
        closed:
          type: boolean
          nullable: true
        due_at:
          allOf:
            - $ref: "#/components/schemas/DateTime"
          nullable: true
        priority_type:
          allOf:
            - $ref: "#/components/schemas/Task/properties/priority_type"
          nullable: true
      required:
        - name
    UpdateTextTemplateRequest:
      type: object
      properties:
        name:
          type: string
          nullable: true
        type:
          $ref: "#/components/schemas/TextTemplate/properties/type"
        document_type:
          $ref: "#/components/schemas/TextTemplate/properties/document_type"
        position:
          $ref: "#/components/schemas/TextTemplate/properties/position"
        is_default:
          type: boolean
          nullable: true
        visible_for_me:
          type: boolean
          nullable: true
        content:
          type: string
          nullable: true
    UpdateWarehouseRequest:
      type: object
      properties:
        location_id:
          type: integer
          nullable: true
        name:
          type: string
          maxLength: 255
          nullable: true
        code:
          type: string
          maxLength: 64
          nullable: true
        description:
          type: string
          nullable: true
        address_line_1:
          type: string
          maxLength: 255
          nullable: true
        address_line_2:
          type: string
          maxLength: 255
          nullable: true
        zip:
          type: string
          maxLength: 32
          nullable: true
        city:
          type: string
          maxLength: 255
          nullable: true
        state:
          type: string
          maxLength: 255
          nullable: true
        country_code:
          type: string
          maxLength: 3
          nullable: true
        phone:
          type: string
          maxLength: 24
          nullable: true
        email:
          type: string
          format: email
          maxLength: 255
          nullable: true
        internal_note:
          type: string
          nullable: true
        active:
          type: boolean
          nullable: true
    UpdatedAt:
      type: string
      format: date-time
      example: 2025-01-14T13:51:15.000Z
      description: Last update timestamp in ISO 8601 format.
    User:
      type: object
      properties:
        id:
          type: integer
        name:
          type: string
        email:
          type: string
        image_url:
          type: string
      required:
        - id
        - name
        - email
    UserInfo:
      type: object
      properties:
        name:
          type: string
        image_url:
          type: string
    VatId:
      type: string
      maxLength: 50
      description: VAT ID
      nullable: true
    Warehouse:
      type: object
      title: Warehouse
      properties:
        id:
          type: integer
        location_id:
          type: integer
          nullable: true
        location:
          type: object
          title: WarehouseLocationEmbed
          nullable: true
          properties:
            id:
              type: integer
            name:
              type: string
        name:
          type: string
        code:
          type: string
          nullable: true
        description:
          $ref: "#/components/schemas/MediumText"
        address_line_1:
          $ref: "#/components/schemas/AddressLine1"
        address_line_2:
          $ref: "#/components/schemas/AddressLine2"
        zip:
          $ref: "#/components/schemas/Zip"
        city:
          $ref: "#/components/schemas/City"
        state:
          $ref: "#/components/schemas/State"
        country_code:
          $ref: "#/components/schemas/CountryCode"
        phone:
          $ref: "#/components/schemas/Phone"
        email:
          $ref: "#/components/schemas/EmailAddress"
        internal_note:
          $ref: "#/components/schemas/MediumText"
        active:
          type: boolean
        updated_at:
          $ref: "#/components/schemas/UpdatedAt"
        created_at:
          $ref: "#/components/schemas/CreatedAt"
      required:
        - id
        - name
        - active
    WebLink:
      type: string
      minLength: 8
      maxLength: 255
      format: https://test.com
      nullable: true
    Websites:
      type: array
      items:
        type: object
        title: WebsiteListEntry
        properties:
          value:
            $ref: "#/components/schemas/WebLink"
          name:
            type: string
            nullable: true
      nullable: true
      minItems: 0
      maxItems: 10
    Zip:
      type: string
      description: ZIP or postal code.
      maxLength: 10
      nullable: true
  parameters:
    OrderDirParameter:
      in: query
      name: order_dir
      required: false
      description: The direction of ordering.
      schema:
        $ref: "#/components/schemas/OrderDir"
    PerPageParameter:
      in: query
      name: per_page
      required: false
      description: The number of items per page.
      schema:
        $ref: "#/components/schemas/PerPage"
    PageParameter:
      in: query
      name: page
      required: false
      description: The page number to retrieve.
      schema:
        $ref: "#/components/schemas/Page"
    ServiceObjectIdQueryParameter:
      name: service_object_id
      in: query
      required: false
      description: Filter records linked to this service object.
      schema:
        type: integer
    RecordLockedQueryParameter:
      name: record_locked
      in: query
      required: false
      description: Filter by GoBD lock (festgeschreibung) status. Omit to include all records.
      schema:
        type: boolean
        nullable: true
