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.
- Creating invoices for VAT compliance
- Generate a PDF of an invoice that you have the details to (recipient, line items, etc)
- Produce invoices for B2B buyers from an order or receipt
- Selling products or services on credit terms
- Creating e-invoices in UBL (Universal Business Language)
In order to begin using the Invoice-Generator.com API, you first need to create an API key. The process for obtaining an API key is as follows.
- Create a free Invoice-Generator.com account here, or sign in if you already have one.
- Go to the Settings page.
- In the "API Keys" section, click New API Key.
Now you have an API key and are ready to start invoicing!
curl https://invoice-generator.com \
-H "Authorization: Bearer myApiKey" \
-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
Here's a simple cURL example for generating invoices with VAT:
curl https://invoice-generator.com \
-H "Authorization: Bearer myApiKey" \
-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 is also accepted with the Content-Type
header set to application/json
curl https://invoice-generator.com \
-H "Authorization: Bearer myApiKey" \
-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
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 "Authorization: Bearer myApiKey" \
-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
We currently have translations available in English, French, German, Spanish, and Thai.