openapi: 3.1.0
info:
  title: Invora REST API
  version: 1.4.0
  description: Developer-first B2B/B2C e-invoicing REST API for Germany EN 16931 (XRechnung 3.0 / ZUGFeRD 2.2 BYOP), Saudi ZATCA Phase 2, and Peppol BIS 3.0.
servers:
  - url: https://api.invora.dev
paths:
  /health:
    get:
      summary: Service & KoSIT/PostgreSQL health check
      responses:
        '200':
          description: Service healthy
  /v1/quickstart:
    get:
      summary: Zero-signup curl, Node.js, and Python quickstart snippets
      responses:
        '200':
          description: Quickstart snippets
  /v1/compliance/attestation:
    get:
      summary: GDPR Article 28 & Zero-PII cryptographic attestation
      responses:
        '200':
          description: Attestation payload
  /v1/einvoice/preflight:
    post:
      summary: Free zero-signup EN 16931, KoSIT, ZATCA, and Peppol preflight validation
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
      responses:
        '200':
          description: Validation result with fixHints and computed totals
  /v1/einvoice/issue:
    post:
      summary: Issue and sign a compliant e-invoice
      security:
        - bearerAuth: []
      parameters:
        - in: header
          name: Idempotency-Key
          required: true
          schema:
            type: string
            minLength: 8
            maxLength: 128
      requestBody:
        required: true
        content:
          application/json:
            schema:
              type: object
      responses:
        '201':
          description: Issued e-invoice XML / PDF-A-3b / ZATCA QR
        '409':
          description: Idempotency payload mismatch or in-flight conflict
  /v1/usage:
    get:
      summary: Current UTC monthly quota and format breakdown
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Quota and usage breakdown
  /v1/zatca/reporting-queue:
    get:
      summary: List ZATCA Simplified B2C (0200000) async reporting queue
      security:
        - bearerAuth: []
      responses:
        '200':
          description: Queue items with 24h statutory window telemetry
  /v1/export:
    get:
      summary: Full tenant portability export (CSIDs + Zero-PII audit ledger)
      security:
        - bearerAuth: []
      responses:
        '200':
          description: JSON portability export
components:
  securitySchemes:
    bearerAuth:
      type: http
      scheme: bearer
