ForHosting KIT · Documents & PDF

Generate an invoice document with calculated totals

Turn basic billing data into a consistent, structured invoice document without building calculation rules into every application.

● BetaFree · in your browser
Use it from WebAPIEmailTelegramApp soon

Provide the seller, buyer, line items, quantities, unit prices, and a percentage tax rate. The generator calculates each line total, subtotal, tax amount, and grand total, then returns the source details and calculated values in a predictable document object that can be stored, reviewed, rendered, or passed to another workflow.

Prepare complete invoice inputs

Start with the two parties to the transaction. The seller and buyer fields accept names together with any address, registration, or contact details your downstream process needs to preserve. Next, add at least one line item. Every row requires a clear description, a numeric quantity, and a numeric unit price. The tax rate is expressed as a percentage, so enter 8.25 for an 8.25 percent rate rather than 0.0825. Quantities may be fractional for work measured in hours, weight, distance, or another divisible unit. Unit prices may also contain decimals. Negative quantities and negative prices are rejected because they usually indicate a malformed invoice or an attempted credit adjustment that should be represented by a dedicated credit-note workflow. Use zero only when a genuinely free line belongs on the invoice. Keeping descriptions specific helps people reconcile the finished document with purchase orders, delivery records, and contracts. The request contains no date or generated identifier, so repeated calls with identical input always produce identical output.

Understand every calculated amount

For each row, the generator multiplies quantity by unit price and rounds the resulting line total to two decimal places. It then adds those rounded line totals to produce the subtotal. Tax is calculated by multiplying that subtotal by the supplied percentage tax rate and is also rounded to two decimals. Finally, the rounded tax amount is added to the subtotal to obtain the grand total. This order is explicit and deterministic, which matters because accounting systems can differ when they round at another stage. The output keeps each submitted description and quantity, presents unit prices as monetary values, and adds a line_total field to every row. At document level it includes subtotal, tax_rate, tax, and grand_total, alongside the seller and buyer. There is no currency conversion or currency inference: all prices must already use one consistent currency chosen by the caller. The structured response is intended as a calculation and document-data record, ready for a renderer, database, approval step, or API integration rather than as a PDF or an image.

Integrate safely into a billing workflow

Use this capability at the boundary where editable order data becomes an invoice record. Validate the business context first: confirm the parties, currency, applicable tax jurisdiction, and whether the transaction needs discounts, withholding, multiple tax bands, or credit adjustments. Then submit the normalized rows and store the returned document object as the calculation result. Because the algorithm uses no network, random values, clock, or hidden state, the same request can be retried safely and compared during audits. Errors are returned for missing required fields, nonnumeric amounts, empty item lists, excessive item counts, negative tax rates, and especially negative line-item quantities or prices. Handle those errors before assigning an invoice number or sending anything to a customer. The result can feed an HTML template, accounting import, email attachment generator, or approval queue, but those delivery actions remain separate. This separation keeps arithmetic testable and avoids silently changing totals during presentation. API requests cost $0.002; the browser implementation uses the same pure calculation logic so interactive checks and automated calls agree on the resulting totals.

Create invoices from approved orders

Convert normalized order rows into a structured invoice record with consistent line, tax, and document totals.

Power an invoice form

Calculate totals as users enter seller, buyer, item, and tax information, then pass the result to a renderer.

Standardize billing integrations

Give multiple applications one deterministic calculation contract before records enter accounting or approval systems.

What does a request cost?

Each API request costs $0.002.

How should I provide the tax rate?

Provide a percentage number. For example, use 8.25 to apply a tax rate of 8.25 percent.

How are monetary values rounded?

Each line total is rounded to two decimals, those line totals form the subtotal, and tax is then calculated and rounded to two decimals.

Can I use negative quantities or prices for credits?

No. Any negative line-item quantity or unit price produces an invalid-input error. Use a dedicated credit-note process instead.

Does the result include a PDF or invoice number?

No. It returns a structured invoice document with calculated totals. Rendering, numbering, currency labeling, and delivery are separate workflow steps.

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.

POSThttps://api.kit.forhosting.com/doc/invoice-generate

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, by email and from Telegram — and soon from our app too.

curl -X POST https://api.kit.forhosting.com/doc/invoice-generate \
  -H "Authorization: Bearer $KIT_KEY" \
  -H "Content-Type: application/json" \
  -d '{"seller":"Northwind Studio","buyer":"Contoso Retail","line_items":[{"description":"Design consultation","quantity":2,"unit_price":125},{"description":"Style guide","quantity":1,"unit_price":80.5}],"tax_rate":8.25}'
{
  "seller": "Northwind Studio",
  "buyer": "Contoso Retail",
  "line_items": [
    {
      "description": "Design consultation",
      "quantity": 2,
      "unit_price": 125
    },
    {
      "description": "Style guide",
      "quantity": 1,
      "unit_price": 80.5
    }
  ],
  "tax_rate": 8.25
}
{
  "task_id": "tsk_a1b2c3d4e5f6a1b2c3d4e5f6",
  "type": "doc.invoice_generate",
  "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.

Per request$0.002

Published price — no tokens, no invented credits. A failed task is never charged.

max_mb25
max_pages200
HTTPCodeMeaning
401unauthorizedMissing or invalid API key.
402insufficient_balanceYour balance doesn't cover the task price.
404unknown_typeThat task type doesn't exist.
429rate_limitedToo many requests. Use the webhook instead of polling.

Read the full KIT documentation →