ALL AI FORMS

ALL AI FORMS / Guides / PDF invoice from JSON

Generate a PDF invoice from JSON

Turn structured billing information into an invoice or price quote without manually formatting a document. The live tool is invoice_quote_pdf on the All AI Data API.

Who it is for: developers, contractors, small businesses and AI agents that already have line items in JSON.

What it does

Send an invoice number, line items (quantities and unit prices), and optional tax, discounts, shipping and amount paid. All math is done server-side in integer cents and returned as JSON next to a PDF and a Word file. Set format to pdf, docx or both (the default is both). An optional expected_total is checked; if it does not match the computed total to the cent, the call fails and is not charged.

How to run it

  1. Connect your MCP client to https://allai-api.allaihq.workers.dev/mcp, or call the REST route below.
  2. Select invoice_quote_pdf.
  3. Supply the invoice number, line items, quantities, unit prices and taxes. The required field is items. Optional fields include kind (invoice or quote), number, seller, buyer, tax_rate, expected_total and format.
  4. Retrieve the files and the structured totals, and review them before you send the document to anyone.

The call below is an invoice for three units at $125 each with no sales tax. The computed subtotal is $375, and expected_total is set to 375 so a mismatch fails free.

Price

20 credits ($0.02) per successful call. 1 credit = $0.001. Failed or empty calls are free. Credits come in one-time packs, with no subscription. The Starter pack is $0.99 for 1,200 credits (60 invoices).

Review pricing and trial availability before a paid request. Keyless callers get 3 free trial calls per network per UTC day, shared across paid tools. Trial documents are marked PREVIEW. After you buy a pack, copy the API key shown after payment and send Authorization: Bearer <api_key>.

Buy the $0.99 Starter packAll AI Data API docsAll guides

Unused Data API credits are refundable within 30 days of purchase, as stated in the All AI Data API terms.

Call it with curl

No key is required for a trial call:

curl -s -X POST https://allai-api.allaihq.workers.dev/v1/tools/invoice_quote_pdf \
  -H 'content-type: application/json' \
  -d '{"kind": "invoice", "number": "INV-1001", "seller": {"name": "Example Co"}, "buyer": {"name": "Fictional Customer LLC"}, "items": [{"description": "Consulting hours", "quantity": 3, "unit_price": 125}], "tax_rate": 0, "expected_total": 375, "format": "both"}'

After you buy, add -H 'Authorization: Bearer <api_key>'.

Call it from an MCP client

Client config:

claude mcp add --transport http allai-api https://allai-api.allaihq.workers.dev/mcp

Cursor or VS Code (.mcp.json or mcp.json):
{
  "mcpServers": {
    "allai-api": {
      "type": "http",
      "url": "https://allai-api.allaihq.workers.dev/mcp"
    }
  }
}

Then call the tool. This is a tools/call you can also POST to the MCP endpoint:

curl -s -X POST https://allai-api.allaihq.workers.dev/mcp \
  -H 'content-type: application/json' \
  -H 'accept: application/json, text/event-stream' \
  -d '{"jsonrpc": "2.0", "id": 1, "method": "tools/call", "params": {"name": "invoice_quote_pdf", "arguments": {"kind": "invoice", "number": "INV-1001", "seller": {"name": "Example Co"}, "buyer": {"name": "Fictional Customer LLC"}, "items": [{"description": "Consulting hours", "quantity": 3, "unit_price": 125}], "tax_rate": 0, "expected_total": 375, "format": "both"}}}'

Live schema: https://allai-api.allaihq.workers.dev/v1/tools. Prices: https://allai-api.allaihq.workers.dev/pricing. Terms: https://allai-api.allaihq.workers.dev/terms. Contact ops@allaiforms.com.