Invoice Generator API

Programmatic PDF Invoice Generation

Generate professional PDF invoices programmatically with our RESTful API. Perfect for integrating invoice generation into your applications.

API Endpoint

POST
https://yourdomain.com/api/generate-pdf

Generate and download PDF invoices

Features

High-Quality PDF Generation

Generate professional PDF invoices with pixel-perfect formatting using Puppeteer

Multi-language Support

Support for English, Chinese (Simplified & Traditional), Japanese, Korean, and Spanish

Multiple PDF Formats

Support for A4 and Letter page formats with customizable margins

Input Validation

Comprehensive validation of invoice data to ensure data integrity

Security & Rate Limiting

Built-in rate limiting and input sanitization for security

High Reliability

Robust error handling and automatic resource cleanup

Usage Example

Here's how to use the API to generate a PDF invoice:

JavaScript
// Using fetch API
const response = await fetch('https://yourdomain.com/api/generate-pdf', {
  method: 'POST',
  headers: {
    'Content-Type': 'application/json'
  },
  body: JSON.stringify({
    invoice: {
      invoiceNumber: 'INV-001',
      date: '2024-07-20',
      dueDate: '2024-08-20',
      currency: 'USD',
      from: {
        name: 'Your Company',
        email: '[email protected]',
        address1: '123 Business St',
        city: 'Business City',
        state: 'BC',
        postalCode: '12345',
        country: 'Country'
      },
      to: {
        name: 'Client Name',
        email: '[email protected]',
        address1: '456 Client Ave',
        city: 'Client City',
        state: 'CC',
        postalCode: '67890',
        country: 'Country'
      },
      items: [{
        id: '1',
        description: 'Service Description',
        quantity: 1,
        rate: 100,
        amount: 100
      }],
      subtotal: 100,
      taxRate: 10,
      tax: 10,
      total: 110,
      notes: 'Thank you for your business!',
      terms: 'Payment due in 30 days'
    },
    options: {
      locale: 'en',
      pdfOptions: {
        format: 'A4'
      }
    }
  })
});

if (response.ok) {
  const blob = await response.blob();
  // Download the PDF
  const url = URL.createObjectURL(blob);
  const a = document.createElement('a');
  a.href = url;
  a.download = 'invoice.pdf';
  a.click();
}

Rate Limits

To ensure fair usage and system stability, the following rate limits apply:

Rate Limit Exceeded

If you exceed the rate limit, you'll receive a 429 status code. Please wait before making additional requests.

10
10 requests per 15 minutes per IP address
100KB
Maximum request size: 100KB
30s
Request timeout: 30 seconds

Frequently Asked Questions

Test API

Try the API with a sample request: