{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/einvoicewiz-com/json-schema/einvoicewiz-com-invoice-schema.json",
  "title": "Invoice",
  "x-generated": "2026-11-06",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/einvoicewiz-com-openapi.json#/components/schemas/Invoice",
  "type": "object",
  "required": [
    "invoice_number",
    "issue_date",
    "currency",
    "seller",
    "buyer",
    "lines"
  ],
  "properties": {
    "doc_type": {
      "type": "integer",
      "enum": [
        380,
        381,
        384
      ],
      "default": 380,
      "description": "380 invoice, 381 credit note, 384 correction"
    },
    "invoice_number": {
      "type": "string"
    },
    "issue_date": {
      "type": "string",
      "format": "date"
    },
    "due_date": {
      "type": [
        "string",
        "null"
      ],
      "format": "date"
    },
    "delivery_date": {
      "type": [
        "string",
        "null"
      ],
      "format": "date"
    },
    "currency": {
      "type": "string"
    },
    "buyer_reference": {
      "type": [
        "string",
        "null"
      ],
      "description": "Leitweg-ID (BT-10). Required for XRechnung."
    },
    "order_reference": {
      "type": [
        "string",
        "null"
      ]
    },
    "seller": {
      "type": "object",
      "required": [
        "name",
        "country"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "line_one": {
          "type": "string"
        },
        "postcode": {
          "type": "string"
        },
        "city": {
          "type": "string"
        },
        "country": {
          "type": "string"
        },
        "vat_id": {
          "type": "string"
        },
        "tax_number": {
          "type": "string"
        },
        "contact_email": {
          "type": "string"
        },
        "contact_phone": {
          "type": "string"
        },
        "email": {
          "type": "string"
        }
      }
    },
    "buyer": {
      "type": "object",
      "required": [
        "name",
        "country"
      ],
      "properties": {
        "name": {
          "type": "string"
        },
        "line_one": {
          "type": "string"
        },
        "postcode": {
          "type": "string"
        },
        "city": {
          "type": "string"
        },
        "country": {
          "type": "string"
        },
        "vat_id": {
          "type": "string"
        },
        "email": {
          "type": "string"
        }
      }
    },
    "payment": {
      "type": "object",
      "properties": {
        "iban": {
          "type": "string"
        },
        "bic": {
          "type": "string"
        },
        "terms": {
          "type": "string"
        }
      }
    },
    "notes": {
      "type": "array",
      "items": {
        "type": "string"
      }
    },
    "prepaid": {
      "type": "number",
      "default": 0
    },
    "exemption_reason": {
      "type": [
        "string",
        "null"
      ]
    },
    "lines": {
      "type": "array",
      "minItems": 1,
      "items": {
        "type": "object",
        "required": [
          "name",
          "qty",
          "unit_price",
          "vat_rate"
        ],
        "properties": {
          "name": {
            "type": "string"
          },
          "description": {
            "type": "string"
          },
          "qty": {
            "type": "number"
          },
          "unit": {
            "type": "string",
            "enum": [
              "piece",
              "hour",
              "day",
              "kg",
              "litre",
              "month",
              "km",
              "lump",
              "m2",
              "m"
            ],
            "default": "piece"
          },
          "unit_price": {
            "type": "number"
          },
          "vat_rate": {
            "type": "number"
          },
          "vat_category": {
            "type": "string",
            "enum": [
              "S",
              "Z",
              "E",
              "AE",
              "K",
              "G",
              "O"
            ]
          }
        }
      }
    }
  }
}