Create an invoice PDF
The Invoice PDF Generator API turns a JSON payload — line items, tax, totals, your branding — into a finished invoice PDF, ready to send or file the moment an order closes. It exists so billing a customer never depends on someone opening a template and typing numbers in by hand.
Run it online
Run this on our servers with your account. Free tools run in your browser; this one bills your KIT balance per the price above.
Invoicing as a byproduct of software, not a chore
Every sale, subscription renewal, or completed order eventually needs a document a customer can open, check, and keep for their own accounting — but the data behind it already lives in your system the instant the transaction happens. The invoice pdf generator api is built for that gap: you already know the line items, the tax, the totals; this endpoint turns that data into the document your customer actually expects, without a person ever touching an invoicing tool.
What goes into the request
You send structured JSON describing the invoice — issuer and recipient details, line items with quantities and unit prices, applicable tax, due date, and your branding elements such as logo and color accents — and the service lays it out as a properly formatted, itemized PDF. Totals are computed and presented the way an accountant expects to see them: subtotal, tax breakdown, and grand total clearly separated, so the document reads as a real invoice rather than a spreadsheet dump.
How generation and delivery work
Call POST /pdf/invoice with your payload and you receive a task_id immediately, without waiting on an open connection. The PDF is built asynchronously on our global edge, and once it's ready you're notified by a signed webhook — the natural fit for billing systems that need to attach the invoice to an email or a customer portal automatically — or by a signed link valid for 24 hours when a person just needs to fetch one document.
Where it slots into billing automation
This is designed to run unattended: a subscription platform generating one invoice per renewal, a marketplace producing a seller-branded invoice per completed order, an accounting system batching end-of-month invoices for every open account. Because each call returns a task_id and confirms delivery by webhook, invoice generation becomes one step triggered by the transaction itself — the same moment payment is captured or an order is confirmed — rather than a separate task on someone's to-do list.
Transparent pricing and safe handling
Billing is $0.040 per request plus $0.001 per document, a published rate with no tokens and no invented credits. A task that fails is never charged; we retry three times before returning a clear error instead of a silent failure. Access requires prepaid balance — there is no free tier or trial — which is what keeps the service fast and free of abuse; requests without balance return 402. Invoice data is deleted after the retention window and never used to train anything.
What you can do with it
Subscription renewal billing
A SaaS platform generates a branded invoice PDF the instant a subscription renews and attaches it automatically to the confirmation email.
Marketplace seller invoices
A marketplace produces a seller-branded invoice for every completed order so each vendor's customers receive paperwork that looks like it came from that specific seller.
End-of-month batch invoicing
An accounting system generates invoices for every open account at month close, running the batch as a single automated job instead of one document at a time.
Custom quotes turned into invoices
A B2B ordering tool converts an approved quote into a formal invoice PDF the moment the customer confirms, with the same line items and totals carried over exactly.
FAQ
How do I generate an invoice PDF with an API?
Send JSON with line items, totals, and branding to POST /pdf/invoice and you get a task_id back. The invoice pdf generator api builds the document asynchronously and delivers it by signed webhook or a signed link valid for 24 hours.
Is this API free to use?
There's no free tier — free tiers get abused and slow everyone down. Access runs on a prepaid ForHosting KIT balance: top up from $10.00 (it never expires) and each request is charged at its published price, so a call with no balance returns HTTP 402. No subscription, no tokens, no invented credits, and a failed task is never charged.
Can I add my own logo and branding?
Yes. The request accepts your logo and branding elements such as color accents, so the generated invoice looks like it came from your business, not a generic template.
Does it calculate tax and totals automatically?
Yes. You send line items and the applicable tax rate, and the service computes the subtotal, tax breakdown, and grand total, presenting them the way a formal invoice is expected to read.
Can I generate invoices in bulk, for example at month end?
Yes. Because the endpoint is asynchronous and returns a task_id per request, you can generate a full batch of invoices in parallel from a billing run or cron job.
What happens if invoice generation fails?
A failed task is never charged. We retry three times with backoff, and if the document still cannot be built you get a clear error instead of a silent failure or a charge.
Is the output a legally valid invoice?
The API produces a correctly formatted, itemized PDF from the data you provide; whether it meets a specific jurisdiction's legal requirements depends on the fields and tax details you include, which remain your responsibility.
How long can I access the generated invoice?
The signed link stays valid for 24 hours, or you can receive the PDF immediately by signed webhook. After the retention window it's deleted and never used for training.
For developers — API access
Everything on this page is available programmatically. This section is for teams who want to wire it into their own systems; everyone else can just use the tool above.
API endpoint
Prefer to automate it? One authenticated POST creates the task; the result comes back by webhook or a signed link. The same capability also runs here on the web, and soon from our app, email and Telegram.
Call it from your stack
curl -X POST https://api.kit.forhosting.com/pdf/invoice \
-H "Authorization: Bearer $KIT_KEY" \
-H "Content-Type: application/json" \
-d '{"pdf":"https://ejemplo.com/documento.pdf"}'const res = await fetch("https://api.kit.forhosting.com/pdf/invoice", {
method: "POST",
headers: {
"Authorization": `Bearer ${process.env.KIT_KEY}`,
"Content-Type": "application/json"
},
body: JSON.stringify({
"pdf": "https://ejemplo.com/documento.pdf"
})
});
const { task_id } = await res.json();import os, requests
res = requests.post(
"https://api.kit.forhosting.com/pdf/invoice",
headers={"Authorization": f"Bearer {os.environ['KIT_KEY']}"},
json={
"pdf": "https://ejemplo.com/documento.pdf"
},
)
task_id = res.json()["task_id"]<?php
$res = file_get_contents("https://api.kit.forhosting.com/pdf/invoice", false, stream_context_create([
"http" => [
"method" => "POST",
"header" => "Authorization: Bearer " . getenv("KIT_KEY") . "\r\nContent-Type: application/json",
"content" => '{"pdf":"https://ejemplo.com/documento.pdf"}',
],
]));
$task = json_decode($res, true);body := bytes.NewBufferString(`{"pdf":"https://ejemplo.com/documento.pdf"}`)
req, _ := http.NewRequest("POST", "https://api.kit.forhosting.com/pdf/invoice", body)
req.Header.Set("Authorization", "Bearer "+os.Getenv("KIT_KEY"))
req.Header.Set("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)Example request
{
"pdf": "https://ejemplo.com/documento.pdf"
}Example response
{
"task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
"type": "pdf.invoice",
"status": "queued",
"_links": {
"result": "/tasks/tsk_…/result"
}
}The API is asynchronous: the call returns a task_id immediately and the result arrives by webhook. Polling is capped at 1 req/s per task.
Pricing
Published price — no tokens, no invented credits. A failed task is never charged.
Limits
max_mb | 25 |
max_pages | 200 |
Errors
| HTTP | Code | Meaning |
|---|---|---|
401 | unauthorized | Missing or invalid API key. |
402 | insufficient_balance | Your balance doesn't cover the task price. |
404 | unknown_type | That task type doesn't exist. |
429 | rate_limited | Too many requests. Use the webhook instead of polling. |
422 | task_failed | The task failed after 3 retries. You are never charged for it. |