{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/invoicepdfs-com/json-schema/invoicepdfs-com-document-create-request-schema.json",
  "title": "DocumentCreateRequest",
  "x-generated": "2026-10-30",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/invoicepdfs-com-openapi.json#/components/schemas/DocumentCreateRequest",
  "properties": {
    "document_type": {
      "type": "string",
      "enum": [
        "invoice",
        "credit_note",
        "debit_note",
        "quote",
        "receipt",
        "proforma",
        "purchase_order",
        "delivery_note"
      ],
      "title": "Document Type",
      "default": "invoice"
    },
    "number": {
      "type": "string",
      "title": "Number"
    },
    "issue_date": {
      "type": "string",
      "format": "date",
      "title": "Issue Date"
    },
    "due_date": {
      "anyOf": [
        {
          "type": "string",
          "format": "date"
        },
        {
          "type": "null"
        }
      ],
      "title": "Due Date"
    },
    "currency": {
      "type": "string",
      "maxLength": 3,
      "minLength": 3,
      "title": "Currency"
    },
    "locale": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Locale",
      "default": "en-US"
    },
    "business_profile_id": {
      "type": "string",
      "title": "Business Profile Id"
    },
    "customer_id": {
      "type": "string",
      "title": "Customer Id"
    },
    "source_document_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Source Document Id"
    },
    "reason": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Reason"
    },
    "ship_to": {
      "anyOf": [
        {
          "$ref": "#/$defs/PostalAddress"
        },
        {
          "type": "null"
        }
      ]
    },
    "buyer_reference": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Buyer Reference",
      "description": "BT-10. Mandatory in Peppol BIS unless an order reference is present — often the buyer's own PO or cost-centre string."
    },
    "tax_scheme": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Tax Scheme",
      "description": "UNCL5153 — what kind of tax this invoice states. One document, one answer: an invoice is issued under a tax regime, not a different one per line. Optional, and deliberately not defaulted, because a PDF does not need it and assuming `VAT` would put a claim in a tax document that you did not make. Required to produce or check an e-invoice, where it must be `VAT` — every ruleset built on EN 16931 describes VAT and tests for that string literally, so a document stating anything else is refused rather than relabelled."
    },
    "delivery_date": {
      "anyOf": [
        {
          "type": "string",
          "format": "date"
        },
        {
          "type": "null"
        }
      ],
      "title": "Delivery Date",
      "description": "BT-72. When the goods or services were actually supplied — not the issue date, and what decides the VAT period. XRechnung requires this, an invoicing period, or a period on every line."
    },
    "line_items": {
      "items": {
        "$ref": "#/$defs/StandardLineItemInput"
      },
      "type": "array",
      "title": "Line Items"
    },
    "discounts": {
      "items": {
        "$ref": "#/$defs/LineItemDiscountInput"
      },
      "type": "array",
      "title": "Discounts"
    },
    "shipping": {
      "anyOf": [
        {
          "$ref": "#/$defs/InvoiceShippingInput"
        },
        {
          "type": "null"
        }
      ]
    },
    "notes": {
      "items": {
        "$ref": "#/$defs/InvoiceNoteInput"
      },
      "type": "array",
      "title": "Notes"
    },
    "terms": {
      "items": {
        "$ref": "#/$defs/InvoiceTermInput"
      },
      "type": "array",
      "title": "Terms"
    },
    "custom_fields": {
      "items": {
        "$ref": "#/$defs/InvoiceCustomFieldInput"
      },
      "type": "array",
      "title": "Custom Fields"
    },
    "payment": {
      "anyOf": [
        {
          "$ref": "#/$defs/InvoicePaymentInput"
        },
        {
          "type": "null"
        }
      ]
    },
    "branding": {
      "anyOf": [
        {
          "$ref": "#/$defs/InvoiceBrandingInput"
        },
        {
          "type": "null"
        }
      ]
    },
    "branding_profile_id": {
      "anyOf": [
        {
          "type": "string"
        },
        {
          "type": "null"
        }
      ],
      "title": "Branding Profile Id"
    }
  },
  "type": "object",
  "required": [
    "number",
    "issue_date",
    "currency",
    "business_profile_id",
    "customer_id",
    "line_items"
  ],
  "$defs": {
    "InvoiceBankAccountInput": {
      "properties": {
        "bank_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Bank Name"
        },
        "account_name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Account Name"
        },
        "account_number": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Account Number"
        },
        "routing_number": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Routing Number"
        },
        "swift": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Swift"
        },
        "iban": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Iban"
        }
      },
      "type": "object",
      "title": "InvoiceBankAccountInput"
    },
    "InvoiceBrandingInput": {
      "properties": {
        "logo_file_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Logo File Id"
        },
        "primary_color": {
          "type": "string",
          "title": "Primary Color",
          "default": "#111827"
        },
        "accent_color": {
          "type": "string",
          "title": "Accent Color",
          "default": "#111827"
        },
        "font_family": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Font Family"
        },
        "header_text": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Header Text"
        },
        "footer_text": {
          "type": "string",
          "title": "Footer Text",
          "default": "Generated by InvoicePDFs"
        },
        "hide_invoicepdfs_branding": {
          "type": "boolean",
          "title": "Hide Invoicepdfs Branding",
          "default": false
        }
      },
      "type": "object",
      "title": "InvoiceBrandingInput"
    },
    "InvoiceCustomFieldInput": {
      "properties": {
        "label": {
          "type": "string",
          "title": "Label"
        },
        "value": {
          "type": "string",
          "title": "Value"
        }
      },
      "type": "object",
      "required": [
        "label",
        "value"
      ],
      "title": "InvoiceCustomFieldInput"
    },
    "InvoiceNoteInput": {
      "properties": {
        "type": {
          "type": "string",
          "title": "Type"
        },
        "content": {
          "type": "string",
          "title": "Content"
        }
      },
      "type": "object",
      "required": [
        "type",
        "content"
      ],
      "title": "InvoiceNoteInput"
    },
    "InvoicePaymentInput": {
      "properties": {
        "bank_account": {
          "anyOf": [
            {
              "$ref": "#/$defs/InvoiceBankAccountInput"
            },
            {
              "type": "null"
            }
          ]
        },
        "payment_url": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Payment Url"
        },
        "accepted_methods": {
          "items": {
            "type": "string"
          },
          "type": "array",
          "title": "Accepted Methods"
        },
        "instructions": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Instructions"
        }
      },
      "type": "object",
      "title": "InvoicePaymentInput"
    },
    "InvoiceShippingInput": {
      "properties": {
        "description": {
          "type": "string",
          "title": "Description",
          "default": "Shipping"
        },
        "amount": {
          "type": "string",
          "title": "Amount"
        },
        "taxable": {
          "type": "boolean",
          "title": "Taxable",
          "default": false
        }
      },
      "type": "object",
      "required": [
        "amount"
      ],
      "title": "InvoiceShippingInput"
    },
    "InvoiceTermInput": {
      "properties": {
        "type": {
          "type": "string",
          "title": "Type"
        },
        "content": {
          "type": "string",
          "title": "Content"
        }
      },
      "type": "object",
      "required": [
        "type",
        "content"
      ],
      "title": "InvoiceTermInput"
    },
    "LineItemDiscountInput": {
      "properties": {
        "type": {
          "type": "string",
          "enum": [
            "percentage",
            "fixed"
          ],
          "title": "Type",
          "default": "percentage"
        },
        "value": {
          "type": "string",
          "title": "Value"
        },
        "reason": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Reason"
        }
      },
      "type": "object",
      "required": [
        "value"
      ],
      "title": "LineItemDiscountInput"
    },
    "LineItemTaxInput": {
      "properties": {
        "tax_rate_id": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Tax Rate Id"
        },
        "name": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Name"
        },
        "rate": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Rate"
        },
        "inclusive": {
          "type": "boolean",
          "title": "Inclusive",
          "default": false
        },
        "category": {
          "anyOf": [
            {
              "$ref": "#/$defs/TaxCategory"
            },
            {
              "type": "null"
            }
          ],
          "description": "How this tax is treated — required for e-invoicing formats, which keep zero-rated, exempt and reverse-charge in separate VAT groups."
        }
      },
      "type": "object",
      "title": "LineItemTaxInput"
    },
    "PostalAddress": {
      "properties": {
        "line1": {
          "type": "string",
          "title": "Line1"
        },
        "line2": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Line2"
        },
        "city": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "City"
        },
        "state": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "State"
        },
        "postal_code": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Postal Code"
        },
        "country": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Country"
        }
      },
      "type": "object",
      "required": [
        "line1"
      ],
      "title": "PostalAddress"
    },
    "StandardLineItemInput": {
      "properties": {
        "name": {
          "type": "string",
          "title": "Name"
        },
        "description": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Description"
        },
        "quantity": {
          "type": "string",
          "title": "Quantity",
          "description": "Decimal string"
        },
        "unit_price": {
          "type": "string",
          "title": "Unit Price",
          "description": "Decimal string, major units",
          "default": "0.00"
        },
        "unit": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Unit"
        },
        "unit_code": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Unit Code",
          "description": "BT-130. UN/ECE Rec 20 code for the unit — HUR for hours, C62 for each. Separate from `unit`, which is the label printed on the PDF."
        },
        "sku": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Sku"
        },
        "discount": {
          "anyOf": [
            {
              "$ref": "#/$defs/LineItemDiscountInput"
            },
            {
              "type": "null"
            }
          ]
        },
        "taxes": {
          "items": {
            "$ref": "#/$defs/LineItemTaxInput"
          },
          "type": "array",
          "title": "Taxes"
        }
      },
      "type": "object",
      "required": [
        "name",
        "quantity"
      ],
      "title": "StandardLineItemInput",
      "description": "A fully priced line: unit, price, tax, discount and SKU."
    },
    "TaxCategory": {
      "properties": {
        "code": {
          "type": "string",
          "minLength": 1,
          "title": "Code",
          "description": "UNCL5305 tax category code — S standard, Z zero-rated, E exempt, AE reverse charge, K intra-community, G export, O outside scope"
        },
        "exemption_reason": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Exemption Reason",
          "description": "Required by EN 16931 whenever the category is not standard."
        },
        "exemption_reason_code": {
          "anyOf": [
            {
              "type": "string"
            },
            {
              "type": "null"
            }
          ],
          "title": "Exemption Reason Code"
        }
      },
      "type": "object",
      "required": [
        "code"
      ],
      "title": "TaxCategory",
      "description": "How a tax is treated, as opposed to what it is called.\n\n`name` and `rate` do not say this: two taxes at 0% may be zero-rated,\nexempt, reverse-charge or outside scope, and EN 16931 keeps them in\nseparate VAT breakdown groups with different mandatory fields. Optional,\nso an invoice that never mentions a category calculates exactly as before."
    }
  }
}