Brazilian invoicing, for developers
Everything we had to learn to build this API, written down properly: the check-digit maths, the PIX payload format, the currency and date conventions, the difference between the documents Brazilian law recognizes — and working integration code for seven stacks.
Every page here is written to be useful on its own, whether or not you ever call the API. The algorithms are the real ones — the same code paths that run in production — and the worked examples were verified against the implementation, not written from memory.
Integration guides
The same API, once per stack. Each one covers the request shape, error handling, streaming the PDF
back from a web framework, retry strategy, and a section on the traps specific to that language —
Python's .text versus .content, PHP's stray closing tag, .NET's socket
exhaustion, Go's omitempty. Each also ships a dependency-free CPF/CNPJ validator in that
language.
Generate a Brazilian invoice PDF in Node.js
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 dep…
IntegrationGenerate a Brazilian invoice PDF in 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 …
IntegrationGenerate a Brazilian invoice PDF in 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-f…
IntegrationGenerate a Brazilian invoice PDF in 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 c…
IntegrationGenerate a Brazilian invoice PDF in Go
Idiomatic Go for generating Brazilian fatura and recibo PDFs: typed structs with omitempty, a reusable http.Client, context deadlines, streaming to an http…
IntegrationGenerate a Brazilian invoice PDF in C# (.NET)
C# integration for Brazilian invoice and receipt PDFs: IHttpClientFactory, System.Text.Json with Portuguese field names, Polly retries, returning FileConte…
IntegrationGenerate a Brazilian invoice PDF in Ruby on Rails
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 ret…
Reference & explainers
The domain knowledge. If you are building Brazilian billing software, these are the things that are not obvious from outside and each one is a small bug waiting to happen.
The CPF and CNPJ check-digit algorithm, explained
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 …
ReferenceThe PIX BR Code format, field by field
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 c…
ReferenceBrazilian fiscal documents explained: NF-e, NFS-e, NFC-e, fatura, recibo, boleto
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…
ReferenceNFS-e or a simple receipt? How to decide what your software should generate
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…
ReferenceFormatting Brazilian money, dates and amounts in words
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…
ReferenceThree ways to generate an invoice PDF, and when each is wrong
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…
Use cases
Problem-first: what to build for a given situation, including the two cases where the honest answer is "you do not need this API for that".
CPF/CNPJ validation in a signup or checkout flow
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…
Use caseAdding PIX QR codes to your product
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 stra…
Use caseGenerating Brazilian receipt (recibo) PDFs
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 c…
Use casePaying Brazilian sellers and freelancers: the document layer
What documents a marketplace or platform owes Brazilian sellers and freelancers, why you cannot issue their nota fiscal, how to model payout statements, an…
Free tools, no signup
Client-side utilities that run entirely in your browser — nothing is sent to any server, which also makes them safe to paste real data into while debugging.
Invoice & receipt PDF generator
Generates the same fatura and recibo layouts as the API, entirely in the browser.
ToolCPF/CNPJ generator & validator
Validates real numbers by check digit and generates synthetic valid ones for test fixtures.
ToolPIX code & QR generator
Builds a BR Code "Copia e Cola" string from your own PIX key and renders the QR.
SpecOpenAPI specification
The full request/response contract — point a code generator at it if you prefer a typed client.
Generate Brazilian invoices and receipts from your own code
POST a JSON payload, get a ready-to-send PDF: checksum-validated CPF/CNPJ, R$ 1.234,56 currency, DD/MM/YYYY dates, amount in words, optional PIX QR. Free tier: 20 documents/month, no credit card.
Get an API key on RapidAPI → See what the PDF looks like