openapi: 3.1.0
info:
  title: Omnizon Public REST API
  description: |-
    This is the Omnizon Platform Public REST API specification.
    For access and API Keys please contact your Omnizon Platform representative.
  version: v1.0.0
servers:
  - url: http://localhost:10081
    description: Local development environment
  - url: https://{tenant}.u-dev.omnizon.network/api
    description: U-DEV testing environment
    variables:
      tenant:
        enum:
          - hr
          - de
        default: hr
security:
  - PublicApiKey: []
paths:
  /rest/v1/organizations/register:
    post:
      summary: Register a company
      description: >-
        Accepts a JSON payload to register a company with required and optional
        company data.
      operationId: companyRegister
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrganizationRegisterRequest'
      responses:
        '201':
          description: Company registered successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrganizationRegisterResponse'
  /rest/v1/organizations/findByVatNumber:
    post:
      summary: Find organization by vat number
      description: Find organization by vat number.
      operationId: companyFindByVat
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrganizationFindByVatRequest'
      responses:
        '200':
          description: Company registered successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrganizationFindByVatResult'
  /rest/v1/organizations/amsCheck:
    post:
      summary: Check AMS registration status for organization
      description: >-
        Check if an organization is registered in AMS (Asset Management System)
        by VAT number.
      operationId: organizationAmsCheck
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OrganizationFindByVatRequest'
      responses:
        '200':
          description: AMS registration status check completed successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/OrganizationAmsCheckResult'
  /rest/v1/documents/send:
    post:
      summary: Send UBL 2.1 invoice
      description: Accepts a UBL 2.1 XML document as raw binary stream and processes it.
      operationId: documentSend
      parameters:
        - name: companyVatNumber
          in: header
          required: true
          description: VAT number of the company.
          schema:
            type: string
            example: HR12345678910
        - name: fiscalization
          in: header
          required: false
          description: Fiscalization flag.
          schema:
            type: boolean
        - name: x-fileName
          in: header
          required: false
          description: Optional file name override for uploaded XML document.
          schema:
            type: string
        - name: x-software-id
          in: header
          required: false
          description: External software identifier to track the originating system.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/octet-stream:
            schema:
              type: string
              format: binary
            examples:
              example1:
                summary: Sample UBL 2.1 XML file
                description: Example of raw UBL invoice content.
                value: >-
                  <Invoice
                  xmlns="urn:oasis:names:specification:ubl:schema:xsd:Invoice-2">...</Invoice>
      responses:
        '200':
          description: Document processed successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/SendInvoiceResponse'
        '401':
          description: Unauthorized access due to invalid or missing API key.
        '500':
          description: Internal server error during document processing.
  /rest/v1/documents/getInternalStatus:
    post:
      summary: Get Invoice Internal Status
      description: Get Invoice Internal Status.
      operationId: getInternalInvoiceStatus
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InvoiceStatusRequest'
      responses:
        '200':
          description: Invoice Internal Status Returned Successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceStatusResponse'
        '400':
          description: Invalid input or validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceStatusResponse'
        '401':
          description: Unauthorized access due to invalid or missing API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceStatusResponse'
        '500':
          description: Internal server error during registration process.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceStatusResponse'
  /rest/v1/documents/getExternalStatus:
    post:
      summary: Get External Invoice Status
      description: Get External Invoice Status.
      operationId: getExternalInvoiceStatus
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InvoiceStatusRequest'
      responses:
        '200':
          description: Get external invoice status.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceStatusResponse'
        '400':
          description: Invalid input or validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceStatusResponse'
        '401':
          description: Unauthorized access due to invalid or missing API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceStatusResponse'
        '500':
          description: Internal server error during registration process.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceStatusResponse'
  /rest/v1/documents/getByInternalStatus:
    post:
      summary: Get Invoices By Internal Status
      description: Get Invoice By Status.
      operationId: getByInternalStatus
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InvoiceListStatusRequest'
      responses:
        '200':
          description: Get invoices by status.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoicePayloadListResponse'
        '400':
          description: Invalid input or validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceErrorResponse'
        '401':
          description: Unauthorized access due to invalid or missing API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceErrorResponse'
        '500':
          description: Internal server error during registration process.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceErrorResponse'
  /rest/v1/documents/getByExternalStatus:
    post:
      summary: Get Invoices By External Status
      description: Get Invoice By External Status.
      operationId: getByExternalStatus
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InvoiceListStatusRequest'
      responses:
        '200':
          description: Get invoices by status.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoicePayloadListResponse'
        '400':
          description: Invalid input or validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceErrorResponse'
        '401':
          description: Unauthorized access due to invalid or missing API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceErrorResponse'
        '500':
          description: Internal server error during registration process.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceErrorResponse'
  /rest/v1/documents/get:
    post:
      summary: Get Document
      description: Get Document by documentId and return binary file.
      operationId: get
      parameters:
        - name: x-software-id
          in: header
          required: false
          description: >-
            External software identifier to track which ERP has fetched this
            document.
          schema:
            type: string
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DocumentGetRequest'
      responses:
        '200':
          description: Successfully retrieved invoice as binary file.
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
  /rest/v1/documents/ack:
    post:
      summary: Acknowledge Invoice
      description: Accepts a JSON payload to Set Invoice as Acknowledge.
      operationId: acknowledgeInvoice
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InvoiceSetStatusRequest'
      responses:
        '201':
          description: Document acknowledged successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceSetStatusResponse'
        '400':
          description: Invalid input or validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceSetStatusResponse'
        '401':
          description: Unauthorized access due to invalid or missing API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceSetStatusResponse'
        '500':
          description: Internal server error during registration process.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceSetStatusResponse'
  /rest/v1/documents/reject:
    post:
      summary: Reject Invoice
      description: Accepts a JSON payload to Set Invoice as Reject.
      operationId: rejectInvoice
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InvoiceRejectRequest'
      responses:
        '201':
          description: Document mark as rejected successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceSetStatusResponse'
        '400':
          description: Invalid input or validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceSetStatusResponse'
        '401':
          description: Unauthorized access due to invalid or missing API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceSetStatusResponse'
        '500':
          description: Internal server error during registration process.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceSetStatusResponse'
  /rest/v1/documents/paid:
    post:
      summary: Mark Invoice as Paid
      description: Accepts a JSON payload to Set Invoice as Paid.
      operationId: markPaidInvoice
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InvoicePaidRequest'
      responses:
        '201':
          description: Document mark as paid successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceSetStatusResponse'
        '400':
          description: Invalid input or validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceSetStatusResponse'
        '401':
          description: Unauthorized access due to invalid or missing API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceSetStatusResponse'
        '500':
          description: Internal server error during registration process.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceSetStatusResponse'
  /rest/v1/documents/cancel:
    post:
      summary: Cancel Invoice
      description: Accepts a JSON payload to Set Invoice as Cancel.
      operationId: cancelInvoice
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InvoiceSetStatusRequest'
      responses:
        '201':
          description: Document canceled successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceSetStatusResponse'
        '400':
          description: Invalid input or validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceSetStatusResponse'
        '401':
          description: Unauthorized access due to invalid or missing API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceSetStatusResponse'
        '500':
          description: Internal server error during registration process.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceSetStatusResponse'
  /rest/v1/users/new:
    post:
      summary: Create a new user
      description: >-
        Accepts a JSON payload to register a new user with required and optional
        user data.
      operationId: createUser
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserAccountRequest'
      responses:
        '201':
          description: User created successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserAccountResponse'
  /rest/v1/users/deactivate:
    post:
      summary: Deactivate a user account
      description: >-
        Accepts a JSON payload to deactivate a user account with required and
        optional user data.
      operationId: deactivateUser
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserActionsRequest'
      responses:
        '200':
          description: User deactivate successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserActionsResponse'
        '400':
          description: Invalid input or validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserActionsResponse'
        '401':
          description: Unauthorized access due to invalid or missing API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserActionsResponse'
        '500':
          description: Internal server error during registration process.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserActionsResponse'
  /rest/v1/users/reactivate:
    post:
      summary: Reactivate a user account
      description: >-
        Accepts a JSON payload to reactivate a user account with required and
        optional user data.
      operationId: reactivateUser
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/UserActionsRequest'
      responses:
        '200':
          description: User reactivate successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserActionsResponse'
        '400':
          description: Invalid input or validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserActionsResponse'
        '401':
          description: Unauthorized access due to invalid or missing API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserActionsResponse'
        '500':
          description: Internal server error during registration process.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UserActionsResponse'
  /rest/v1/documents/getFromArchive:
    post:
      summary: Get Document from Archive
      description: Get Document from Archive.
      operationId: getFromArchive
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/InvoiceStatusRequest'
      responses:
        '200':
          description: Successfully retrieved invoice as binary file.
          content:
            application/octet-stream:
              schema:
                type: string
                format: binary
  /rest/v1/documents/archive:
    post:
      summary: Archive Document
      description: Archive Document.
      operationId: archive
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DocumentArchiveRequest'
      responses:
        '200':
          description: Document archived successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ArchivedDocumentResponse'
        '400':
          description: Invalid input or validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceErrorResponse'
        '401':
          description: Unauthorized access due to invalid or missing API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceErrorResponse'
        '500':
          description: Internal server error during getting document from archive.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceErrorResponse'
  /rest/v1/documents/getByNumber:
    post:
      summary: Get Documents By Number
      description: Get Documents By Number.
      operationId: getByNumber
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DocumentNumberRequest'
      responses:
        '200':
          description: Get documents by number.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoicePayloadListResponse'
        '400':
          description: Invalid input or validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceErrorResponse'
        '401':
          description: Unauthorized access due to invalid or missing API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceErrorResponse'
        '500':
          description: Internal server error during registration process.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceErrorResponse'
  /rest/v1/documents/inbox:
    post:
      summary: Get Inbox Documents
      description: Get Inbox Documents.
      operationId: inbox
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OwnerRequest'
      responses:
        '200':
          description: Get inbox documents.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoicePayloadListResponse'
        '400':
          description: Invalid input or validation error.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceErrorResponse'
        '401':
          description: Unauthorized access due to invalid or missing API key.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceErrorResponse'
        '500':
          description: Internal server error during registration process.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/InvoiceErrorResponse'
  /rest/v1/documents/getStatus:
    post:
      summary: Get Document Statuses
      description: Get Document Statuses By VAT Number And DateFrom/To Range.
      operationId: getStatus
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DocumentGetRequest'
      responses:
        '200':
          description: Successfully retrieved document statuses.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentGetStatusResponse'
  /rest/v1/documents/outbox/status:
    post:
      summary: Get Outbox Document Statuses
      description: Get Outbox Document Statuses By VAT Number And DateFrom/To Range.
      operationId: getOutboxStatus
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DocumentGetStatusRequest'
      responses:
        '200':
          description: Successfully retrieved outbox document statuses.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentOutboxStatusListResponse'
  /rest/v1/documents/inbox/status:
    post:
      summary: Get Inbox Document Statuses
      description: Get Inbox Document Statuses By VAT Number And DateFrom/To Range.
      operationId: getInboxStatus
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/DocumentGetStatusRequest'
      responses:
        '200':
          description: Successfully retrieved outbox document statuses.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/DocumentInboxStatusListResponse'
  /rest/v1/billing/monthly-usage:
    post:
      summary: Get Monthly Usage Metrics
      description: >-
        Get usage metrics for documents sent, received and total for a specific
        month and year by VAT ID.
      operationId: getMonthlyUsage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/MonthlyUsageRequest'
      responses:
        '200':
          description: Successfully retrieved monthly usage metrics.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/UsageMetricsResponse'
  /rest/v1/billing/archive-usage:
    post:
      summary: Get Archive Usage Metrics
      description: Get total archive usage in bytes for a company by VAT ID.
      operationId: getArchiveUsage
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ArchiveUsageRequest'
      responses:
        '200':
          description: Successfully retrieved archive usage metrics.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ArchiveUsageResponse'
  /rest/v1/documents/getAllFiscalizationStatuses:
    post:
      summary: Get all fiscalization statuses for a document
      description: Returns all fiscalization statuses for the specified document ID.
      operationId: getAllFiscalizationStatuses
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetFiscalizationStatusesRequest'
      responses:
        '200':
          description: Fiscalization statuses retrieved successfully.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/FiscalizationResponse'
        '401':
          description: Unauthorized access due to invalid or missing API key.
        '404':
          description: Document not found or no fiscalization statuses available.
        '500':
          description: Internal server error during status retrieval.
  /rest/v1/documents/getLatestFiscalizationStatus:
    post:
      summary: Get latest fiscalization status for a document
      description: >-
        Returns the most recent fiscalization status for the specified document
        ID.
      operationId: getLatestFiscalizationStatus
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetFiscalizationStatusesRequest'
      responses:
        '200':
          description: Latest fiscalization status retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/FiscalizationResponse'
        '401':
          description: Unauthorized access due to invalid or missing API key.
        '404':
          description: Document not found or no fiscalization status available.
        '500':
          description: Internal server error during status retrieval.
  /rest/v1/documents/getAllReportingStatuses:
    post:
      summary: Get all reporting statuses for a document
      description: Returns all reporting statuses for the specified document ID.
      operationId: getAllReportingStatuses
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetReportingStatusesRequest'
      responses:
        '200':
          description: Reporting statuses retrieved successfully.
          content:
            application/json:
              schema:
                type: array
                items:
                  $ref: '#/components/schemas/ReportingResponse'
        '401':
          description: Unauthorized access due to invalid or missing API key.
        '404':
          description: Document not found or no reporting statuses available.
        '500':
          description: Internal server error during status retrieval.
  /rest/v1/documents/getLatestReportingStatus:
    post:
      summary: Get latest reporting status for a document
      description: Returns the most recent reporting status for the specified document ID.
      operationId: getLatestReportingStatus
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/GetReportingStatusesRequest'
      responses:
        '200':
          description: Latest reporting status retrieved successfully.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ReportingResponse'
        '401':
          description: Unauthorized access due to invalid or missing API key.
        '404':
          description: Document not found or no reporting status available.
        '500':
          description: Internal server error during status retrieval.
  /rest/v1/apikeys/generate:
    post:
      summary: Generate API key for organization
      description: >-
        Generate a new API key for the specified organization based on VAT
        number
      operationId: generateApiKey
      security:
        - PublicApiKey: []
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ApiKeyGenerateRequest'
      responses:
        '200':
          description: API key generated successfully
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ApiKeyGenerateResponse'
        '400':
          description: Invalid request - VAT number missing or invalid
        '401':
          description: Unauthorized - invalid or missing API key
        '403':
          description: >-
            Forbidden - API key not authorized to generate keys for this
            organization
        '404':
          description: Organization not found for the specified VAT number
        '500':
          description: Internal server error
