{"uid":"cap_ZUkrLDJsZL8jcrjiA_UC6","slug":"stackbill-invoice-pdf-generator-9c34ee6a","name":"StackBill Invoice PDF Generator","description":"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.","url":"https://stackbill.app/routes/x402/invoice-from-data","method":"POST","headers":{},"bodySchema":{"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"}}},"responseSchema":null,"example":null,"exampleRequest":null,"tags":["x402"],"displayCostAmount":"0.1","displayCostAsset":"USDC","priceDynamic":false,"priceHint":null,"priceStatus":"priced","priceSource":"probe","requiresHandshake":false,"reviewCount":0,"rating":{"score":"0.00","successRate":"0.00","reviews":0,"stars":null,"state":"unrated"},"availabilityStatus":"unknown","priceObserved":null,"sessionDeposit":null,"pricing":{"kind":"static","summary":"$0.1/call","primary":{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.1","per":"call","confidence":"exact"},"accepted":[{"kind":"static","protocol":"x402","network":"base","amountUsd":"0.1","per":"call","confidence":"exact"}]},"paymentMethods":[{"uid":"pm_2DFzRAZyA3Rg7Op8gkBPQ","protocol":"x402","methodType":"crypto","chain":"base","mode":"charge","costAmount":"0.1","costPer":"request","priority":0,"asset":"0x833589fCD6eDb6E08f4c7C32D4f71b54bdA02913","unit":"request","depositMicros":null,"planRef":null}],"brandName":null,"brandSlug":null,"brandBaseUrl":null,"brandDocsUrl":null,"whatItDoes":"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.","exampleAgentPrompt":"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.","exampleUseCases":[{"title":"Freelance consultant billing a client","prompt":"Create an invoice PDF for my client TechStart Inc at 789 Silicon Blvd — I did 15 hours of UX design at $120/hour and 3 hours of revisions at $90/hour. Apply 7% tax, due date is 2025-08-15, and I'm billing as Nova Design Studio at 22 Elm Street. Use the standard layout."},{"title":"Law firm generating a legal billing statement","prompt":"Generate a legal-template billing statement PDF for Smith & Partners LLC at 100 Court St. Line items: 'Work session on 2025-07-10: Initial consultation' for 2 hours at $300/hour and 'Work session on 2025-07-14: Contract review' for 4 hours at $300/hour. No tax, due 2025-07-31. Sender is Carter Legal Group at 55 Law Plaza."},{"title":"Agency creating a creative-layout service invoice","prompt":"Make a creative-layout invoice for my client Bloom Bakery at 9 Sweet Lane — services are 'Brand Strategy: Full identity package' for 1 unit at $1,500 and 'Social Media: Monthly content plan' for 1 unit at $800. Add a note that says 'Thank you for your business!' and apply 6% tax. I'm sending this as Pixel & Co, 77 Studio Row."}],"resultDescription":"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.","failureModes":["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"],"whenToPreferThis":"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.","instructions":null,"reviewSummary":null,"reviewSummaryHighlights":null,"reviewSummaryConcerns":null,"reviewSummaryGeneratedAt":null,"activationCount":0,"lastUsedAt":null,"lastSuccessfullyRanAt":null,"lastHealthCheckAt":"2026-09-13T18:33:01.091Z","isFirstParty":false}