openapi: 3.1.0
info:
  title: AbaNinja Accounting API - Preset
  version: 3.0.0
  x-domain-id: accounting
servers:
  - url: https://api.abaninja.ch
    description: The AbaNinja API server
tags:
  - name: accounting-preset
    description: Manage presets of accounting accounts
    x-displayName: Accounting Preset
security:
  - ApiToken: []
paths:
  /accounts/{accountUuid}/accounting/v2/journal-years/{journalYearUuid}/preset:
    get:
      tags:
        - accounting-preset
      summary: Get all presets of Accounting Accounts
      description: Get all presets of Accounting Accounts
      operationId: accounting_list_preset
      parameters:
        - name: accountUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: journalYearUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                properties:
                  data:
                    type: array
                    items:
                      title: Preset of Accounting Accounts
                      properties:
                        accAccountUuid:
                          type: string
                          format: uuid
                        accountNumber:
                          type: string
                        description:
                          type: string
                        currencyCode:
                          type: string
                          format: iso-4217
                          maxLength: 3
                          minLength: 3
                        classificationArea:
                          type: string
                          enum:
                            - A
                            - B
                        value:
                          type: number
                          format: float
                        exchangeValue:
                          type: number
                          format: float
                        exchangeRate:
                          type: number
                          format: float
                        preYearEndingBalance:
                          type: number
                          format: float
                        exchangePreYearEndingBalance:
                          type: number
                          format: float
                        preYearEndingBalanceFormatted:
                          type: string
                        exchangePreYearEndingBalanceFormatted:
                          type: string
                      type: object
                  message:
                    title: message
                    type: string
                  status:
                    example: 200
                  meta:
                    title: meta
                    type:
                      - object
                      - 'null'
                required:
                  - data
                  - message
                  - status
        '400':
          description: Bad request or validation error
          content:
            application/json:
              schema:
                properties:
                  detail:
                    title: details
                  type:
                    title: type
                    type: string
                  requestUuid:
                    title: requestUuid
                    type: string
                    format: uuid
                  path:
                    title: path
                    type: string
                  message:
                    title: message
                    type:
                      - string
                      - 'null'
                  status:
                    title: status
                    description: HTTP status code
                    type: integer
                required:
                  - detail
                  - type
                  - message
                  - status
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                properties:
                  detail:
                    title: details
                  type:
                    title: type
                    type: string
                  requestUuid:
                    title: requestUuid
                    type: string
                    format: uuid
                  path:
                    title: path
                    type: string
                  message:
                    title: message
                    type:
                      - string
                      - 'null'
                  status:
                    title: status
                    description: HTTP status code
                    type: integer
                required:
                  - detail
                  - type
                  - message
                  - status
      security:
        - ApiToken:
            - https://api.abaninja.ch/auth/accounting
      x-legacy-operation-id: 334865e7a5458c06c150446800f8a642
      x-required-scopes:
        - accounting
    post:
      tags:
        - accounting-preset
      summary: Set presets of Accounting Accounts
      description: Set presets of Accounting Accounts
      operationId: accounting_create_preset
      parameters:
        - name: accountUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: journalYearUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
      requestBody:
        description: Set presets of Accounting Accounts
        content:
          application/json:
            schema:
              $schema: https://json-schema.org/draft/2020-12/schema
              $id: https://api.abaninja.ch/schemas/2.0.0/preset-acc-accounts.schema.json
              description: A Schema for creating saldo opening for acc accounts
              type: object
              properties:
                accounts:
                  type: array
                  items:
                    type: object
                    properties:
                      accAccountUuid:
                        type: string
                        format: uuid
                      value:
                        type: number
                      exchangeValue:
                        type: number
                    required:
                      - accAccountUuid
                      - value
                      - exchangeValue
                    additionalProperties: false
                  minItems: 1
              required:
                - accounts
              additionalProperties: false
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                properties:
                  data: {}
                  message:
                    title: message
                    type: string
                  status:
                    example: 200
                  meta:
                    title: meta
                    type:
                      - object
                      - 'null'
                required:
                  - data
                  - message
                  - status
        '400':
          description: Bad request or validation error
          content:
            application/json:
              schema:
                properties:
                  detail:
                    title: details
                  type:
                    title: type
                    type: string
                  requestUuid:
                    title: requestUuid
                    type: string
                    format: uuid
                  path:
                    title: path
                    type: string
                  message:
                    title: message
                    type:
                      - string
                      - 'null'
                  status:
                    title: status
                    description: HTTP status code
                    type: integer
                required:
                  - detail
                  - type
                  - message
                  - status
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                properties:
                  detail:
                    title: details
                  type:
                    title: type
                    type: string
                  requestUuid:
                    title: requestUuid
                    type: string
                    format: uuid
                  path:
                    title: path
                    type: string
                  message:
                    title: message
                    type:
                      - string
                      - 'null'
                  status:
                    title: status
                    description: HTTP status code
                    type: integer
                required:
                  - detail
                  - type
                  - message
                  - status
      security:
        - ApiToken:
            - https://api.abaninja.ch/auth/accounting
      x-legacy-operation-id: a70b144adff8b2e15cff4c79da3f5475
      x-required-scopes:
        - accounting
  /accounts/{accountUuid}/accounting/v2/journal-years/{journalYearUuid}/preset-auto:
    post:
      tags:
        - accounting-preset
      summary: Auto presetting of Accounting Accounts
      description: Automatically sets pre year ending saldo as saldo opening
      operationId: accounting_create_preset_auto
      parameters:
        - name: accountUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
        - name: journalYearUuid
          in: path
          required: true
          schema:
            type: string
            format: uuid
      responses:
        '200':
          description: Successful response
          content:
            application/json:
              schema:
                properties:
                  data: {}
                  message:
                    title: message
                    type: string
                  status:
                    example: 200
                  meta:
                    title: meta
                    type:
                      - object
                      - 'null'
                required:
                  - data
                  - message
                  - status
        '400':
          description: Bad request or validation error
          content:
            application/json:
              schema:
                properties:
                  detail:
                    title: details
                  type:
                    title: type
                    type: string
                  requestUuid:
                    title: requestUuid
                    type: string
                    format: uuid
                  path:
                    title: path
                    type: string
                  message:
                    title: message
                    type:
                      - string
                      - 'null'
                  status:
                    title: status
                    description: HTTP status code
                    type: integer
                required:
                  - detail
                  - type
                  - message
                  - status
        '404':
          description: Resource not found
          content:
            application/json:
              schema:
                properties:
                  detail:
                    title: details
                  type:
                    title: type
                    type: string
                  requestUuid:
                    title: requestUuid
                    type: string
                    format: uuid
                  path:
                    title: path
                    type: string
                  message:
                    title: message
                    type:
                      - string
                      - 'null'
                  status:
                    title: status
                    description: HTTP status code
                    type: integer
                required:
                  - detail
                  - type
                  - message
                  - status
      security:
        - ApiToken:
            - https://api.abaninja.ch/auth/accounting
      x-legacy-operation-id: fd032d1712f956030cae89b630d1a588
      x-required-scopes:
        - accounting
components:
  securitySchemes:
    ApiToken:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: Bearer token authentication. Create tokens in Settings > API Token.
