Invoice API
POST /api/invoices accepts an invoice as JSON and returns that sheet as a PDF. It does not read the browser, and it does not send mail.
Request
Send Authorization: Bearer with the value of INVOICE_WEBHOOK_SECRET, and Content-Type: application/json.
Responses
- 200 application/pdf
- The file name is the invoice number, or invoice.pdf when that number is empty.
- 401
- The secret is missing or wrong.
- 400
- The body is not valid. The JSON is { "error": "..." }.
- 500
- INVOICE_WEBHOOK_SECRET is unset, or the sheet could not be photographed.
Body
currency is required: MUR, USD, EUR, or GBP. lines is required, one to forty rows. Each line has description, quantity, and rate as text. A numeric amount is accepted and kept as text. Dates are YYYY-MM-DD or empty.
Every other field may be omitted. An omitted string is empty. An omitted toggle is off. discountMode, taxMode, and shippingMode default to off. tax2Mode defaults to subtotal. logo is null, a data:image base64 URL, or an https URL. logoZoom is a number from 1 to 3.
The totals use the same math as the sheet. The PDF is a photograph of that sheet with no navbar and no field controls.
Example
{
"companyName": "TETRANXT CO LTD",
"logo": null,
"logoZoom": 1,
"companyAddress": "Anfield Road Trois Bras\nPetit Raffray\nMauritius",
"companyRegistration": "C25221867",
"billToName": "Gwens Marketing Ltd",
"billToAddress": "Escale Nord Business Hub\nEscale Building\nChemin Vingt Pieds\nGrand Baie Mauritius",
"billToRegistration": "C16135219",
"invoiceNumber": "TN27082026-01",
"issueDate": "2026-08-27",
"currency": "MUR",
"lines": [
{
"description": "Website update - user login by mobile number (WhatsApp verification)",
"quantity": "1",
"rate": "18000"
},
{
"description": "Hosting, September",
"quantity": "1",
"rate": "2500"
}
],
"bankName": "Mauritius Commercial Bank (MCB)",
"accountName": "Hans Gungadeen",
"accountNumber": "000446924587",
"swift": "MCBLMUMU",
"showSwift": true,
"preparedByName": "Gungadeen Hans",
"preparedByTitle": "Director, TETRANXT CO LTD",
"preparedByDate": "2026-08-27",
"showPreparedBy": true,
"paymentTerms": "Net 30 days",
"paymentMethods": "Bank Transfer, Juice",
"notes": "Thank you for your business",
"showNotes": true,
"taxMode": "percent",
"taxValue": "15",
"tax2Mode": "after-tax",
"tax2Value": "2",
"showTax2": true,
"paidValue": "5000",
"showPaid": true,
"payLink": "https://pay.example.com/TN27082026-01",
"showPayLink": true,
"discountMode": "percent",
"discountValue": "10",
"shippingMode": "flat",
"shippingValue": "500"
}