Overview
The Invoice Generator API allows you to create professional PDF invoices with support for multiple languages, RTL layouts, and various design templates. Built on Cloudflare Pages with serverless functions.
- Multi-language support (English, Arabic, French, Spanish, etc.)
- RTL (Right-to-Left) layout support
- Multiple invoice templates
- Real-time analytics tracking
- Embedded fonts and assets
Authentication
Currently, the API uses public endpoints with optional admin authentication for analytics and administrative functions.
Base URL
The base URL for all API endpoints depends on your deployment:
Render PDF Endpoint
Generate a PDF invoice from JSON data. Returns the PDF file as binary data.
Request Body
| Parameter | Type | Required | Description |
|---|---|---|---|
| layoutKey | string | Yes | Template layout (neat-pro, modern-right, classic-left, etc.) |
| lang | string | Yes | Language code (en, ar, ar-e, fr, es, etc.) |
| direction | string | No | Text direction (ltr or rtl) |
| meta | object | Yes | Invoice metadata |
| parties | object | Yes | From and to party information |
| items | array | Yes | Invoice line items |
| totals | object | No | Pre-calculated totals (optional) |
Response
Content-Type: application/pdf
Headers: content-disposition: attachment; filename=invoice.pdf
Returns the generated PDF as binary data.
Analytics Endpoints
Get analytics metrics for invoice generation.
Response
Track custom analytics events.
Request Body
Admin Endpoints
Admin authentication endpoint.
Request Body
Available Layouts
The following invoice layouts are available:
| Layout Key | Description | Features |
|---|---|---|
neat-pro |
Professional clean design | Modern, balanced layout |
modern-right |
Right-aligned modern design | Contemporary styling |
classic-left |
Traditional left-aligned | Classic business style |
elegant-gray-pro |
Elegant gray theme | Premium appearance |
band-blue-pro |
Blue band design | Colorful header band |
cool-waves-pro |
Wave pattern design | Creative background |
boxed-totals |
Boxed totals section | Highlighted totals area |
Supported Languages
The API supports multiple languages with automatic RTL handling for Arabic:
| Language Code | Language | Direction | Notes |
|---|---|---|---|
en |
English | LTR | Default language |
ar |
Arabic | RTL | Standard Arabic |
ar-e |
Eastern Arabic | RTL | Eastern Arabic numerals |
fr |
French | LTR | Français |
es |
Spanish | LTR | Español |
hi |
Hindi | LTR | हिन्दी |
pt |
Portuguese | LTR | Português |