openapi: 3.0.4
info:
  title: ErpHub API
  description: API for ErpHub
  contact:
    name: Aritma
    url: https://aritma.com/general-inquiry/
  version: '1'
servers:
  - url: https://erphub-api.aritma.io
    description: ErpHub API
  - url: https://erphub-api.dev.aritma.io
    description: ErpHub API (Dev)
paths:
  /api/v1/clients/{clientId}/accounts:
    get:
      tags:
        - Account
      summary: Get accounts for a client.
      operationId: GetAccounts
      parameters:
        - name: clientId
          in: path
          description: ''
          required: true
          schema:
            type: string
            format: uuid
        - name: includeDisabledAccounts
          in: query
          description: >-
            Indicate if the response should include accounts that is not active
            in the erp system.
          schema:
            type: boolean
            default: true
      responses:
        '200':
          description: Returns an array of account dto.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/AccountDto'
        '400':
          description: Bad request.
        '401':
          description: Unauthorized.
  /api/v1/clients/{clientId}/account/{accountId}/balance:
    get:
      tags:
        - Account
      summary: Get account balance
      operationId: GetAccountBalance
      parameters:
        - name: clientId
          in: path
          description: ''
          required: true
          schema:
            type: string
            format: uuid
        - name: accountId
          in: path
          description: ''
          required: true
          schema:
            type: string
        - name: financialPeriod
          in: query
          description: ''
          schema:
            type: string
        - name: isCurrencyAccount
          in: query
          description: ''
          schema:
            type: boolean
            default: false
      responses:
        '200':
          description: Returns an account balance dto.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AccountBalanceDto'
        '400':
          description: Bad request.
        '401':
          description: Unauthorized.
  /api/v1/clients/{clientId}/account/{accountId}/enable:
    post:
      tags:
        - Account
      summary: Enable an account for transactions sync
      operationId: EnableAccount
      parameters:
        - name: clientId
          in: path
          description: ''
          required: true
          schema:
            type: string
            format: uuid
        - name: accountId
          in: path
          description: ''
          required: true
          schema:
            type: string
        - name: transactionSyncStart
          in: query
          description: The date from which to start the transaction sync
          schema:
            type: string
      responses:
        '200':
          description: Account transaction sync enabled.
        '400':
          description: Bad request.
        '401':
          description: Unauthorized.
  /api/v1/clients/{clientId}/account/{accountId}/disable:
    post:
      tags:
        - Account
      summary: Disable an account for transactions sync
      operationId: DisableAccount
      parameters:
        - name: clientId
          in: path
          description: ''
          required: true
          schema:
            type: string
            format: uuid
        - name: accountId
          in: path
          description: ''
          required: true
          schema:
            type: string
      responses:
        '200':
          description: Account transaction sync disabled.
        '400':
          description: Bad request.
        '401':
          description: Unauthorized.
  /api/v1/clients/{clientId}/bookkeeping/matching-rules:
    post:
      tags:
        - Bookkeeping
      summary: >-
        Creates a new bookkeeping rule for the specified client. The rule
        defines how transactions

        are processed and mapped to generate vouchers based on the client's
        requirements.
      operationId: CreateBookkeepingMatchingRule
      parameters:
        - name: clientId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateBookkeepingMatchingRuleDto'
          text/json:
            schema:
              $ref: '#/components/schemas/CreateBookkeepingMatchingRuleDto'
          application/*+json:
            schema:
              $ref: '#/components/schemas/CreateBookkeepingMatchingRuleDto'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateBookkeepingRuleResponseDto'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /api/v1/clients/{clientId}/bookkeeping/matching-rules/{ruleId}:
    delete:
      tags:
        - Bookkeeping
      summary: |-
        Deletes a specific bookkeeping rule for the specified client. 
        The rule to delete is identified by its unique rule ID.
      operationId: DeleteBookkeepingMatchingRule
      parameters:
        - name: clientId
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: ruleId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '204':
          description: No Content
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
    get:
      tags:
        - Bookkeeping
      summary: >-
        Retrieves the details of a specific bookkeeping rule for the specified
        client. 

        This rule is identified by its unique rule ID.
      operationId: GetBookkeepingMatchingRule
      parameters:
        - name: clientId
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: ruleId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetBookkeepingTransactionRuleResponseDto'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
    put:
      tags:
        - Bookkeeping
      summary: >-
        Updates the details of an existing bookkeeping rule for the specified
        client. 

        The rule to update is identified by its unique rule ID.
      operationId: UpdateBookkeepingMatchingRule
      parameters:
        - name: clientId
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: ruleId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateBookkeepingMatchingRuleDto'
          text/json:
            schema:
              $ref: '#/components/schemas/UpdateBookkeepingMatchingRuleDto'
          application/*+json:
            schema:
              $ref: '#/components/schemas/UpdateBookkeepingMatchingRuleDto'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateBookkeepingRuleResponseDto'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /api/v1/clients/{clientId}/bookkeeping/matching-rules/{ruleId}/filters:
    put:
      tags:
        - Bookkeeping
      summary: >-
        Replaces the existing transaction filters of a specific bookkeeping rule
        for the given client. 

        The rule is identified by its unique rule ID. 

        All current filters will be removed and replaced with the filters
        provided in the request body.
      operationId: UpdateBookkeepingMatchingRuleFilters
      parameters:
        - name: clientId
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: ruleId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/MatchingFilterDto'
          text/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/MatchingFilterDto'
          application/*+json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/MatchingFilterDto'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateBookkeepingRuleResponseDto'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /api/v1/clients/{clientId}/bookkeeping/settings:
    post:
      tags:
        - Bookkeeping
      operationId: CreateBookkeepingSetting
      parameters:
        - name: clientId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpsertBookkeepingSettingDto'
          text/json:
            schema:
              $ref: '#/components/schemas/UpsertBookkeepingSettingDto'
          application/*+json:
            schema:
              $ref: '#/components/schemas/UpsertBookkeepingSettingDto'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BookkeepingSettingResponseDto'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
    get:
      tags:
        - Bookkeeping
      operationId: GetBookkeepingSettings
      parameters:
        - name: clientId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/BookkeepingSettingDto'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /api/v1/clients/{clientId}/bookkeeping/settings/{bookkeepingSettingId}:
    put:
      tags:
        - Bookkeeping
      operationId: UpdateBookkeepingSetting
      parameters:
        - name: clientId
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: bookkeepingSettingId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpsertBookkeepingSettingDto'
          text/json:
            schema:
              $ref: '#/components/schemas/UpsertBookkeepingSettingDto'
          application/*+json:
            schema:
              $ref: '#/components/schemas/UpsertBookkeepingSettingDto'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BookkeepingSettingResponseDto'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
    delete:
      tags:
        - Bookkeeping
      operationId: DeleteBookkeepingSetting
      parameters:
        - name: clientId
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: bookkeepingSettingId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BookkeepingSettingResponseDto'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
    get:
      tags:
        - Bookkeeping
      operationId: GetBookkeepingSetting
      parameters:
        - name: clientId
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: bookkeepingSettingId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/BookkeepingSettingDto'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /api/v1/clients/{clientId}/bookkeeping/transaction-rules:
    post:
      tags:
        - Bookkeeping
      summary: >-
        Creates a new bookkeeping rule for the specified client. The rule
        defines how transactions

        are processed and mapped to generate vouchers based on the client's
        requirements.
      operationId: CreateBookkeepingTransactionRule
      parameters:
        - name: clientId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateBookkeepingTransactionRuleDto'
          text/json:
            schema:
              $ref: '#/components/schemas/CreateBookkeepingTransactionRuleDto'
          application/*+json:
            schema:
              $ref: '#/components/schemas/CreateBookkeepingTransactionRuleDto'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/CreateBookkeepingRuleResponseDto'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
    get:
      tags:
        - Bookkeeping
      summary: >-
        Retrieves the list of bookkeeping rules for a specified client.

        This endpoint returns all bookkeeping rules associated with the provided
        client ID. 

        Each rule includes details such as the rule's ID, priority, and
        conditions.
      operationId: GetBookkeepingTransactionRules
      parameters:
        - name: clientId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: >-
                    #/components/schemas/GetBookkeepingTransactionRuleResponseDto
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /api/v1/clients/{clientId}/bookkeeping/transaction-rules/{ruleId}:
    get:
      tags:
        - Bookkeeping
      summary: >-
        Retrieves the details of a specific bookkeeping rule for the specified
        client. 

        This rule is identified by its unique rule ID.
      operationId: GetBookkeepingTransactionRule
      parameters:
        - name: clientId
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: ruleId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/GetBookkeepingTransactionRuleResponseDto'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
    put:
      tags:
        - Bookkeeping
      summary: >-
        Updates the details of an existing bookkeeping rule for the specified
        client. 

        The rule to update is identified by its unique rule ID.
      operationId: UpdateBookkeepingTransactionRule
      parameters:
        - name: clientId
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: ruleId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UpdateBookkeepingTransactionRuleDto'
          text/json:
            schema:
              $ref: '#/components/schemas/UpdateBookkeepingTransactionRuleDto'
          application/*+json:
            schema:
              $ref: '#/components/schemas/UpdateBookkeepingTransactionRuleDto'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateBookkeepingRuleResponseDto'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
    delete:
      tags:
        - Bookkeeping
      summary: |-
        Deletes a specific bookkeeping rule for the specified client. 
        The rule to delete is identified by its unique rule ID.
      operationId: DeleteBookkeepingTransactionRule
      parameters:
        - name: clientId
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: ruleId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '204':
          description: No Content
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /api/v1/clients/{clientId}/bookkeeping/transaction-rules/priorities:
    put:
      tags:
        - Bookkeeping
      summary: >-
        Updates the priority for all bookkeeping rules associated with the
        specified client.

        All rules must be included in the request, identified by their unique
        rule IDs.

        Missing or unknown rules will result in a validation error.
      operationId: UpdateBookkeepingRulesPriority
      parameters:
        - name: clientId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/UpdateBookkeepingRulesPriorityDto'
          text/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/UpdateBookkeepingRulesPriorityDto'
          application/*+json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/UpdateBookkeepingRulesPriorityDto'
      responses:
        '204':
          description: No Content
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /api/v1/clients/{clientId}/bookkeeping/transaction-rules/{ruleId}/filters:
    put:
      tags:
        - Bookkeeping
      summary: >-
        Replaces the existing transaction filters of a specific bookkeeping rule
        for the given client. 

        The rule is identified by its unique rule ID. 

        All current filters will be removed and replaced with the filters
        provided in the request body.
      operationId: UpdateBookkeepingTransactionRuleFilters
      parameters:
        - name: clientId
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: ruleId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/TransactionFilterDto'
          text/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/TransactionFilterDto'
          application/*+json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/TransactionFilterDto'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateBookkeepingRuleResponseDto'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /api/v1/clients/{clientId}/bookkeeping/transaction-rules/{ruleId}/units:
    put:
      tags:
        - Bookkeeping
      summary: >-
        Replaces the existing transaction units of a specific bookkeeping rule
        for the given client. 

        The rule is identified by its unique rule ID. 

        All current units will be removed and replaced with the units provided
        in the request body.
      operationId: UpdateBookkeepingTransactionRuleUnits
      parameters:
        - name: clientId
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: ruleId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/BookkeepingUnitDto'
          text/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/BookkeepingUnitDto'
          application/*+json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/BookkeepingUnitDto'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateBookkeepingRuleResponseDto'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /api/v1/clients/{clientId}/bookkeeping/transaction-rules/{ruleId}/field-mapping:
    put:
      tags:
        - Bookkeeping
      summary: >-
        Replaces the existing transaction units of a specific bookkeeping rule
        for the given client. 

        The rule is identified by its unique rule ID. 

        All current units will be removed and replaced with the units provided
        in the request body.
      operationId: UpdateBookkeepingTransactionRuleFieldMapping
      parameters:
        - name: clientId
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: ruleId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/FieldMappingDto'
          text/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/FieldMappingDto'
          application/*+json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/FieldMappingDto'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UpdateBookkeepingRuleResponseDto'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
        '404':
          description: Not Found
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /api/v1/clients/{clientId}/currencies:
    get:
      tags:
        - Clients
      summary: Retrieves the list of currencies for a specific client.
      operationId: GetCurrencies
      parameters:
        - name: clientId
          in: path
          description: The unique identifier of the client.
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Successful operation.
  /api/v1/clients/{clientId}/organization-units:
    get:
      tags:
        - Clients
      summary: Get a list of organization units for a client.
      operationId: GetOrganizationUnits
      parameters:
        - name: clientId
          in: path
          description: The id of the client.
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Returns an array of transaction dto.
        '400':
          description: Bad request.
        '401':
          description: Unauthorized.
  /api/v1/clients/{clientId}/voucher-series:
    get:
      tags:
        - Clients
      summary: Get a list of voucher-series for a client.
      operationId: GetVoucherSeries
      parameters:
        - name: clientId
          in: path
          description: The id of the client.
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Returns an array of transaction dto.
        '400':
          description: Bad request.
        '401':
          description: Unauthorized.
  /api/v1/clients/{clientId}/journal-transaction:
    post:
      tags:
        - Clients
      summary: Post a journal transaction to the ERP.
      operationId: PostJournalTransaction
      parameters:
        - name: clientId
          in: path
          description: The id of the client
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        description: ''
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PostJournalTransactionDto'
          text/json:
            schema:
              $ref: '#/components/schemas/PostJournalTransactionDto'
          application/*+json:
            schema:
              $ref: '#/components/schemas/PostJournalTransactionDto'
      responses:
        '200':
          description: OK
      deprecated: true
  /api/v1/clients/{clientId}/accounting-period/{date}:
    get:
      tags:
        - Clients
      summary: Gets the accounting period for a client on a given date.
      operationId: GetAccountingPeriodByDate
      parameters:
        - name: clientId
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: date
          in: path
          required: true
          schema:
            type: string
            format: date-time
      responses:
        '200':
          description: OK
  /api/v1/clients/{clientId}/accounting-period/{period}/details:
    get:
      tags:
        - Clients
      summary: Gets details about an accounting period for a client.
      operationId: GetAccountingPeriodDetails
      parameters:
        - name: clientId
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: period
          in: path
          required: true
          schema:
            type: string
      responses:
        '200':
          description: OK
  /api/v1/clients/{clientId}/accounting-period:
    get:
      tags:
        - Clients
      summary: Gets details about an accounting period for a client.
      operationId: GetAccountingPeriods
      parameters:
        - name: clientId
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: fromDate
          in: query
          schema:
            type: string
      responses:
        '200':
          description: OK
  /api/v1/connection:
    post:
      tags:
        - Connection
      summary: >-
        Initializes the process of creating a new connection to an external ERP
        system
      operationId: CreateErpConnection
      requestBody:
        description: Aritma.ERPHub.Api.Common.Models.Requests.CreateConnectionDto
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateConnectionDto'
          text/json:
            schema:
              $ref: '#/components/schemas/CreateConnectionDto'
          application/*+json:
            schema:
              $ref: '#/components/schemas/CreateConnectionDto'
      responses:
        '200':
          description: OK
  /api/v1/connection/{connectionId}:
    put:
      tags:
        - Connection
      summary: >-
        Resync connection. This will import new clients connected to the given
        connection.
      operationId: ResyncConnection
      parameters:
        - name: connectionId
          in: path
          description: The connectionId.
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        description: >-
          Optional resync request
          Aritma.ERPHub.Api.Common.Models.Requests.ResyncConnectionDto to
          support Aritma.ERPHub.Abstractions.Interfaces.IConnectionDetails in
          request
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ResyncConnectionDto'
          text/json:
            schema:
              $ref: '#/components/schemas/ResyncConnectionDto'
          application/*+json:
            schema:
              $ref: '#/components/schemas/ResyncConnectionDto'
      responses:
        '200':
          description: OK
  /api/v1/connection/{connectionId}/clients:
    get:
      tags:
        - Connection
      summary: Get clients for a connection
      operationId: GetClients
      parameters:
        - name: connectionId
          in: path
          description: The connectionId
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Returns an array of client dto.
        '400':
          description: Bad request.
        '401':
          description: Unauthorized.
  /api/v1/integrations/connections:
    post:
      tags:
        - Integrations
      summary: Create a connection for an API integrator
      operationId: CreateApiIntegrationConnection
      requestBody:
        description: The connection request
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateApiIntegrationConnectionDto'
          text/json:
            schema:
              $ref: '#/components/schemas/CreateApiIntegrationConnectionDto'
          application/*+json:
            schema:
              $ref: '#/components/schemas/CreateApiIntegrationConnectionDto'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiIntegrationConnectionDto'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /api/v1/integrations/connections/{connectionId}/clients:
    post:
      tags:
        - Integrations
      summary: Add a single client to an ERPHubConnection
      operationId: AddClient
      parameters:
        - name: connectionId
          in: path
          description: The connection id
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        description: The client to add
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/AddClientDto'
          text/json:
            schema:
              $ref: '#/components/schemas/AddClientDto'
          application/*+json:
            schema:
              $ref: '#/components/schemas/AddClientDto'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddClientResponseDto'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddClientResponseDto'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /api/v1/integrations/clients/{clientId}/accounts:
    post:
      tags:
        - Integrations
      summary: Add accounts to a client
      operationId: AddAccounts
      parameters:
        - name: clientId
          in: path
          description: The id of the client
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        description: The list of clients to add
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/AddAccountDto'
          text/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/AddAccountDto'
          application/*+json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/AddAccountDto'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddAccountResponseDto'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddAccountResponseDto'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /api/v1/integrations/clients/{clientId}/transactions:
    post:
      tags:
        - Integrations
      summary: Add transactions to an account
      operationId: AddTransactions
      parameters:
        - name: clientId
          in: path
          description: The id of the client
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        description: The list of transactions to add
        content:
          application/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/AddTransactionDto'
          text/json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/AddTransactionDto'
          application/*+json:
            schema:
              type: array
              items:
                $ref: '#/components/schemas/AddTransactionDto'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddTransactionsResponseDto'
        '400':
          description: Bad Request
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/AddTransactionsResponseDto'
        '403':
          description: Forbidden
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ProblemDetails'
  /api/v1/clients/{clientId}/mandates:
    post:
      tags:
        - Mandates
      operationId: ActivateMandateSync
      parameters:
        - name: clientId
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ActivateMandateSyncDto'
          text/json:
            schema:
              $ref: '#/components/schemas/ActivateMandateSyncDto'
          application/*+json:
            schema:
              $ref: '#/components/schemas/ActivateMandateSyncDto'
      responses:
        '200':
          description: OK
  /api/v1/clients/{clientId}/mandates/resync:
    post:
      tags:
        - Mandates
      operationId: ResyncMandates
      parameters:
        - name: clientId
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: fromDate
          in: query
          schema:
            type: string
      responses:
        '200':
          description: OK
  /api/v1/clients/{clientId}/pay:
    post:
      tags:
        - Pay
      summary: Activate pay for the given client.
      operationId: ActivatePay
      parameters:
        - name: clientId
          in: path
          description: The erp client id
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        description: ''
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/PayRequest'
          text/json:
            schema:
              $ref: '#/components/schemas/PayRequest'
          application/*+json:
            schema:
              $ref: '#/components/schemas/PayRequest'
      responses:
        '200':
          description: Account transaction sync enabled.
        '400':
          description: Bad request.
        '401':
          description: Unauthorized.
  /api/v1/clients/{clientId}/account/{accountId}/transactions:
    get:
      tags:
        - Transaction
      summary: Gets a list of transactions for an account
      operationId: GetTransactions
      parameters:
        - name: accountId
          in: path
          description: Unique identifier of the account.
          required: true
          schema:
            type: string
        - name: transactionId
          in: query
          description: int64 id of the last transaction fetched, leave empty on first fetch
          schema:
            type: integer
            format: int64
        - name: clientId
          in: path
          description: The id of the client that the account is linked to.
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Returns an array of transaction dto.
        '400':
          description: Bad request.
        '401':
          description: Unauthorized.
      deprecated: true
  /api/v1/clients/{clientId}/voucher/attachments:
    post:
      tags:
        - Voucher
      summary: >-
        Uploads voucher attachment files to blob storage before posting a
        voucher.
      operationId: UploadVoucherAttachments
      parameters:
        - name: clientId
          in: path
          description: The unique identifier of the client.
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        content:
          multipart/form-data:
            schema:
              type: object
              properties:
                files:
                  type: array
                  items:
                    oneOf:
                      - type: string
                        format: binary
                  description: The attachment files to upload (max 15MB per file).
            encoding:
              files:
                style: form
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UploadVoucherAttachmentsResponse'
  /api/v1/clients/{clientId}/voucher:
    post:
      tags:
        - Voucher
      summary: Posts a new voucher for a specified client.
      operationId: PostVoucher
      parameters:
        - name: clientId
          in: path
          description: >-
            The unique identifier of the client to which the voucher will be
            posted.
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        description: >-
          The details of the voucher to be created, including its lines and
          associated data.
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/VoucherRequest'
          text/json:
            schema:
              $ref: '#/components/schemas/VoucherRequest'
          application/*+json:
            schema:
              $ref: '#/components/schemas/VoucherRequest'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/VoucherResponse'
components:
  schemas:
    AccountBalanceDto:
      required:
        - accountNumber
      type: object
      properties:
        accountNumber:
          type: string
          description: Account number
        balanceOut:
          type: number
          description: Balance out
          format: double
        balanceIn:
          type: number
          description: Balance in
          format: double
        startDate:
          type: string
          description: Start date
          format: date-time
        endDate:
          type: string
          description: End date
          format: date-time
        message:
          type: string
          description: Message received from the Erp integration
      additionalProperties: false
      description: Account balance DTO
    AccountDto:
      required:
        - accountId
        - accountNumber
        - clientId
      type: object
      properties:
        accountId:
          type: string
          description: Account ID
        accountNumber:
          type: string
          description: Account number
        currency:
          type: string
          description: Currency
          nullable: true
        clientId:
          type: string
          description: Client ID
        description:
          type: string
          description: Description
          nullable: true
        bankAccountNumber:
          type: string
          description: Bank account number
          nullable: true
        isSyncTransactionEnabled:
          type: boolean
          description: Is enabled for transaction sync
        isActiveInErp:
          type: boolean
          description: Indicates if the account is active in the ERP system
      additionalProperties: false
      description: Account DTO
    ActivateMandateSyncDto:
      type: object
      properties:
        erpMandateDetails:
          oneOf:
            - $ref: '#/components/schemas/VismaBusinessNXTMandateErpDetails'
      additionalProperties: false
    AddAccountDto:
      required:
        - accountNumber
        - currency
        - description
      type: object
      properties:
        accountNumber:
          type: string
          description: The account number, must be unique for the client.
        currency:
          type: string
          description: The currency of the account. 3-letter ISO currency code.
        description:
          type: string
          description: Description of the account.
        bankAccountNumber:
          type: string
          description: Optional bank account number associated with the account.
      additionalProperties: false
    AddAccountResponseDto:
      required:
        - success
      type: object
      properties:
        success:
          type: boolean
          description: Indicates whether the request was successful
        error:
          type: string
          description: Error message, if the request was not successful
          nullable: true
        accounts:
          type: array
          items:
            $ref: '#/components/schemas/AccountDto'
          description: List of the added accounts
          nullable: true
      additionalProperties: false
    AddClientDto:
      required:
        - name
        - organizationNumber
      type: object
      properties:
        name:
          type: string
          description: The name of the client to add, must be unique for the connection.
        organizationNumber:
          type: string
          description: >-
            The organization number of the client to add, must be unique for the
            connection.
        currency:
          type: string
          description: >-
            The currency of the client to add, must be a valid ISO 4217 currency
            code.

            Will be made required in future versions.
          nullable: true
      additionalProperties: false
    AddClientResponseDto:
      required:
        - success
      type: object
      properties:
        success:
          type: boolean
          description: Indicates whether the request was successful
        error:
          type: string
          description: Error message, if the request was not successful
          nullable: true
        client:
          $ref: '#/components/schemas/ClientDto'
      additionalProperties: false
    AddTransactionDto:
      required:
        - accountNumber
        - currency
        - sourceReferenceId
      type: object
      properties:
        accountNumber:
          type: string
          description: The account number to add this transaction to.
        currency:
          type: string
          description: The currency of the transaction.
        sourceReferenceId:
          type: string
          description: Unique reference for the transaction.
        batchNumber:
          type: string
          description: Batch number of the transaction.
          nullable: true
        voucherNumber:
          type: string
          description: Voucher number of the transaction.
          nullable: true
        voucherLine:
          type: integer
          description: Voucher line of the transaction.
          format: int32
        description:
          type: string
          description: Description of the transaction.
          nullable: true
        invoiceNumber:
          type: string
          description: Invoice number of the transaction.
          nullable: true
        comment:
          type: string
          description: Comment of the transaction.
          nullable: true
        voucherDate:
          type: string
          description: The date of the transaction.
          format: date-time
        valueDate:
          type: string
          description: The value date of the transaction.
          format: date-time
        period:
          type: string
          description: The period the transaction belongs to.
        debitAmount:
          type: number
          description: The debit amount of the transaction.
          format: double
        debitAmountInCurrency:
          type: number
          description: The debit amount of the transaction in the currency.
          format: double
        creditAmount:
          type: number
          description: The credit amount of the transaction.
          format: double
        creditAmountInCurrency:
          type: number
          description: The credit amount of the transaction in the currency.
          format: double
        rate:
          type: number
          description: The exchange rate of the currency on this transaction.
          format: double
        year:
          type: integer
          description: The year of the transaction. mostly same as period.
          format: int32
      additionalProperties: false
    AddTransactionErrorDto:
      required:
        - errorMessage
      type: object
      properties:
        errorMessage:
          type: string
          description: Error message that describes the issue
        accountNumber:
          type: string
          description: The account number where the transactions were intended to be added
          nullable: true
        sourceReferences:
          type: array
          items:
            type: string
          description: The unique identifiers associated with the transactions
          nullable: true
      additionalProperties: false
    AddTransactionsResponseDto:
      required:
        - success
      type: object
      properties:
        success:
          type: boolean
          description: Indicates whether the request was successful
        errors:
          type: array
          items:
            $ref: '#/components/schemas/AddTransactionErrorDto'
          description: A list of error messages, if the request was not successful
          nullable: true
        batchId:
          type: string
          description: The unique batch id of the added transactions
          format: uuid
          nullable: true
      additionalProperties: false
    ApiIntegrationClient:
      required:
        - name
        - organizationNumber
      type: object
      properties:
        name:
          type: string
        organizationNumber:
          type: string
      additionalProperties: false
    ApiIntegrationConnectionDetails:
      type: object
      properties:
        clients:
          type: array
          items:
            $ref: '#/components/schemas/ApiIntegrationClient'
        connectionSystem:
          $ref: '#/components/schemas/ConnectedSystemType'
      additionalProperties: false
    ApiIntegrationConnectionDto:
      required:
        - email
        - id
      type: object
      properties:
        id:
          type: string
          description: The unique identifier of the connection
          format: uuid
        email:
          type: string
          description: The email address that is associated with the connection
      additionalProperties: false
    BookkeepingFilterDto:
      type: object
      properties:
        field:
          $ref: '#/components/schemas/BookkeepingFilterField'
        operation:
          $ref: '#/components/schemas/FilterMatchType'
        value:
          type: string
      additionalProperties: false
    BookkeepingFilterField:
      enum:
        - Amount
        - Currency
        - ReferenceNumber
        - ArchiveReference
        - Description
        - InvoiceNumber
        - StructuredReference
        - AdditionalText
        - DebtorAddress
        - BookedAmount
        - AccountCurrency
        - ChargeCurrency
        - ChargeAmount
        - BankTransactionCode
        - AccountNumber
        - DebtorAccountNumber
        - DebtorName
        - BankInformation
      type: string
    BookkeepingSettingDto:
      required:
        - bankAccountNumber
        - currency
      type: object
      properties:
        links:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Link'
          readOnly: true
        clientId:
          type: string
          format: uuid
        settingId:
          type: string
          format: uuid
        bankAccountNumber:
          type: string
        currency:
          type: string
        ledgerAccount:
          type: string
          nullable: true
        offsetAccount:
          type: string
          nullable: true
        feeAccount:
          type: string
          nullable: true
        remittanceFeeAccount:
          type: string
          nullable: true
        fallbackLedgerAccount:
          type: string
          nullable: true
        fallbackOffsetAccount:
          type: string
          nullable: true
        voucherSeries:
          type: string
          nullable: true
        currencyNo:
          type: string
          nullable: true
        currencyNo2:
          type: string
          nullable: true
        voucherType:
          type: string
          nullable: true
        agioVoucherType:
          type: string
          nullable: true
        agioVoucherTypeForCurrency2:
          type: string
          nullable: true
        isDefault:
          type: boolean
      additionalProperties: false
    BookkeepingSettingResponseDto:
      type: object
      properties:
        links:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Link'
          readOnly: true
        clientId:
          type: string
          format: uuid
        settingId:
          type: string
          format: uuid
      additionalProperties: false
    BookkeepingUnitDto:
      required:
        - unitOptionValueId
        - unitValueId
      type: object
      properties:
        unitOptionValueId:
          type: string
          description: Gets or sets the option value associated with the unit.
        unitValueId:
          type: string
          description: Gets or sets the unit value associated with the unit.
      additionalProperties: false
      description: >-
        Represents the object for defining a bookkeeping unit.

        This DTO specifies the unit and its selected option to be associated
        with a bookkeeping action.
    ClientDto:
      required:
        - clientId
        - currency
        - name
      type: object
      properties:
        clientId:
          type: string
          description: The client ID.
        name:
          type: string
          description: The name of the client.
        erpSystemType:
          $ref: '#/components/schemas/ErpSystemType'
        externalCompanyId:
          type: string
          description: The external company ID.
          nullable: true
        organizationNumber:
          type: string
          description: The organization number.
          nullable: true
        accountingPeriodDeviation:
          type: integer
          description: The accounting period deviation.
          format: int32
          nullable: true
        currency:
          type: string
          description: Currency code of the client in ISO 4217. E.g. "USD", "EUR", "SEK".
      additionalProperties: false
      description: Represents a client.
    ConnectedSystemType:
      enum:
        - None
        - Commerce
        - Control
        - Api
        - Pay
        - Aritma
      type: string
    CreateApiIntegrationConnectionDto:
      required:
        - name
        - parentResourceUri
      type: object
      properties:
        name:
          type: string
          description: The name of the new connection.
        parentResourceUri:
          type: string
          description: The parent resource URI of the connection.
        clients:
          type: array
          items:
            $ref: '#/components/schemas/AddClientDto'
          description: The initial clients to add to the connection.
        email:
          type: string
          description: Email address to associate with the connection.
          nullable: true
      additionalProperties: false
      description: The request object used to create a new api integration connection.
    CreateBookkeepingMatchingRuleDto:
      type: object
      properties:
        displayName:
          type: string
          description: Sets the display name for the bookkeeping rule.
        autoUpdate:
          type: boolean
          description: Sets if the voucher is automatically updated in the erp-system.
        applyTransactionFilterAfterMatching:
          type: boolean
          description: >-
            Indicates whether transaction filters should be applied after
            matching, 

            specifically to transactions not matched during the initial matching
            process.
        filters:
          type: array
          items:
            $ref: '#/components/schemas/MatchingFilterDto'
          description: >-
            Gets or sets the collection of filters applied to the bookkeeping
            rule.

            These filters are used to determine the matching criteria when
            finding open posts.
      additionalProperties: false
      description: Represents the object used to create a bookkeeping rule.
    CreateBookkeepingRuleResponseDto:
      type: object
      properties:
        links:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Link'
          readOnly: true
        clientId:
          type: string
          format: uuid
        ruleId:
          type: string
          format: uuid
      additionalProperties: false
    CreateBookkeepingTransactionRuleDto:
      type: object
      properties:
        displayName:
          type: string
          description: Sets the display name for the bookkeeping rule.
        bookkeepingSettingId:
          type: string
          description: |-
            Specifies the ID of the settings to link to. 
            If no settings exist, create them before proceeding.
          format: uuid
        autoUpdate:
          type: boolean
          description: Sets if the voucher is automatically updated in the erp-system.
        isFeeRule:
          type: boolean
          description: True if the rule is a fee rule, false otherwise.
        minOptionalMatches:
          type: integer
          description: >-
            Gets or sets the minimum number of filters that must match for the
            bookkeeping rule to apply.

            This property works in combination with the 'at least
            FilterCriteria' logic to determine applicability.
          format: int32
        transactionPostingMode:
          $ref: '#/components/schemas/TransactionPostingMode'
        filters:
          type: array
          items:
            $ref: '#/components/schemas/TransactionFilterDto'
          description: >-
            Gets or sets the collection of filters applied to the bookkeeping
            rule.

            These filters are used to determine the conditions under which the
            rule is applied.
        fieldMappings:
          type: array
          items:
            $ref: '#/components/schemas/FieldMappingDto'
          description: >-
            Defines a set of dynamic mappings that extract values from
            transaction fields 

            and apply them to batch line fields.
        units:
          type: array
          items:
            $ref: '#/components/schemas/BookkeepingUnitDto'
          description: >-
            Gets or sets the collection of units associated with the bookkeeping
            rule.
      additionalProperties: false
      description: Represents the object used to create a bookkeeping rule.
    CreateConnectionDto:
      required:
        - email
        - erpSystemType
        - name
        - parentResourceUri
        - redirectUrl
      type: object
      properties:
        name:
          type: string
        parentResourceUri:
          type: string
        connectionDetails:
          oneOf:
            - $ref: '#/components/schemas/ApiIntegrationConnectionDetails'
            - $ref: '#/components/schemas/VismaBusinessNXTConnectionDetails'
            - $ref: '#/components/schemas/VismaNetConnectionDetails'
          nullable: true
        erpSystemType:
          $ref: '#/components/schemas/ErpSystemType'
        email:
          type: string
        redirectUrl:
          type: string
      additionalProperties: false
    DynamicMandateErpDetails:
      type: object
      additionalProperties: {}
    ErpSystemType:
      enum:
        - Unknown
        - VismaBusinessNXT
        - VismaNet
        - ApiIntegration
      type: string
    FieldMappingDto:
      type: object
      properties:
        targetField:
          $ref: '#/components/schemas/FieldMappingType'
        value:
          type: string
      additionalProperties: false
    FieldMappingType:
      enum:
        - InvoiceNumber
        - Description
      type: string
    FilterImportanceType:
      enum:
        - Required
        - Optional
      type: string
    FilterMatchType:
      enum:
        - ExactText
        - ContainsText
        - StartsWithText
        - EndsWithText
        - ExactAmount
        - FromZeroToAmount
        - BelowAmount
        - AboveAmount
      type: string
    GetBookkeepingTransactionRuleResponseDto:
      type: object
      properties:
        links:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Link'
          readOnly: true
        clientId:
          type: string
          format: uuid
        ruleId:
          type: string
          format: uuid
        priority:
          type: integer
          format: int32
        minMatchingFilters:
          type: integer
          format: int32
        transactionPostingMode:
          $ref: '#/components/schemas/TransactionPostingMode'
        createdAt:
          type: string
          format: date-time
        lastUpdatedAt:
          type: string
          format: date-time
          nullable: true
        filters:
          type: array
          items:
            $ref: '#/components/schemas/BookkeepingFilterDto'
      additionalProperties: false
    JournalTransactionLineDto:
      required:
        - accountNumber
        - amount
        - bookingDate
        - id
        - referenceNumber
      type: object
      properties:
        id:
          type: string
          description: The line Id.
        accountNumber:
          type: string
          description: The Account number (e.g., 1910).
        referenceNumber:
          type: string
          description: External line reference.
        amount:
          type: number
          description: The amount of the transaction.
          format: double
        bookingDate:
          type: string
          description: The booking date of the transaction.
          format: date-time
        valueDate:
          type: string
          description: The value date of the transaction.
          format: date-time
          nullable: true
        description:
          type: string
          description: The description of the transaction.
          nullable: true
        units:
          type: array
          items:
            $ref: '#/components/schemas/UnitRequest'
          description: The units of the transaction.
          nullable: true
      additionalProperties: false
      description: Dto for a journal transaction line.
    Link:
      type: object
      properties:
        href:
          type: string
        verb:
          type: string
      additionalProperties: false
    MatchingFilterDto:
      type: object
      properties:
        field:
          $ref: '#/components/schemas/BookkeepingFilterField'
        operation:
          $ref: '#/components/schemas/FilterMatchType'
      additionalProperties: false
      description: >-
        Represents the  object for creating a bookkeeping matching filter.

        This DTO is used to define a filtering condition for matching open post
        purposes.
    OriginType:
      enum:
        - Manually
        - Ocr
        - DirectPayment
        - ExternalApplication
      type: string
    PayRequest:
      required:
        - bankAccountIds
      type: object
      properties:
        bankAccountIds:
          type: array
          items:
            type: string
      additionalProperties: false
    PostJournalTransactionDto:
      required:
        - currency
        - voucherSeriesNumber
      type: object
      properties:
        currency:
          type: string
          description: The currency of the transaction.
        autoUpdate:
          type: boolean
          description: Indicate if the transaction should be auto updated.
        journalTransactionOptions:
          type: string
          description: Additional options and configurations for ERP transactions.
          nullable: true
        voucherSeriesNumber:
          type: string
          description: The voucher series number.
        valueDate:
          type: string
          description: >-
            The value date of the batch. If there is no value date on lines this
            will be used.
          format: date-time
          nullable: true
        journalTransactionLine:
          type: array
          items:
            $ref: '#/components/schemas/JournalTransactionLineDto'
          description: The journal transaction lines.
      additionalProperties: false
      description: Dto for posting a journal transaction.
    ProblemDetails:
      type: object
      properties:
        type:
          type: string
          nullable: true
        title:
          type: string
          nullable: true
        status:
          type: integer
          format: int32
          nullable: true
        detail:
          type: string
          nullable: true
        instance:
          type: string
          nullable: true
      additionalProperties: {}
    ResyncConnectionDto:
      required:
        - connectionDetails
        - erpSystemType
      type: object
      properties:
        erpSystemType:
          $ref: '#/components/schemas/ErpSystemType'
        connectionDetails:
          oneOf:
            - $ref: '#/components/schemas/ApiIntegrationConnectionDetails'
            - $ref: '#/components/schemas/VismaBusinessNXTConnectionDetails'
            - $ref: '#/components/schemas/VismaNetConnectionDetails'
      additionalProperties: false
    TransactionFilterDto:
      required:
        - value
      type: object
      properties:
        field:
          $ref: '#/components/schemas/BookkeepingFilterField'
        operation:
          $ref: '#/components/schemas/FilterMatchType'
        importance:
          $ref: '#/components/schemas/FilterImportanceType'
        value:
          type: string
          description: Gets or sets the value used in the filtering operation.
          example: |2-

                        For example, if the filter is "Field = AccountNumber, Operation = Equals, Value = '1234'," 
                        the filter will match all records where the AccountNumber is '1234'.
                        
      additionalProperties: false
      description: >-
        Represents the  object for creating a bookkeeping filter.

        This DTO is used to define a filtering condition for bookkeeping
        purposes.
    TransactionPostingMode:
      enum:
        - CombineIntoSingleVoucher
        - PostAsSeparateVouchers
        - MultiLinedVoucher
        - MultiLinedVoucherWithUnmatched
      type: string
    UnitRequest:
      required:
        - unitId
        - unitOptionValueId
      type: object
      properties:
        unitId:
          type: string
          description: The unit ERP field name.
        unitOptionValueId:
          type: string
          description: The option value.
      additionalProperties: false
      description: ''
    UpdateBookkeepingMatchingRuleDto:
      type: object
      properties:
        displayName:
          type: string
          description: Sets the display name for the bookkeeping rule.
        autoUpdate:
          type: boolean
          description: Sets if the voucher is automatically updated in the erp-system.
        applyTransactionFiltersAfterMatching:
          type: boolean
          description: >-
            True if transaction filters sjould be applied after matching, false
            otherwise.
      additionalProperties: false
    UpdateBookkeepingRuleResponseDto:
      type: object
      properties:
        links:
          type: object
          additionalProperties:
            $ref: '#/components/schemas/Link'
          readOnly: true
        clientId:
          type: string
          format: uuid
        ruleId:
          type: string
          format: uuid
      additionalProperties: false
    UpdateBookkeepingRulesPriorityDto:
      type: object
      properties:
        ruleId:
          type: string
          description: The unique identifier of the rule
          format: uuid
        priority:
          type: integer
          description: The priority you want to assign to this rule
          format: int32
      additionalProperties: false
    UpdateBookkeepingTransactionRuleDto:
      type: object
      properties:
        displayName:
          type: string
          description: Sets the display name for the bookkeeping rule.
        bookkeepingSettingId:
          type: string
          description: |-
            Specifies the ID of the settings to link to. 
            If no settings exist, create them before proceeding.
          format: uuid
        autoUpdate:
          type: boolean
          description: Sets if the voucher is automatically updated in the erp-system.
        isFeeRule:
          type: boolean
          description: True if the rule is a fee rule, false otherwise.
        minOptionalMatches:
          type: integer
          description: >-
            Gets or sets the minimum number of filters that must match for the
            bookkeeping rule to apply.

            This property works in combination with the 'at least
            FilterCriteria' logic to determine applicability.
          format: int32
        transactionPostingMode:
          $ref: '#/components/schemas/TransactionPostingMode'
      additionalProperties: false
    UploadVoucherAttachmentsResponse:
      type: object
      properties:
        attachmentReference:
          type: string
      additionalProperties: false
    UpsertBookkeepingSettingDto:
      required:
        - bankAccountNumber
        - currency
      type: object
      properties:
        bankAccountNumber:
          type: string
        currency:
          type: string
        ledgerAccount:
          type: string
          nullable: true
        offsetAccount:
          type: string
          nullable: true
        feeAccount:
          type: string
          nullable: true
        remittanceFeeAccount:
          type: string
          nullable: true
        fallbackLedgerAccount:
          type: string
          nullable: true
        fallbackOffsetAccount:
          type: string
          nullable: true
        voucherSeries:
          type: string
          nullable: true
        currencyNo:
          type: string
          nullable: true
        currencyNo2:
          type: string
          nullable: true
        voucherType:
          type: string
          nullable: true
        agioVoucherType:
          type: string
          nullable: true
        agioVoucherTypeForCurrency2:
          type: string
          nullable: true
        isDefault:
          type: boolean
      additionalProperties: false
    VismaBusinessNXTConnectionDetails:
      type: object
      properties:
        connectionSystem:
          $ref: '#/components/schemas/ConnectedSystemType'
      additionalProperties: false
    VismaBusinessNXTCustomerSeries:
      required:
        - from
        - to
      type: object
      properties:
        from:
          type: integer
          format: int32
        to:
          type: integer
          format: int32
      additionalProperties: false
    VismaBusinessNXTMandateErpDetails:
      required:
        - customerSeries
      type: object
      properties:
        customerSeries:
          type: array
          items:
            $ref: '#/components/schemas/VismaBusinessNXTCustomerSeries'
      additionalProperties: false
    VismaNetConnectionDetails:
      type: object
      properties:
        tenantId:
          type: string
          deprecated: true
        tenantIds:
          type: array
          items:
            type: string
        connectionSystem:
          $ref: '#/components/schemas/ConnectedSystemType'
      additionalProperties: false
    VoucherLine:
      type: object
      properties:
        debitAccountNumber:
          type: integer
          format: int32
        creditAccountNumber:
          type: integer
          format: int32
        matchingReference:
          type: string
          nullable: true
        units:
          type: array
          items:
            $ref: '#/components/schemas/UnitRequest'
        description:
          type: string
          nullable: true
        bookingDate:
          type: string
          format: date-time
          nullable: true
        valueDate:
          type: string
          format: date-time
          nullable: true
        externalId:
          type: string
          nullable: true
        currency:
          type: string
          nullable: true
        currencyNo:
          type: integer
          format: int32
          nullable: true
        amountDomestic:
          type: number
          format: double
          nullable: true
        amountInCurrency:
          type: number
          format: double
          nullable: true
        amountInCurrency2:
          type: number
          format: double
          nullable: true
        exchangeRate:
          type: number
          format: double
          nullable: true
        externalReference2:
          type: string
          nullable: true
        exchangeRate2:
          type: number
          format: double
          nullable: true
        currencyNo2:
          type: integer
          format: int32
          nullable: true
        voucherType:
          type: string
          nullable: true
        additionalText:
          type: string
          nullable: true
        invoiceNumber:
          type: string
          nullable: true
        archiveReference:
          type: string
          nullable: true
        cid:
          type: string
          nullable: true
      additionalProperties: false
    VoucherRequest:
      required:
        - lines
      type: object
      properties:
        voucherSeriesNumber:
          type: string
        valueDate:
          type: string
          format: date-time
          nullable: true
        autoUpdate:
          type: boolean
        batchDescription:
          type: string
          nullable: true
        lines:
          type: array
          items:
            $ref: '#/components/schemas/VoucherLine'
        origin:
          $ref: '#/components/schemas/OriginType'
        attachmentReference:
          type: string
          nullable: true
      additionalProperties: false
    VoucherResponse:
      type: object
      properties:
        errorMessage:
          type: string
        voucherNumber:
          type: string
        batchId:
          type: string
      additionalProperties: false
  securitySchemes:
    client_credentials:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://id.aritma.no/connect/token
          scopes:
            api services.erphub: Access to ErpHub Api
    implicit:
      type: oauth2
      flows:
        implicit:
          authorizationUrl: https://id.aritma.no/connect/authorize
          scopes:
            api services.erphub: Access to ErpHub Api
    password:
      type: oauth2
      flows:
        password:
          tokenUrl: https://id.aritma.no/connect/token
          scopes:
            api services.erphub: Access to ErpHub Api
    client_credentials_dev:
      type: oauth2
      flows:
        clientCredentials:
          tokenUrl: https://id.dev.aritma.io/connect/token
          scopes:
            api services.erphub: Access to ErpHub Api
    implicit_dev:
      type: oauth2
      flows:
        implicit:
          authorizationUrl: https://id.dev.aritma.io/connect/authorize
          scopes:
            api services.erphub: Access to ErpHub Api
    password_dev:
      type: oauth2
      flows:
        password:
          tokenUrl: https://id.dev.aritma.io/connect/token
          scopes:
            api services.erphub: Access to ErpHub Api
security:
  - {}
  - {}
  - {}
  - {}
tags:
  - name: Account
    description: Handles account related operations.
  - name: Bookkeeping
    description: Handles the bookkeeping for the client
  - name: Clients
    description: Handles ERP client related operations
  - name: Connection
    description: Handles the connection between the ERPHub and the ERP
  - name: Integrations
  - name: Mandates
    description: Controller for managing mandates.
  - name: Pay
    description: Handles pay related operations.
  - name: Transaction
    description: Handles ERP transaction related operations
  - name: Voucher
    description: Controller responsible for handling voucher operations in the ERP Hub.
