{"openapi":"3.0.0","info":{"title":"Tulz Invoice API","version":"1.0.0","description":"Generate professional HTML invoices via a simple JSON POST request. Free, no auth required.","contact":{"url":"https://tulz.org/invoice-api"}},"servers":[{"url":"https://tulz.org"}],"paths":{"/api/invoice":{"post":{"summary":"Generate an invoice","description":"Returns a ready-to-render HTML invoice. Add `?format=json` to get the HTML + calculated totals in a JSON envelope.","parameters":[{"name":"format","in":"query","schema":{"type":"string","enum":["html","json"],"default":"html"},"description":"Response format. `html` returns the invoice HTML directly. `json` returns totals + HTML in a JSON object."}],"requestBody":{"required":true,"content":{"application/json":{"schema":{"type":"object","required":["from","to","items"],"properties":{"invoiceNumber":{"type":"string","example":"INV-042","default":"INV-001"},"issueDate":{"type":"string","format":"date","example":"2026-04-07"},"dueDate":{"type":"string","format":"date","example":"2026-05-07"},"currency":{"type":"string","example":"USD","description":"ISO 4217 code. Supported: USD, EUR, GBP, INR, JPY, CAD, AUD, CHF, SGD, AED"},"accentColor":{"type":"string","example":"#1e40af","description":"Hex color for invoice branding"},"from":{"type":"object","required":["name"],"properties":{"name":{"type":"string","example":"Acme Corp"},"address":{"type":"string","example":"123 Main St, San Francisco CA 94102"},"email":{"type":"string","example":"billing@acme.com"},"phone":{"type":"string","example":"+1 (555) 000-0000"},"website":{"type":"string","example":"acme.com"}}},"to":{"type":"object","required":["name"],"properties":{"name":{"type":"string","example":"Client Inc."},"address":{"type":"string","example":"456 Oak Ave, New York NY 10001"},"email":{"type":"string","example":"accounts@client.com"},"phone":{"type":"string","example":"+1 (555) 111-2222"}}},"items":{"type":"array","minItems":1,"maxItems":100,"items":{"type":"object","required":["description","quantity","rate"],"properties":{"description":{"type":"string","example":"Website Development"},"quantity":{"type":"number","example":1},"rate":{"type":"number","example":2500}}}},"taxRate":{"type":"number","example":8.5,"description":"Tax percentage (0–100)"},"discount":{"type":"number","example":10,"description":"Discount percentage applied before tax (0–100)"},"notes":{"type":"string","example":"Payment due within 30 days. Thank you!"}}},"example":{"invoiceNumber":"INV-042","issueDate":"2026-04-07","dueDate":"2026-05-07","currency":"USD","accentColor":"#7c3aed","from":{"name":"Acme Corp","address":"123 Main St\nSan Francisco, CA 94102","email":"billing@acme.com","website":"acme.com"},"to":{"name":"Client Inc.","address":"456 Oak Ave\nNew York, NY 10001","email":"accounts@client.com"},"items":[{"description":"Website Development","quantity":1,"rate":2500},{"description":"Monthly Maintenance","quantity":3,"rate":200}],"taxRate":8.5,"discount":5,"notes":"Payment due within 30 days. Thank you for your business!"}}}},"responses":{"200":{"description":"Invoice HTML (default) or JSON envelope (with ?format=json)","content":{"text/html":{"schema":{"type":"string"}},"application/json":{"schema":{"type":"object","properties":{"invoiceNumber":{"type":"string"},"currency":{"type":"string"},"subtotal":{"type":"number"},"discount":{"type":"number"},"tax":{"type":"number"},"total":{"type":"number"},"formatted":{"type":"object","properties":{"subtotal":{"type":"string"},"discount":{"type":"string"},"tax":{"type":"string"},"total":{"type":"string"}}},"html":{"type":"string"}}}}}},"422":{"description":"Validation error","content":{"application/json":{"schema":{"type":"object","properties":{"error":{"type":"string"}}}}}}}}}}}