Invoice Generator API

We created a simple API at Invoice-Generator.com to generate invoice PDFs on the fly. This service has been used internally by us for some time. We believe this could be helpful in your project as well.

The API has a primary endpoint that returns a PDF given details of an invoice. We don't store any of your invoice data.

In addition to PDF, the API can also generate e-invoices in UBL (Universal Business Language) with the invoice PDF embedded. This is useful as the world shifts to e-invoicing because UBL invoices are tricky to generate.

Use Cases

Table of Contents

Examples

Simple Invoice

curl https://invoice-generator.com \
  -d from="Nikolaus Ltd" \
  -d to="Acme, Corp." \
  -d logo="https://example.com/img/logo-invoice.png" \
  -d number=1 \
  -d date="Feb 9, 2015" \
  -d due_date="Feb 16, 2015" \
  -d items[0][name]="Starter plan monthly" \
  -d items[0][quantity]=1 \
  -d items[0][unit_cost]=99 \
  -d notes="Thanks for being an awesome customer!" \
  -d terms="Please pay by the due date." \
> invoice.pdf

VAT Invoice

Here's a simple cURL example for generating invoices with VAT:

curl https://invoice-generator.com \
  -d from="Nikolaus Ltd%0AVAT ID: 1234" \
  -d to="Foster Moen%0AVAT ID: 4567" \
  -d logo="https://example.com/img/logo-invoice.png" \
  -d number=1 \
  -d date="Feb 9, 2015" \
  -d payment_terms="Charged - Do Not Pay" \
  -d items[0][name]="Starter Plan Monthly" \
  -d items[0][quantity]=1 \
  -d items[0][unit_cost]=99 \
  -d tax_title="VAT" \
  -d fields[tax]="%" \
  -d tax=8 \
  -d notes="Thanks for being an awesome customer!" \
  -d terms="No need to submit payment. You will be auto-billed for this invoice." \
> invoice.vat.pdf

JSON Input

JSON input is also accepted with the Content-Type header set to application/json

curl https://invoice-generator.com \
  -H "Content-Type: application/json" \
  -d '{"from":"Nikolaus Ltd","to":"Acme, Corp.","logo":"https://example.com/img/logo-invoice.png","number":1,"items":[{"name":"Starter plan","quantity":1,"unit_cost":99}],"notes":"Thanks for your business!"}' \
> invoice.pdf

Localization

It is possible to change the localization used to generate the invoice by supplying a locale in the Accept-Language header. The default locale is en-US.

curl https://invoice-generator.com \
  -H "Accept-Language: fr-FR" \
  -d from="Nikolaus Ltd" \
  -d to="Acme Corp." \
  -d logo="https://example.com/img/logo-invoice.png" \
  -d number=1 \
  -d currency=eur \
  -d date="Feb 9, 2015" \
  -d due_date="Feb 16, 2015" \
  -d items[0][name]="Starter plan monthly" \
  -d items[0][quantity]=1 \
  -d items[0][unit_cost]=99 \
> invoice.pdf

Supported Languages

We currently have translations available in English, French, German, Spanish, and Thai.

Custom Fields

curl https://invoice-generator.com \
  -d from="Nikolaus Ltd" \
  -d to="My Customer" \
  -d ship_to="Shipping Address" \
  -d logo="https://example.com/img/logo-invoice.png" \
  -d number=1 \
  -d date="Feb 9, 2015" \
  -d custom_fields[0][name]="My Custom Field" \
  -d custom_fields[0][value]="Some Value" \
  -d items[0][name]="Starter Plan Monthly" \
  -d items[0][quantity]=1 \
  -d items[0][unit_cost]=99 \
> invoice.custom_fields.pdf

E-invoice

Here's a simple cURL example for generating e-invoices in UBL XML:

curl https://invoice-generator.com/ubl \
  -d from="Nikolaus Ltd%0AVAT ID: 1234" \
  -d to="Foster Moen%0AVAT ID: 4567" \
  -d logo="https://example.com/img/logo-invoice.png" \
  -d number=1 \
  -d date="Feb 9, 2015" \
  -d date="Mar 9, 2015" \
  -d payment_terms="NET 30" \
  -d "items[0][name]"="Starter Plan Monthly" \
  -d "items[0][quantity]"=1 \
  -d "items[0][unit_cost]"=99 \
  -d tax_title="VAT" \
  -d "fields[tax]"="%" \
  -d tax=8 \
  -d notes="Thanks for being an awesome customer!" \
> invoice.xml

Sample Projects


API Reference

Create Invoice PDF

POST https://invoice-generator.com

Invoice Parameters

When a value is null or zero, the field will not be shown on the invoice. The exception to this are the required fields from, to, date, and items.

Parameter Description Default Value
logo URL of your logo null
from Your organization billing address and contact info null
to Entity being billed - multiple lines ok null
ship_to Shipping address - multiple lines ok null
number Invoice number null
currency ISO 4217 3-digit currency code USD
custom_fields Array of objects - see Custom Fields below []
date Invoice date current date
payment_terms Payment terms summary (i.e. NET 30) null
due_date Invoice due date null
items Array of objects - see Line Items below []
fields Object - see Subtotal Lines below {"tax":"%","discounts":false,"shipping":false}
discounts Subtotal discounts - numbers only 0
tax Tax - numbers only 0
shipping Shipping - numbers only 0
amount_paid Amount paid - numbers only 0
notes Notes - any extra information not included elsewhere null
terms Terms and conditions - all the details null

Line Item Parameters

Line items are represented as an array of objects. Here's an example:

{
  "items": [
    {
      "name": "Gizmo",
      "quantity": 10,
      "unit_cost": 99.99,
      "description": "The best gizmos there are around."
    },
    {
      "name": "Gizmo v2",
      "quantity": 5,
      "unit_cost": 199.99
    }
  ]
}

Subtotal Line Parameters

The fields object toggles the discounts, tax, and shipping subtotal lines. Each setting can have a value of %, true, or false. For example to add a percent tax rate and flat shipping to your invoice you would send this:

{
  "fields": {
    "tax": "%",
    "discounts": false,
    "shipping": true
  },
  "tax": 7,
  "shipping": 15
}

Custom Field Parameters

Custom fields allow you to add additional fields to the invoice details in the top-right. Here's an example:

{
  "custom_fields": [
    {
      "name": "Gizmo",
      "value": "PO-1234"
    }
    {
      "name": "Account Number",
      "value": "CUST-456"
    }
  ]
}

Invoice Template Parameters

These parameters control the titles of the fields on the invoice template. If localization is used, the default values are translated to the specified language. Any invoice template parameter given will override the localized default.

Parameter Default Value
header INVOICE
to_title Bill To
ship_to_title Ship To
invoice_number_title #
date_title Date
payment_terms_title Payment Terms
due_date_title Due Date
purchase_order_title Purchase Order
quantity_header Quantity
item_header Item
unit_cost_header Rate
amount_header Amount
subtotal_title Subtotal
discounts_title Discounts
tax_title Tax
shipping_title Shipping
total_title Total
amount_paid_title Amount Paid
balance_title Balance
terms_title Terms
notes_title Notes

Create E-invoice

POST https://invoice-generator.com/ubl

Parameters

Creating an invoice with universal business language uses the same parameters as the Create Invoice PDF endpoint.

Support

Have a feature request or bug report? We would love to hear your thoughts! You can create an issue on GitHub for any issues you encounter or feature requests.

Using invoice-generator.com is subject to the Privacy Policy and Terms of Use.