A production-ready, beautiful REST API for generating business-grade PDF invoices — with logo, seller & customer details, discounts, flexible currencies, and more.
Includes: Dockerfile, full project structure, HTML frontend, setup guides, and real Postman-ready endpoints.
A modern Flask REST API that turns your input into ready-to-send PDF invoices. Suitable for freelancers, startups, agencies, and internal tools.
- 🖼 Supports logo (URL or local file)
- 🏢 Seller/company & customer blocks (name, address, phone, email, bank info, INN, BIK, website)
- 💸 Unlimited line items (products/services)
- 🔢 Automatic invoice numbering (INV-00001...)
- 🎨 Custom currency, notes, payment terms, due date
- 📉 Discounts & tax calculation
- 🌐 Unicode/UTF-8 support (cyrillic, euro, etc — via Arial.ttf)
- 📄 Clean, minimal PDF layout
- 🖥 Built-in HTML frontend (in /static) for non-coders
- ⚡ Modular, Postman-tested API endpoints
- 🐳 Docker-ready
POST /generate-invoice
Request Example:
{
"customer_name": "Ivan Ivanov",
"email": "ivan@mail.com",
"items": [
{"name": "Logo Design", "quantity": 1, "price": 120.5},
{"name": "Consulting", "quantity": 2, "price": 60}
],
"currency": "USD",
"notes": "Thank you for your business!",
"logo_url": "logo.png",
"seller_name": "Talabov Ltd.",
"seller_address": "Moscow, Main St, 1",
"seller_phone": "+7-999-123-45-67",
"seller_email": "info@company.com",
"seller_website": "company.com",
"seller_inn": "1234567890",
"seller_bank": "TalabovBank",
"seller_bik": "044525225",
"payment_terms": "Net 5 days",
"due_date": "2025-06-05",
"discount": 15.5
}
Response:
{
"message": "Invoice generated",
"download_link": "/invoices/<uuid>.pdf"
}
{"error": "customer_name and items are required"}
{"error": "Each item must contain name, quantity, and price"}
pip install -r requirements.txt
- Flask
- reportlab
- requests
- python-dotenv
python app.py
Or use Docker:
docker build -t invoice-api .
docker run -p 5000:5000 invoice-api
Open http://localhost:5000/ for a ready-to-use web UI.
- Add all details, upload logo or use URL, hit “Generate Invoice PDF”.
- Works on desktop & mobile.
- ✅ POST to
/generate-invoice
- ✅ Download PDF
⚠️ Error messages- 🖥 HTML UI demo
See
/screens/
for screenshots and PDF samples.
Get the ZIP with full project, Docker, frontend, and tech support:
- Email: talabov.ali72@gmail.com
- Telegram: @talabovali
Need this in another language/stack (Node.js, Go, etc)? Custom dev available — just reach out.