Brazilian invoices & receipts as PDF, in one API call
POST your issuer, customer and line items — get back a ready-to-send PDF with the fiscal details Brazil actually expects: checksum-validated CPF/CNPJ, R$ 1.234,56 currency, DD/MM/YYYY dates, amount in words, and an optional PIX QR code.
Two endpoints: POST /invoice · POST /receipt. No signup here — billing runs through RapidAPI.
- Real check-digit validation
- No account on this site
- No headless Chrome
- Not an NF-e — read why
Real API output — not a mockup
Latency measured over 200 local runs of the exact render path the API uses (median 34 ms with an embedded PIX QR code, 3 ms without). Network and gateway time are not included — we publish what we measured, not a marketing number.
This is the PDF that comes back
Rendered by the same code the API runs, from the request body shown further down. Download the file and open it yourself — nothing here is a mockup.
First page of fatura-exemplo.pdf, rasterised at 150 dpi. The page continues below the fade with the standard footer.
- 1
CPF/CNPJ validated, then masked
The check digits are verified before rendering. Valid documents come out as
11.222.333/0001-81or123.456.789-09; invalid ones never reach the PDF. - 2
BRL amounts, computed in cents
Quantity × unit price, subtotals and discounts are added up in integer cents, then printed as
R$ 3.000,00— no floating-point drift. - 3
Highlighted total block
The layout Brazilian customers expect: line items, subtotal, discount, and a boxed TOTAL that stands out when the document is printed or forwarded.
- 4
Amount in words, in Portuguese
"(três mil, setecentos e trinta e nove reais e noventa centavos)" — generated from the total. Automatic on receipts, opt-in on invoices.
- 5
PIX QR code, actually scannable
Pass the "copia e cola" BR Code your bank or PSP already issued and it is encoded into a real QR on the page. Try it with your phone on the PDF below.
The recibo variant swaps the invoice layout for the receipt one: a "Recebemos de …" statement line, amount in words by default, and a signature line with the issuer's name and CNPJ/CPF.
JSON in, PDF out — four steps, no queue
Synchronous request/response. There is nothing to poll, no webhook to wire up, and no file to fetch afterwards.
You POST JSON
Issuer, recipient, line items — plus optional discount, due date, payment method, notes and a PIX BR Code.
Validate
CPF/CNPJ check digits, field lengths, item maths and totals. Bad input fails fast with 400 and a stable error code.
Render
Layout drawn with pdf-lib in pure JavaScript — text wrapping, table pagination and the QR bitmap, all in-process.
You get the bytes
200 application/pdf in the same response. Stream it to the user, attach it to an email, or drop it in your bucket.
Errors are boring on purpose. A rejected document returns 400 application/json with a machine-readable error code and a human message — never a stack trace, never a half-rendered PDF.
One HTTP call — copy, paste, ship
Same request in three languages. Swap in your RapidAPI key and you have a working invoice endpoint in about a minute.
curl -X POST "https://brazilian-invoice-receipt-pdf-api-cpf-cnpj.p.rapidapi.com/invoice" \
-H "content-type: application/json" \
-H "X-RapidAPI-Key: YOUR_RAPIDAPI_KEY" \
-H "X-RapidAPI-Host: brazilian-invoice-receipt-pdf-api-cpf-cnpj.p.rapidapi.com" \
-d '{
"tipo": "fatura",
"numero": "0142/2026",
"vencimento": "2026-08-18",
"emitente": { "nome": "Atlas Soluções Digitais LTDA", "documento": "11.222.333/0001-81" },
"destinatario": { "nome": "Comércio Silva & Filhos ME", "documento": "22.333.444/0001-81" },
"itens": [
{ "descricao": "Consultoria", "quantidade": 12, "valor_unitario": 250 }
],
"desconto": 150,
"mostrar_valor_por_extenso": true,
"forma_pagamento": "PIX",
"pix_copia_cola": "00020126580014BR.GOV.BCB.PIX..."
}' \
-o fatura.pdf
const res = await fetch(
"https://brazilian-invoice-receipt-pdf-api-cpf-cnpj.p.rapidapi.com/invoice",
{
method: "POST",
headers: {
"content-type": "application/json",
"X-RapidAPI-Key": process.env.RAPIDAPI_KEY,
"X-RapidAPI-Host": "brazilian-invoice-receipt-pdf-api-cpf-cnpj.p.rapidapi.com"
},
body: JSON.stringify({
tipo: "fatura",
numero: "0142/2026",
emitente: { nome: "Atlas Soluções Digitais LTDA", documento: "11.222.333/0001-81" },
destinatario: { nome: "Comércio Silva & Filhos ME", documento: "22.333.444/0001-81" },
itens: [{ descricao: "Consultoria", quantidade: 12, valor_unitario: 250 }],
forma_pagamento: "PIX"
})
}
);
// res.ok === true → the body IS the PDF
const pdf = Buffer.from(await res.arrayBuffer());
await fs.promises.writeFile("fatura.pdf", pdf);
import requests
url = "https://brazilian-invoice-receipt-pdf-api-cpf-cnpj.p.rapidapi.com/invoice"
payload = {
"tipo": "fatura",
"numero": "0142/2026",
"emitente": {"nome": "Atlas Soluções Digitais LTDA", "documento": "11.222.333/0001-81"},
"destinatario": {"nome": "Comércio Silva & Filhos ME", "documento": "22.333.444/0001-81"},
"itens": [{"descricao": "Consultoria", "quantidade": 12, "valor_unitario": 250}],
"forma_pagamento": "PIX",
}
r = requests.post(url, json=payload, headers={
"X-RapidAPI-Key": os.environ["RAPIDAPI_KEY"],
"X-RapidAPI-Host": "brazilian-invoice-receipt-pdf-api-cpf-cnpj.p.rapidapi.com",
})
r.raise_for_status()
with open("fatura.pdf", "wb") as f: # r.content is the PDF
f.write(r.content)
What you get back
No envelope, no base64, no second request — the response body is the file.
{ error, message }Full request schema, every field and every status code live in the RapidAPI listing, and the machine-readable spec is at /openapi.yaml.
Prefer to see it working before you take a key? The free browser generator runs the same layout engine locally, in your tab.
The details a generic invoice API gets wrong
Every field a Brazilian invoice or receipt actually needs — checked, formatted and laid out correctly by default, not by configuration.
Real CPF/CNPJ validation
Both document types are checked with the actual check-digit algorithm — not a digit count — then auto-masked to 123.456.789-09 / 12.345.678/0001-95.
Correct BRL formatting
R$ 1.234,56 — dot for thousands, comma for decimals — with totals summed in integer cents so rounding never drifts a centavo.
DD/MM/YYYY dates
Accepts ISO or Brazilian input and always prints the format every local document uses — issue date and due date included.
Amount in words (PT-BR)
"seis mil, cento e quarenta e nove reais e noventa centavos" — the norm on formal Brazilian receipts. Automatic on recibo, opt-in on fatura.
Optional PIX QR code
Send the "copia e cola" BR Code your own bank or PSP issued and the API embeds it as a scannable QR block on the document.
No headless browser
Pure-JS engine (pdf-lib): no Chromium to install, no cold start to pay for, no 200 MB layer — it runs fine on any serverless runtime.
Free tools, no key required
Same validation and layout code as the API, running entirely in your browser. Nothing is uploaded. (These tool pages are written in Portuguese, for Brazilian users.)
Invoice / receipt generator
Fill a form, get the same PDF this API returns.
Open generator →CPF/CNPJ validator
Check digits verified instantly, with the mask applied.
Validate a document →PIX QR reader/builder
Decode or preview a BR Code before you put it on a document.
Open PIX tool →Embeddable widgets
Drop the validator or PIX tool into your own page with one iframe.
Get the embed code →Guides & reference
Everything we had to learn to build this, written down properly — free to read, useful whether or not you ever call the API. Integration code for seven stacks, plus the Brazilian domain rules that are not obvious from outside.
CPF/CNPJ check-digit algorithm
The mod-11 weights, the remainder rule everyone gets wrong, worked arithmetic, and the 2026 alphanumeric CNPJ.
Read the reference →PIX BR Code format, field by field
A real payload dissected: every EMV TLV field, the CRC-16, and code to build and parse one.
Read the reference →NF-e, NFS-e, fatura, recibo
Which document each is, who authorizes it, and which ones software can legitimately produce.
Read the explainer →Integration guides by language
Node.js, Python, PHP, Laravel, Go, C#/.NET and Ruby on Rails — working code and stack-specific traps.
Browse all guides →Pay per plan, metered by RapidAPI
Start on the free tier without a credit card. Billing, keys and usage limits are handled by RapidAPI — this site never sees your payment details.
- PIX QR embedding
- Multi-page item tables
- Fits a small SaaS billing run
- Monthly billing cycles at scale
- Marketplace payouts & receipts
- High-volume batch generation
- Lowest cost per document
Per-document figures are the plan price divided by its monthly quota. Overage and hard limits follow RapidAPI's standard rules for each plan.
Frequently asked questions
Straight answers, matching exactly what the API does today — including what it deliberately does not do.
Is this a legally valid Nota Fiscal Eletrônica (NF-e)?
No. This API generates a formatted invoice (fatura) or receipt (recibo) PDF — not a legally valid Brazilian Nota Fiscal Eletrônica. 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.
How does it validate CPF and CNPJ?
It runs the real Brazilian check-digit algorithm for CPF (11 digits) and CNPJ (14 digits) — not just a digit-count check. A document with the right number of digits but an invalid check digit is rejected with a 400 error before any PDF is generated.
Does it support PIX?
Yes, optionally. You provide a "pix copia e cola" (BR Code) string that your own bank or payment provider already generated, and the API embeds it as a scannable QR code on the PDF. The API does not generate PIX payment codes itself.
What runtime does it use, and how fast is it?
PDFs are rendered with pdf-lib, a pure-JavaScript PDF library — 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 and 3 ms without one. Network and gateway time are not included in those numbers.
Can I see the exact PDF it produces before I sign up?
Yes. The sample invoice and receipt PDFs published on this page are generated by the same code the API runs, and can be downloaded directly. There is also a free browser generator that renders the same document entirely on your machine, with no API key and no signup.
Do I need a Brazilian company or CNPJ to use it?
No. The API is a document renderer: it formats whatever issuer and recipient data you send. It is useful for any platform that bills customers in Brazil and needs a document that looks right to a Brazilian customer, wherever your company is registered.
How much does it cost?
Free tier: 20 documents/month, no credit card required. Paid tiers: Pro $12.99/month (500 documents), Business $24.99/month (3,000 documents), Enterprise $59.99/month (15,000 documents). Billing and metering are handled by RapidAPI.
How do I call the API?
Send a POST request to /invoice (or /receipt) through the RapidAPI gateway with your X-RapidAPI-Key and X-RapidAPI-Host headers and a JSON body describing issuer, recipient, and line items. The response is the PDF file (application/pdf).
This is not a Nota Fiscal Eletrônica (NF-e)
This API generates a formatted fatura (invoice) or recibo (receipt) document — a well-laid-out PDF with your business and customer data, line items, totals, and Brazilian formatting. It is not a legally valid Brazilian Nota Fiscal Eletrônica.
Issuing a real NF-e requires, at minimum:
- An A1/A3 digital certificate (ICP-Brasil) tied to the issuer's CNPJ
- Direct integration with SEFAZ (the state tax authority) for authorization and signing
- Municipal/state tax registration and compliance specific to the issuer's activity
Use this API for internal billing records, client-facing invoices/receipts alongside your real fiscal documents, freelancer proof-of-payment, or any case where a professional PDF is enough — not as a replacement for your NF-e obligations.
Feito também para devs brasileiros
Esta API gera fatura ou recibo em PDF com CPF/CNPJ validado por dígito verificador (não só contagem de dígitos), moeda em real (R$ 1.234,56), datas no formato brasileiro e valor por extenso — pronta pra integrar em qualquer sistema de cobrança, marketplace ou plataforma que atenda clientes no Brasil. Os exemplos em PDF desta página são o output real da API: baixe a fatura ou baixe o recibo e confira.
Importante: gera um documento formatado (fatura/recibo), não uma Nota Fiscal Eletrônica (NF-e) com validade jurídica — isso exige certificado digital e integração com a SEFAZ.
Ship Brazilian invoices this afternoon
Take a key on RapidAPI, paste the snippet, and the first 20 documents a month cost nothing — no card, no sales call.