Invoicepig logo
Invoicepig
GeneratorPricingAPIBlogReviewsResourcesContact
HomeAPI Documentation

InvoicePig API

Generate professional PDF invoices programmatically. Full customization with themes, custom labels, logos, and 52 supported currencies.

Get API KeyQuick Start
Base URL
https://invoicepig.com/api/v1

Getting Started

  • Authentication
  • Quick Start
  • Rate Limits

Endpoints

  • Generate Invoice
  • Preview Invoice
  • Themes
  • Currencies
  • Labels
  • Usage

Reference

  • Full Request Schema
  • Error Codes

Authentication

All API requests require authentication via an API key. Include your key in the request headers.

Header Authentication
x-api-key: ipig_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Or use the Authorization header with Bearer token:

Authorization: Bearer ipig_live_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx

Quick Start

Generate your first invoice in seconds with this simple example.

curl -X POST https://invoicepig.com/api/v1/invoices/generate \
  -H "x-api-key: YOUR_API_KEY" \
  -H "Content-Type: application/json" \
  -d '{
    "companyName": "Acme Corporation",
    "billTo": "John Doe\n123 Main Street\nNew York, NY 10001",
    "invoiceNumber": "INV-2025-001",
    "date": "2025-01-15",
    "currency": "USD",
    "theme": "Corporate",
    "lineItems": [
      {
        "description": "Web Development Services",
        "quantity": 40,
        "rate": 150
      },
      {
        "description": "UI/UX Design",
        "quantity": 20,
        "rate": 125
      }
    ]
  }' --output invoice.pdf

Rate Limits

API rate limits vary by subscription tier. Rate limit headers are included in all responses.

Free

20

invoices/month

5 req/min

Premium

500

invoices/month

30 req/min

API Pro

2,000

invoices/month

60 req/min

Enterprise

Unlimited

invoices/month

120 req/min

Rate Limit Headers
X-RateLimit-Limit: 30
X-RateLimit-Remaining: 29
X-RateLimit-Reset: 1705312800
X-Monthly-Usage: 45
X-Monthly-Limit: 500

Generate Invoice

POST/api/v1/invoices/generateRequires API Key
Generate a PDF invoice from the provided data. Returns PDF binary by default, or base64 encoded string.

Preview Invoice

POST/api/v1/invoices/previewRequires API Key
Validate invoice data and preview calculated totals without generating a PDF. Does not count against monthly quota.
{
  "success": true,
  "data": {
    "valid": true,
    "preview": {
      "companyName": "Acme Corporation",
      "invoiceNumber": "INV-2025-001",
      "date": "2025-01-15",
      "currency": "USD",
      "currencySymbol": "$",
      "theme": "Corporate",
      "lineItemCount": 2,
      "financial": {
        "subtotal": 8500,
        "discount": 850,
        "tax": 650.25,
        "shipping": 25,
        "total": 8325.25,
        "amountPaid": 1000,
        "balanceDue": 7325.25
      },
      "hasWatermark": false
    }
  }
}

Themes

GET/api/v1/themes
List all available invoice themes with their color configurations.
{
  "success": true,
  "data": {
    "themes": [
      {
        "name": "Classic",
        "primaryColor": "#1e293b",
        "accentColor": "#14b8a6",
        "description": "Traditional professional design"
      },
      {
        "name": "Corporate",
        "primaryColor": "#2563eb",
        "accentColor": "#3b82f6",
        "description": "Modern business style"
      },
      {
        "name": "Formal",
        "primaryColor": "#2c3338",
        "accentColor": "#8b7355",
        "description": "Elegant official design"
      },
      {
        "name": "Minimal",
        "primaryColor": "#374151",
        "accentColor": "#6b7280",
        "description": "Clean simple design"
      },
      {
        "name": "Creative",
        "primaryColor": "#7c3aed",
        "accentColor": "#8b5cf6",
        "description": "Bold modern style"
      },
      {
        "name": "Futuristic",
        "primaryColor": "#0ea5e9",
        "accentColor": "#06b6d4",
        "description": "Tech-forward design"
      },
      {
        "name": "Luxury",
        "primaryColor": "#1e293b",
        "accentColor": "#d4af37",
        "description": "Premium high-end design"
      }
    ],
    "defaultTheme": "Classic"
  }
}