components:
  schemas:
    OrganizationRegisterRequest:
      type: object
      properties:
        companyVatNumber:
          type: string
          description: The company's unique identifier (OIB, 11 digits).
          example: '12345678901'
        companyName:
          type: string
          description: The official name of the company.
          example: Example Ltd.
        companyAddressStreet:
          type: string
          description: Company street and street number.
          example: Main Street 123
        companyAddressCity:
          type: string
          description: Company city.
          example: Zagreb
        companyAddressPostalCode:
          type: string
          description: Company postal code.
          example: '10000'
        companyAddressState:
          type: string
          description: Company state.
          example: Grad Zagreb
        companyAddressCountry:
          type: string
          description: Company country.
          example: HR
        mpsRegister:
          type: boolean
          description: Indicates whether MPS register required.
          example: true
        email:
          type: string
          description: Contact email address (optional).
          example: info@example.com
        companyWebsite:
          type: string
          description: Website URL of the company (optional).
          example: https://www.example.com
        iban:
          type: string
          description: IBAN of the company (optional).
          example: HR1234567890123456789
        routingAddress:
          type: string
          description: Routing address for the company.
          example: '00000000000'
      required:
        - companyVatNumber
        - companyName
        - companyAddressStreet
        - companyAddressCity
        - companyAddressPostalCode
        - companyAddressState
        - companyAddressCountry
        - mpsRegister
        - routingAddress
    OrganizationRegisterResponse:
      type: object
      properties:
        organizationId:
          type: string
          description: Unique identifier for the organization.
          example: 6787a98e15306d37eed688a8
      required:
        - organizationId
    OrganizationFindByVatRequest:
      type: object
      properties:
        vatNumber:
          type: string
      required:
        - vatNumber
    OrganizationFindByVatResult:
      type: object
      properties:
        fullName:
          type: string
        vatNumber:
          type: string
        localBusinessId:
          type: string
        dunsNumber:
          type: string
        gln:
          type: string
        peppolId:
          type: string
        addressContact:
          type: string
        addressCity:
          type: string
        addressPostalCode:
          type: string
        addressState:
          type: string
        addressExtraLine1:
          type: string
        addressExtraLine2:
          type: string
        addressExtraLine3:
          type: string
        webAddress:
          type: string
    OrganizationAmsCheckResult:
      type: object
      properties:
        isAmsRegistered:
          type: boolean
          description: >-
            Indicates whether the organization is registered in AMS (Asset
            Management System)
      required:
        - isAmsRegistered
    SendInvoiceResponse:
      type: object
      properties:
        documentId:
          type: string
      required:
        - documentId
    InvoiceStatusRequest:
      type: object
      properties:
        documentId:
          type: string
          description: The unique identifier of the invoice document.
          example: 6787a98e15306d37eed688a8
      required:
        - documentId
    InvoiceStatusResponse:
      type: object
      properties:
        documentId:
          type: string
          description: The unique identifier of the invoice document.
          example: 6787a98e15306d37eed688a8
        status:
          type: string
          description: Status of document.
          example: acknowledged
      required:
        - documentId
        - status
    InvoiceListStatusRequest:
      type: object
      properties:
        status:
          type: string
          description: One of the possible statuses of the invoice document.
          example: rejected
        companyVatNumber:
          type: string
          description: The VAT number of the company.
          example: HR12345678910
        dateFrom:
          description: Date when an invoice was paid
          type: string
          format: date-time
        dateTo:
          description: Date when an invoice was paid
          type: string
          format: date-time
      required:
        - status
        - dateFrom
        - dateTo
        - companyVatNumber
    InvoiceDocumentIdReturnModel:
      type: object
      properties:
        documentId:
          type: string
          description: The unique identifier of the invoice document.
          example: 6787a98e15306d37eed688a8
      required:
        - documentId
    InvoicePayloadListResponse:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/InvoiceDocumentIdReturnModel'
          description: List of invoice payload return models.
      required:
        - items
    InvoiceErrorResponse:
      type: object
      properties:
        statusCode:
          type: integer
          description: Http status code of the response.
          example: 400
        resultMessage:
          type: string
          description: Result message.
          example: Error processing.
      required:
        - statusCode
        - resultMessage
    DocumentGetRequest:
      type: object
      properties:
        documentId:
          type: string
          description: The unique identifier of the invoice document.
          example: 6787a98e15306d37eed688a8
        companyVatNumber:
          type: string
          description: The VAT number of the company.
          example: HR12345678910
      required:
        - companyVatNumber
    InvoiceSetStatusRequest:
      type: object
      properties:
        documentId:
          type: string
          description: The unique identifier of the invoice document.
          example: 6787a98e15306d37eed688a8
        reason:
          type: string
          description: The reason for setting the invoice status.
          example: Payment received
      required:
        - documentId
    InvoiceSetStatusResponse:
      type: object
      properties:
        statusCode:
          type: integer
          description: Http status code of the response.
          example: 200
        resultMessage:
          type: string
          description: Result message.
          example: Company registered successfully.
      required:
        - statusCode
        - resultMessage
    InvoiceRejectRequest:
      type: object
      properties:
        documentId:
          type: string
          description: The unique identifier of the invoice document.
          example: 6787a98e15306d37eed688a8
        documentNumber:
          type: string
          description: The number of the document.
          example: '12322'
        issueDate:
          type: string
          description: The date when the invoice was issued.
          format: date-time
          example: '2023-10-01T12:00:00Z'
        senderVatNumber:
          type: string
          description: The VAT number of the sender.
          example: HR12345678910
        receiverVatNumber:
          type: string
          description: The VAT number of the receiver.
          example: HR09876543210
        rejectionDate:
          type: string
          description: The date when the invoice was rejected.
          format: date-time
          example: '2023-10-02T12:00:00Z'
        rejectionReason:
          type: string
          description: The reason for the rejection of the invoice.
          example: Invoice not valid
        rejectionReasonCode:
          type: string
          maxLength: 1
          minLength: 1
          description: The code indicating the reason for rejection Can be N, U or O.
          example: N|U|O
        rejectionReasonDescription:
          type: string
          maxLength: 1000
          description: The description of the reason for rejection.
          example: Invoice not valid
      required:
        - documentId
        - documentNumber
        - issueDate
        - senderVatNumber
        - receiverVatNumber
        - rejectionDate
        - rejectionReasonCode
    InvoicePaidRequest:
      type: object
      properties:
        documentId:
          type: string
          description: The unique identifier of the invoice document.
          example: 6787a98e15306d37eed688a8
        documentNumber:
          type: string
          description: The number of the document.
          example: '12322'
        issueDate:
          type: string
          description: The date when the invoice was issued.
          format: date-time
          example: '2023-10-01T12:00:00Z'
        senderVatNumber:
          type: string
          description: The VAT number of the sender.
          example: HR12345678910
        receiverVatNumber:
          type: string
          description: The VAT number of the receiver.
          example: HR09876543210
        paidDate:
          type: string
          description: The date when the invoice was paid.
          format: date-time
          example: '2023-10-02T12:00:00Z'
        paidAmount:
          type: string
          description: The amount that was paid for the invoice.
          example: '210.00'
        paymentMethod:
          type: string
          description: The method used for the payment.
          example: T|O|Z
      required:
        - documentId
        - documentNumber
        - issueDate
        - senderVatNumber
        - receiverVatNumber
        - paidDate
        - paidAmount
    UserAccountRequest:
      type: object
      properties:
        username:
          type: string
        lastName:
          type: string
        firstName:
          type: string
        password:
          type: string
        email:
          type: string
          format: email
        organizationId:
          type: string
      required:
        - username
        - password
        - email
        - organizationId
    UserAccountResponse:
      type: object
      properties:
        userId:
          type: string
          description: Unique identifier for the user account.
          example: 6787a98e15306d37eed688a8
      required:
        - userId
    UserActionsRequest:
      type: object
      properties:
        userId:
          type: string
      required:
        - userId
    UserActionsResponse:
      type: object
      properties:
        userId:
          type: string
        status:
          type: string
      required:
        - userId
        - status
    DocumentArchiveRequest:
      type: object
      properties:
        documentId:
          type: string
          description: The unique identifier of the invoice document.
          example: 6787a98e15306d37eed688a8
        companyVatNumber:
          type: string
          description: The VAT number of the sender.
          example: HR12345678910
      required:
        - documentId
        - companyVatNumber
    ArchivedDocumentResponse:
      type: object
      properties:
        documentId:
          type: string
          description: The unique identifier of the archived document.
          example: 6787a98e15306d37eed688a8
        status:
          type: string
          description: Status of the archived document.
          example: archived
      required:
        - documentId
        - status
    DocumentNumberRequest:
      type: object
      properties:
        documentNumber:
          type: string
          description: The number of the document.
          example: '1_2_3'
        companyVatNumber:
          type: string
          description: The VAT number of the company.
          example: HR12345678910
      required:
        - documentNumber
        - companyVatNumber
    OwnerRequest:
      type: object
      properties:
        companyVatNumber:
          type: string
          description: The VAT number of the sender.
          example: HR12345678910
      required:
        - companyVatNumber
    FiscalizationResponse:
      type: object
      properties:
        successful:
          type: boolean
          description: Whether the fiscalization was successful
          example: true
        errorMessage:
          type: string
          description: Error message if fiscalization failed
          example: Invalid tax rate
        errorCode:
          type: string
          description: Error code if fiscalization failed
          example: TAX_RATE_ERROR
        shouldRetry:
          type: boolean
          description: Whether the fiscalization should be retried
          example: false
        timestamp:
          type: string
          format: date-time
          description: Timestamp when the fiscalization was attempted
          example: '2024-01-15T10:30:00Z'
        fiscalizationRequestId:
          type: string
          description: Unique identifier for the fiscalization attempt
          example: FISK-2024-001234
        fiscalizationResponseId:
          type: string
          description: JIR (Jedinstveni identifikator računa) number from FINA
          example: 12345678-1234-1234-1234-123456789012
        fiscalizationType:
          type: string
          enum:
            - FISCALIZATION
            - FISCALIZATION_REJECTION_REPORT
            - FISCALIZATION_PAYMENT_REPORT
            - FISCALIZATION_NOT_DELIVERED_REPORT
          description: Type of fiscalization process
          example: FISCALIZATION
    ReportingResponse:
      type: object
      properties:
        successful:
          type: boolean
          description: Whether the reporting was successful
          example: true
        errorMessage:
          type: string
          description: Error message if reporting failed
          example: Invalid reporting format
        errorCode:
          type: string
          description: Error code if reporting failed
          example: FORMAT_ERROR
        shouldRetry:
          type: boolean
          description: Whether the reporting should be retried
          example: false
        timestamp:
          type: string
          format: date-time
          description: Timestamp when the reporting was attempted
          example: '2024-01-15T10:30:00Z'
        reportingRequestId:
          type: string
          description: Unique identifier for the reporting attempt
          example: RPT-2024-001234
        reportingResponseId:
          type: string
          description: Reference number from the reporting system
          example: REF-12345678-2024
        fiscalizationType:
          type: string
          enum:
            - FISCALIZATION
            - FISCALIZATION_REJECTION_REPORT
            - FISCALIZATION_PAYMENT_REPORT
            - FISCALIZATION_NOT_DELIVERED_REPORT
          description: Type of fiscalization process
          example: FISCALIZATION
    DocumentGetStatusResponse:
      type: object
      properties:
        documentId:
          description: The unique identifier of the invoice document.
          type: string
          example: 6787a98e15306d37eed688a8
        documentSenderName:
          description: The name of the sender of the document.
          type: string
          example: Example Sender Ltd.
        documentReceiverName:
          description: The name of the receiver of the document.
          type: string
          example: Example Receiver Ltd.
        documentSenderVatNumber:
          description: The VAT number of the sender without country prefix.
          type: string
          example: '12345678910'
        documentReceiverVatNumber:
          description: The VAT number of the receiver without country prefix.
          type: string
          example: '98765432100'
        documentNumber:
          description: The document number of the invoice.
          type: string
          example: INV-2023-001
        internalStatus:
          description: The internal status of the document.
          type: string
          example: NEW|OK|FAILED
        externalStatus:
          description: The external status of the document.
          type: string
          example: SENT|DELIVERED|ACKNOWLEDGED
        fiscalizationDetails:
          $ref: '#/components/schemas/FiscalizationResponse'
          description: Details from the latest fiscalization attempt (optional)
        reportingDetails:
          $ref: '#/components/schemas/ReportingResponse'
          description: Details from the latest reporting attempt (optional)
      required:
        - documentId
        - documentSenderName
        - documentReceiverName
        - documentSenderVatNumber
        - documentReceiverVatNumber
        - documentNumber
        - internalStatus
        - externalStatus
    DocumentGetStatusRequest:
      type: object
      properties:
        companyVatNumber:
          type: string
          description: The VAT number of the company.
          example: HR12345678910
        dateFrom:
          description: Date when an invoice was paid
          type: string
          format: date-time
        dateTo:
          description: Date when an invoice was paid
          type: string
          format: date-time
      required:
        - companyVatNumber
        - dateFrom
        - dateTo
    DocumentGetOutboxStatusResponse:
      type: object
      properties:
        documentId:
          description: The unique identifier of the invoice document.
          type: string
          example: 6787a98e15306d37eed688a8
        documentReceiverName:
          description: The name of the receiver of the document.
          type: string
          example: Example Receiver Ltd.
        documentNumber:
          description: The document number of the invoice.
          type: string
          example: INV-2023-001
        internalStatus:
          description: The internal status of the document.
          type: string
          example: NEW|OK|FAILED
        externalStatus:
          description: The external status of the document.
          type: string
          example: SENT|DELIVERED|ACKNOWLEDGED
      required:
        - documentId
        - documentReceiverName
        - documentNumber
        - internalStatus
        - externalStatus
    DocumentOutboxStatusListResponse:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/DocumentGetOutboxStatusResponse'
          description: List of documents inbox statuses return model.
      required:
        - items
    FiscalizationResponseModel:
      type: object
      description: Response returned by the fiscalization service.
      properties:
        responseId:
          type: string
          description: Identifier of the response received from the fiscalization service.
          example: resp-879812
        requestId:
          type: string
          description: Identifier of the fiscalization request sent.
          example: req-123456
        responseDateTime:
          type: string
          format: date-time
          description: Timestamp from the fiscalization response.
          example: '2025-07-21T10:15:30Z'
        successful:
          type: boolean
          description: Indicates if the fiscalization was successful.
          example: true
        errorCode:
          type: string
          description: Error code returned if the fiscalization failed.
          example: ERR_FIS_1001
        errorMessage:
          type: string
          description: Error message returned if the fiscalization failed.
          example: Invalid taxpayer ID.
        invalidRecordNumber:
          type: integer
          format: int64
          description: Index of the invalid record in the request.
          example: 3
        retryRecommended:
          type: boolean
          description: Indicates whether a retry is recommended.
          example: false
      required:
        - responseId
        - requestId
        - responseDateTime
        - successful
        - retryRecommended
    DocumentGetInboxStatusResponse:
      type: object
      properties:
        documentId:
          description: The unique identifier of the invoice document.
          type: string
          example: 6787a98e15306d37eed688a8
        documentSenderName:
          description: The name of the sender of the document.
          type: string
          example: Example Sender Ltd.
        documentNumber:
          description: The document number of the invoice.
          type: string
          example: INV-2023-001
        internalStatus:
          description: The internal status of the document.
          type: string
          example: NEW|OK|FAILED
        externalStatus:
          $ref: '#/components/schemas/FiscalizationResponseModel'
      required:
        - documentId
        - documentSenderName
        - documentNumber
        - internalStatus
        - externalStatus
    DocumentInboxStatusListResponse:
      type: object
      properties:
        items:
          type: array
          items:
            $ref: '#/components/schemas/DocumentGetInboxStatusResponse'
          description: List of documents inbox statuses return model.
      required:
        - items
    MonthlyUsageRequest:
      type: object
      required:
        - vatNumber
        - year
        - month
      properties:
        vatNumber:
          type: string
          description: VAT number of the organization
          example: HR12345678901
        year:
          type: integer
          description: Year for which usage is requested
          example: 2025
          minimum: 2020
          maximum: 2100
        month:
          type: integer
          description: Month for which usage is requested (1-12)
          example: 3
          minimum: 1
          maximum: 12
    UsageMetric:
      type: object
      required:
        - metricName
        - metricUsage
      properties:
        metricName:
          type: string
          description: Name of the metric
          example: documents-out
        metricUsage:
          type: string
          description: Usage value for the metric
          example: '123'
    UsageMetricsResponse:
      type: array
      items:
        $ref: '#/components/schemas/UsageMetric'
    ArchiveUsageRequest:
      type: object
      required:
        - vatNumber
      properties:
        vatNumber:
          type: string
          description: VAT number of the organization
          example: HR12345678901
    ArchiveUsageResponse:
      type: array
      items:
        $ref: '#/components/schemas/UsageMetric'
    GetFiscalizationStatusesRequest:
      type: object
      required:
        - documentId
      properties:
        documentId:
          type: string
          description: The unique identifier of the document
          example: 64a1b2c3d4e5f6789012345a
    GetReportingStatusesRequest:
      type: object
      required:
        - documentId
      properties:
        documentId:
          type: string
          description: The unique identifier of the document
          example: 64a1b2c3d4e5f6789012345a
    ApiKeyGenerateRequest:
      type: object
      required:
        - vatNumber
      properties:
        vatNumber:
          type: string
          description: VAT number of organization for which to generate API key
          example: '12345678901'
          minLength: 8
          maxLength: 15
    ApiKeyGenerateResponse:
      type: object
      properties:
        apiKey:
          type: string
          description: Generated API key value (encrypted)
          example: >-
            eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJzdWIiOiIxMjM0NTY3ODkwIiwibmFtZSI6IkpvaG4gRG9lIiwiaWF0IjoxNTE2MjM5MDIyfQ.SflKxwRJSMeKKF2QT4fwpMeJf36POk6yJV_adQssw5c
