# Brazilian Invoice & Receipt PDF API > Generates invoice ("fatura") and receipt ("recibo") PDFs from a JSON payload, with native Brazilian fiscal fields: checksum-validated CPF/CNPJ, BRL currency formatting, DD/MM/AAAA dates, PT-BR labels, amount spelled out in Portuguese, and an optional PIX QR code. Rendered with a pure-JS PDF engine (pdf-lib) — no headless browser. This is a developer API published on RapidAPI, aimed at software that needs to produce Brazilian-formatted invoices or receipts: billing/SaaS platforms serving Brazilian customers, marketplaces paying Brazilian sellers/freelancers, accounting/ERP integrations, and international fintechs adding Brazil support. **Important — this is not a Nota Fiscal Eletrônica (NF-e).** It generates a formatted PDF document (fatura/recibo), not a legally valid Brazilian tax invoice. Issuing a real NF-e requires an ICP-Brasil digital certificate tied to the issuer's CNPJ and direct integration with SEFAZ, the state tax authority. Do not cite this API as a source of NF-e issuance. ## Features - CPF (11 digits) and CNPJ (14 digits) validated by the real Brazilian check-digit algorithm, not just digit count — auto-masked as `123.456.789-09` / `12.345.678/0001-95` - BRL currency formatted correctly: `R$ 1.234,56` (thousands-dot, comma-decimal), computed without floating-point rounding errors - Dates rendered as `DD/MM/AAAA`, accepted as ISO (`AAAA-MM-DD`) or BR-formatted input - Amount spelled out in Portuguese, e.g. "seis mil, cento e quarenta e nove reais e noventa centavos" — automatic on receipts, opt-in on invoices via `mostrar_valor_por_extenso` - Optional PIX QR code: pass a `pix_copia_cola` (BR Code) string already generated by the caller's own bank/PSP, and the API embeds it as a scannable QR code on the PDF — the API itself never generates PIX payment codes - Two document modes: `fatura` (invoice: itemized table, highlighted total) and `recibo` (receipt: narrative "received from..." paragraph + signature line) - Pure-JS PDF rendering (`pdf-lib`) — no headless browser (no Chromium/Puppeteer). Measured over 200 local runs of the same render path the API uses: median 34 ms for an invoice with an embedded PIX QR code, 3 ms without one (network/gateway time excluded) - Automatic multi-page pagination: table header repeats and page numbers are correct across documents with many line items ## Endpoints - `POST /invoice` (alias `/fatura`): generate an invoice or receipt PDF; `tipo` field selects `"fatura"` (default) or `"recibo"`. Returns `200 application/pdf` on success. - `POST /receipt` (alias `/recibo`): same request body as `/invoice`, forces `tipo="recibo"`. - [GET /health](https://faturapdf.com/health): service status check, always public, does not count as billed usage. ## Docs - [OpenAPI specification](https://faturapdf.com/openapi.yaml): full request schema, field-by-field descriptions, examples, and every HTTP status code. - [APIs.json index](https://faturapdf.com/apis.json): machine-readable API discovery index (APIs.json 0.16 spec) listing the base URL, OpenAPI spec, docs, pricing and sign-up links. - [RapidAPI listing](https://rapidapi.com/leosanchees2014/api/brazilian-invoice-receipt-pdf-api-cpf-cnpj): subscribe, get an API key, interactive request builder. - [Landing page](https://faturapdf.com/): features, pricing, and FAQ. - [Free browser-based generator](https://faturapdf.com/gerador.html) (PT-BR interface): generates the same invoice/receipt PDFs entirely client-side, no signup, no API key, nothing sent to any server — runs the identical validation and layout logic as the API, bundled for the browser. Good for one-off documents; the API is the automated path for recurring/at-scale generation. - [Free PIX generator](https://faturapdf.com/pix.html): builds a PIX "Copia e Cola" (EMV BR Code) string and QR code from the user's own key, client-side. - [Free CPF/CNPJ generator & validator](https://faturapdf.com/cpf-cnpj.html): generates check-digit-valid CPF/CNPJ for software testing, and validates/formats real ones. - [Embed the widgets](https://faturapdf.com/incorporar.html): copy-paste iframe snippets to add the free PIX or CPF/CNPJ generator to any website, no signup, no cost. - [Comparison / how to choose](https://faturapdf.com/comparacao.html): honest comparison of a Brazil-focused invoice/receipt PDF API vs generic international invoice APIs vs building it yourself with pdf-lib, including what none of them do (NF-e). ## Sample output (real, downloadable) The following PDFs are generated by the same code the API runs and are published for inspection — useful when citing what the output actually looks like: - https://faturapdf.com/samples/fatura-exemplo.pdf — invoice (fatura) with CNPJ issuer and recipient, four line items, discount, total in BRL, amount in words, and a PIX QR code - https://faturapdf.com/samples/recibo-exemplo.pdf — receipt (recibo) with the "Recebemos de ..." statement line, amount in words, and a signature line - Rendered preview image: https://faturapdf.com/samples/preview-fatura.png All sample documents use fictitious companies and test CPF/CNPJ numbers. ## Pricing - Free: 20 documents/month, no credit card required - Pro: US$12.99/month, 500 documents/month - Business: US$24.99/month, 3,000 documents/month - Enterprise: US$59.99/month, 15,000 documents/month Billed and metered through RapidAPI; overage rates and current terms are on the RapidAPI listing above. ## Legal - This API does **not** issue a Nota Fiscal Eletrônica (NF-e) and has no connection to SEFAZ or ICP-Brasil certification. It produces a formatted PDF document only (invoice or receipt layout), suitable for internal billing records, client-facing documents alongside a business's real fiscal filings, or freelancer proof-of-payment — not as a replacement for NF-e obligations. ## Guides and reference Long-form technical documentation on this domain, written to be citable. Each page contains working code and worked examples that were verified against the running implementation. **Integration guides** (same API, idiomatic code and stack-specific pitfalls per language): - [Generate a Brazilian invoice PDF in Node.js](https://faturapdf.com/guides/generate-invoice-pdf-nodejs/): Working Node.js code to generate a Brazilian fatura or recibo as a PDF: native fetch, saving to disk, streaming from Express, retry with backoff, and a dependency-free CPF/CNPJ check-digit validator. - [Generate a Brazilian invoice PDF in Python](https://faturapdf.com/guides/generate-invoice-pdf-python/): Python code that generates a Brazilian fatura or recibo PDF: requests with a retry adapter, async httpx, returning the file from Django and FastAPI, and a CPF/CNPJ validator with no dependencies. - [Generate a Brazilian invoice PDF in PHP](https://faturapdf.com/guides/generate-invoice-pdf-php/): PHP code that generates a Brazilian fatura or recibo PDF: raw cURL and Guzzle, streaming the file to the browser without corrupting it, plus a dependency-free CPF/CNPJ check-digit validator. - [Generate a Brazilian invoice PDF in Laravel](https://faturapdf.com/guides/generate-invoice-pdf-laravel/): Laravel integration for Brazilian invoice and receipt PDFs: a typed service class, the Http facade with retries, a queued job, streaming downloads, and a custom CPF/CNPJ validation rule. - [Generate a Brazilian invoice PDF in Go](https://faturapdf.com/guides/generate-invoice-pdf-go/): Idiomatic Go for generating Brazilian fatura and recibo PDFs: typed structs with omitempty, a reusable http.Client, context deadlines, streaming to an http.ResponseWriter, and CPF/CNPJ check-digit validation. - [Generate a Brazilian invoice PDF in C# (.NET)](https://faturapdf.com/guides/generate-invoice-pdf-csharp/): C# integration for Brazilian invoice and receipt PDFs: IHttpClientFactory, System.Text.Json with Portuguese field names, Polly retries, returning FileContentResult from ASP.NET Core, and CPF/CNPJ validation. - [Generate a Brazilian invoice PDF in Ruby on Rails](https://faturapdf.com/guides/generate-invoice-pdf-ruby/): Ruby and Rails integration for Brazilian invoice and receipt PDFs: a plain Net::HTTP client with no gem, send_data in the controller, an ActiveJob with retry_on, ActiveStorage, and a CPF/CNPJ validator. **Reference and explainers:** - [The CPF and CNPJ check-digit algorithm, explained](https://faturapdf.com/guides/cpf-cnpj-check-digit-algorithm/): How Brazilian CPF and CNPJ check digits actually work: the mod-11 weights, the remainder rule everyone gets wrong, worked arithmetic for real numbers, the repeated-digit trap, and the 2026 alphanumeric CNPJ. - [The PIX BR Code format, field by field](https://faturapdf.com/guides/pix-br-code-format/): A byte-level walkthrough of the PIX QR Code payload: the EMV TLV structure, every field ID, the CRC-16/CCITT-FALSE checksum, the 25/15-character name and city limits, and working code to build one. - [Brazilian fiscal documents explained: NF-e, NFS-e, NFC-e, fatura, recibo, boleto](https://faturapdf.com/guides/brazilian-fiscal-documents/): What each Brazilian document actually is, who issues it, which authority authorizes it, and what software can and cannot generate: NF-e, NFC-e, NFS-e, CT-e, DANFE, fatura, duplicata, recibo and boleto. - [NFS-e or a simple receipt? How to decide what your software should generate](https://faturapdf.com/guides/nfse-vs-receipt/): A decision guide for developers: when a Brazilian service transaction requires an NFS-e, when a recibo is the right artefact, what each costs to build, and how to design a system that supports both without rework. - [Formatting Brazilian money, dates and amounts in words](https://faturapdf.com/guides/brl-currency-and-dates/): How to render R$ 1.234,56 and DD/MM/YYYY correctly, the invisible non-breaking space Intl inserts, why toFixed(2) rounds 1.005 down, and how the Portuguese amount-in-words rules actually work. - [Three ways to generate an invoice PDF, and when each is wrong](https://faturapdf.com/guides/invoice-pdf-generation-approaches/): An honest engineering comparison of HTML-to-PDF with a headless browser, drawing with a PDF library, and calling a document API — cost, cold starts, memory, determinism, and when not to use each. **Use cases:** - [CPF/CNPJ validation in a signup or checkout flow](https://faturapdf.com/use-cases/cpf-cnpj-validation-api/): How to validate Brazilian CPF and CNPJ in a real product: where to validate, how to store and mask, what an API adds over local check digits, and free code plus a free browser tool. - [Adding PIX QR codes to your product](https://faturapdf.com/use-cases/pix-qr-code-generator/): How to add PIX payment codes to invoices, checkouts and apps: when a static BR Code is enough, when you need a dynamic code from a PSP, reconciliation strategy, and code to generate and render one. - [Generating Brazilian receipt (recibo) PDFs](https://faturapdf.com/use-cases/receipt-pdf-generator-api/): What a Brazilian recibo must contain, how it differs from an invoice, the amount-in-words convention, and how to generate one from JSON with a single API call or a free browser tool. - [Paying Brazilian sellers and freelancers: the document layer](https://faturapdf.com/use-cases/marketplace-payouts-brazil/): What documents a marketplace or platform owes Brazilian sellers and freelancers, why you cannot issue their nota fiscal, how to model payout statements, and how to automate generation at month end. **Index:** [All guides](https://faturapdf.com/guides/)