Custom Theme Colors

Instead of using a preset theme, you can provide custom colors:

{
  "customTheme": {
    "primaryColor": "#2563eb",
    "primaryColorDark": "#1e40af",
    "accentColor": "#3b82f6",
    "textColor": "#1e2937",
    "secondaryTextColor": "#64748b",
    "borderColor": "#e0e7ff",
    "backgroundColor": "#ffffff",
    "headerTextColor": "#ffffff"
  }
}

Currencies

GET/api/v1/currencies
List all 52 supported currencies with their symbols and names.
{
  "success": true,
  "data": {
    "currencies": [
      { "code": "USD", "symbol": "$", "name": "US Dollar", "fullFormat": "USD ($)" },
      { "code": "EUR", "symbol": "€", "name": "Euro", "fullFormat": "EUR (€)" },
      { "code": "GBP", "symbol": "£", "name": "British Pound", "fullFormat": "GBP (£)" },
      { "code": "JPY", "symbol": "¥", "name": "Japanese Yen", "fullFormat": "JPY (¥)" },
      // ... 48 more currencies
    ],
    "defaultCurrency": "USD"
  }
}

Custom Labels

GET/api/v1/labels/defaults
Get default label values for reference. Use these as a starting point for localization.
{
  "success": true,
  "data": {
    "labels": {
      "invoice": "INVOICE",
      "billTo": "Bill To",
      "shipTo": "Ship To",
      "invoiceNumber": "Invoice #",
      "date": "Date",
      "paymentTerms": "Payment Terms",
      "dueDate": "Due Date",
      "poNumber": "P.O. Number",
      "item": "Item",
      "hsCode": "HS Code",
      "quantity": "Qty",
      "rate": "Rate",
      "amount": "Amount",
      "subtotal": "Subtotal",
      "discount": "Discount",
      "tax": "Tax",
      "shipping": "Shipping",
      "total": "Total",
      "amountPaid": "Amount Paid",
      "balanceDue": "Balance Due",
      "notes": "Notes",
      "terms": "Terms & Conditions"
    }
  }
}

Localization Examples

Translate labels for different languages:

{
  "labels": {
    "invoice": "FACTURA",
    "billTo": "Facturar A",
    "date": "Fecha",
    "dueDate": "Fecha de Vencimiento",
    "total": "Total",
    "balanceDue": "Saldo Pendiente"
  }
}

Usage Statistics

GET/api/v1/usageRequires API Key
Get your current API usage statistics for the billing period.
{
  "success": true,
  "data": {
    "currentPeriod": {
      "start": "2025-01-01T00:00:00Z",
      "end": "2025-02-01T00:00:00Z"
    },
    "usage": {
      "invoicesGenerated": 127,
      "invoicesLimit": 500,
      "invoicesRemaining": 373,
      "percentUsed": 25.4
    },
    "rateLimit": {
      "requestsPerMinute": 30,
      "currentMinuteUsage": 3
    },
    "subscription": {
      "tier": "Premium",
      "status": "active"
    }
  }
}

Full Request Schema

Complete reference of all available request fields.

Error Codes

API errors follow a consistent format with error codes.

CodeHTTP StatusDescription
UNAUTHORIZED401Missing or invalid API key
FORBIDDEN403API key doesn't have permission
VALIDATION_ERROR400Invalid request data
RATE_LIMIT_EXCEEDED429Too many requests
MONTHLY_LIMIT_EXCEEDED429Monthly quota exceeded
INTERNAL_ERROR500Server error

Error Response Format

{
  "success": false,
  "error": {
    "code": "VALIDATION_ERROR",
    "message": "Invalid request data",
    "details": [
      {
        "field": "lineItems[0].rate",
        "message": "Rate must be a positive number"
      },
      {
        "field": "date",
        "message": "Invalid date format. Use YYYY-MM-DD"
      }
    ]
  }
}

Ready to Get Started?

Create your API key and start generating professional invoices programmatically.

Get Your API KeyTry Invoice Generator