# StackBill Invoice PDF Generator

> StackBill Invoice PDF Generator is a paid API for AI agents from stackbill.app, paid per call via x402, $0.1/call, status unknown (last checked 2026-09-13).

Generates a professional invoice PDF from JSON recipient and line-item data, with server-side tax and total computation, in standard, legal, or creative layouts.

## Facts

- Endpoint: POST https://stackbill.app/routes/x402/invoice-from-data
- Price: $0.1/call
- Payment: x402
- Status: unknown
- Last checked: 2026-09-13
- Activations on Zero: 0
- Tags: x402
- Canonical page: https://www.zero.xyz/c/stackbill-invoice-pdf-generator-9c34ee6a
- Structured record (JSON): https://api.zero.xyz/v1/capabilities/cap_ZUkrLDJsZL8jcrjiA_UC6

Status and success rate cover calls made through Zero and Zero's own probes. Third-party monitors may report differently.

## How to call it through Zero

Zero handles the 402 payment challenge and records the run. With the Zero CLI installed (`npm i -g @zeroxyz/cli`):

```sh
zero fetch --capability stackbill-invoice-pdf-generator-9c34ee6a -d '<json body>'
```

Example prompt: Generate a professional invoice PDF billing Acme Corp at 123 Main St for 10 hours of consulting at $150/hour and a $200 setup fee, with 8.5% tax due on 2025-08-01, using the standard layout — sender is my company Bright Labs at 456 Oak Ave.

## When to prefer this

Choose this endpoint when you need a server-rendered, print-ready PDF invoice with automatic tax and total computation — not just a data record. Ideal for agents that must deliver a ready-to-send document to a client, especially when you want sequential invoice numbering across calls (via wallet profile) or a choice of professional layouts (standard, legal with date columns, or creative service-fee layout). Prefer over client-side PDF libraries when accuracy of arithmetic and consistent formatting are required without local rendering dependencies.

## Known failure modes

- Missing required fields (recipient or lineItems) returns a 400 validation error
- Currency set to anything other than USD returns an error (v1 is USD-only)
- Invalid date format for dueDate or line item work-session dates causes rendering issues
- Payment failure via x402 protocol prevents PDF generation
- Providing an invalid X-StackApps-Token may prevent sequential numbering or letterhead retrieval
- Empty lineItems array or zero-quantity items rejected by schema validation

## How this service works

Generate a finished, professional invoice PDF from JSON — recipient and line items in, a ready-to-send application/pdf out. Layouts: standard, legal, creative. Totals and tax are computed server-side so the numbers always add up. First payment auto-creates a wallet profile (token + API key in response headers); returning wallets get sequential invoice numbering and can save a sender letterhead. USD only.

## Output

Returns a binary application/pdf file containing the finished invoice, with server-computed line totals, subtotal, tax amount, and grand total. On the first paid call, response headers include an X-StackApps-Token and API key to activate a wallet profile for sequential invoice numbering and saved sender letterhead on future calls.

## Request schema (JSON Schema)

```json
{
 "type": "object",
 "properties": {
  "notes": {
   "type": "string",
   "description": "Optional notes printed at the bottom of the invoice"
  },
  "sender": {
   "type": "object",
   "required": [
    "name",
    "address"
   ],
   "properties": {
    "name": {
     "type": "string"
    },
    "address": {
     "type": "string"
    }
   },
   "description": "Who the invoice is from. Optional for activated wallet profiles (send X-StackApps-Token) — the profile's saved name and address are used"
  },
  "dueDate": {
   "type": "string",
   "description": "Optional due date, YYYY-MM-DD"
  },
  "taxRate": {
   "type": "number",
   "minimum": 0,
   "description": "Optional tax percent applied to the subtotal (e.g. 7.5)"
  },
  "currency": {
   "type": "string",
   "description": "Optional; must be \"USD\" if present (v1 renders USD only)"
  },
  "template": {
   "enum": [
    "standard",
    "legal",
    "creative"
   ],
   "type": "string",
   "description": "Optional PDF layout (default standard): legal = billing statement with a per-line Date column (populated when descriptions start with 'Work session on YYYY-MM-DD: '); creative = service/fee layout without hours-rate columns (service name taken from the text before ': ' in each description)"
  },
  "lineItems": {
   "type": "array",
   "items": {
    "type": "object",
    "required": [
     "description",
     "quantity",
     "unitPrice"
    ],
    "properties": {
     "quantity": {
      "type": "number",
      "exclusiveMinimum": 0
     },
     "unitPrice": {
      "type": "number",
      "minimum": 0
     },
     "description": {
      "type": "string"
     }
    }
   },
   "description": "At least one line item; amount per line, subtotal, tax and total are computed server-side"
  },
  "recipient": {
   "type": "object",
   "required": [
    "name",
    "address"
   ],
   "properties": {
    "name": {
     "type": "string"
    },
    "address": {
     "type": "string"
    }
   },
   "description": "Who the invoice is billed to"
  },
  "invoiceNumber": {
   "type": "string",
   "description": "Invoice number printed on the PDF. Optional when the request carries an X-StackApps-Token header from a previous paid call — the next sequential number for that wallet is used and returned in the X-Invoice-Number response header"
  }
 }
}
```

## More

- Live health (JSON, refreshed every minute): https://www.zero.xyz/c/stackbill-invoice-pdf-generator-9c34ee6a/health.json
- [Zero catalog index](https://www.zero.xyz/llms.txt)
- [Other services from stackbill.app](https://www.zero.xyz/host/stackbill.app/llms.txt)
