generate_invoice
Generate ZATCA-compliant UBL 2.1 XML e-invoices for Saudi Arabia. Supports standard, simplified, credit note, and debit note types with automatic VAT calculation and QR code data.
Instructions
Generate a ZATCA-compliant UBL 2.1 XML e-invoice.
Creates a complete XML invoice following Saudi Arabia's ZATCA e-invoicing standard. Supports Standard (B2B), Simplified (B2C), Credit Note, and Debit Note invoice types. Automatically calculates VAT, line totals, and embeds QR code data.
Args: invoice_type: "standard" (B2B), "simplified" (B2C), "credit_note", or "debit_note" invoice_number: Unique invoice identifier (e.g., "INV-2024-001") issue_date: Invoice date in YYYY-MM-DD format seller_name: Seller business name seller_vat: Seller 15-digit VAT number (e.g., "300000000000003") seller_address: Seller street address seller_city: Seller city name buyer_name: Buyer/customer name items: JSON array of line items. Each item: {"name": "Product", "quantity": 1, "unit_price": 100.00, "vat_rate": 0.15} currency: ISO currency code (default: "SAR") buyer_vat: Buyer VAT number (required for standard invoices) buyer_address: Buyer street address (optional) buyer_city: Buyer city (optional) note: Optional note to include on the invoice billing_reference_id: Original invoice ID (required for credit/debit notes) billing_reference_date: Original invoice date (for credit/debit notes) instruction_note: Reason for credit/debit note (recommended)
Returns: Complete UBL 2.1 XML invoice string
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| note | No | ||
| items | Yes | ||
| currency | No | SAR | |
| buyer_vat | No | ||
| buyer_city | No | ||
| buyer_name | Yes | ||
| issue_date | Yes | ||
| seller_vat | Yes | ||
| seller_city | Yes | ||
| seller_name | Yes | ||
| invoice_type | Yes | ||
| buyer_address | No | ||
| invoice_number | Yes | ||
| seller_address | Yes | ||
| instruction_note | No | ||
| billing_reference_id | No | ||
| billing_reference_date | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| result | Yes |