Integration Guides
Practical, task-oriented guides for looking up CNPJ with the CNPJAPI API in your language. Each guide shows a real call to the GET https://api.cnpjapi.com.br/{cnpj} endpoint, API key authentication and how to read the JSON response.
For the full reference (fields, limits, errors), see the API documentation.
Choose your language
- Python - with the
requestslibrary. - Node.js - with native
fetch. - C# / .NET - with
HttpClient. - PHP - with cURL.
- Go - with
net/http. - Java - with
java.net.http.HttpClient.
Many CNPJs?
- Batch lookup - up to 20 CNPJs in a single call (paid plan). Without a paid plan, the default is one call per CNPJ, respecting the rate limit.
Alphanumeric CNPJ
- Alphanumeric CNPJ: validate the check digits and look it up via API - the format with letters that Receita Federal has been issuing since July 31, 2026: check digit calculation with ready-to-use code, regular expression, database and API lookup.
No code
Overview and "which one to choose": Look up CNPJ without coding.
In a spreadsheet:
- Look up CNPJ in Excel - with Power Query, enriching a whole column of CNPJs. Excel for Windows only.
- Look up CNPJ in Google Sheets - with a
=CNPJ()function via Apps Script, on any system.
In automation tools (enrich leads/rows automatically):
- Look up CNPJ in Make (Integromat) - with the HTTP module, in a no-code scenario.
- Look up CNPJ in Power Automate - with the HTTP action + Parse JSON, in the Microsoft ecosystem.
In apps built with AI:
- Look up CNPJ in Lovable - with a ready-to-paste prompt and a server function of the app that keeps the API key secret.
Build company lists (segmentation)
The inverse of a lookup: instead of starting from a CNPJ, you start from criteria and get the list of companies. It is a self-service feature in the portal (not the API). See the overview in Segmented company lists.
- Company list by CNAE - build the segment by line of business and export as Excel or CSV.
- Company list by city and state - filter by state and city for regional cuts.
- Company list by radius or map area - companies near a ZIP code (radius) or within an area drawn on the map.
- Track new companies by city and segment - monthly alert when a new company of your CNAE opens in the cities you serve.
- Export a list to Excel or CSV - format, scope, per-row pricing and download.
Beyond CNPJ lookup
- Migrate from ReceitaWS - already on ReceitaWS? Swap only the host; the response comes back in the same format, field by field.
- Look up State Registration (IE) - a CNPJ's IE from the official SEFAZ source, by state or nationwide.
- Check a CNPJ's federal tax debt - whether the company was under collection in PGFN's quarterly registry, with the extraction month, in every lookup on paid plans.
- Check a CNPJ's installment plans with Receita Federal - whether the company had an active installment plan in Receita Federal's monthly data, by type and with the balance, with the publication date, in every lookup on paid plans.
- Check a CNPJ's sanctions and embargoes - CEIS, CNEP, CEPIM, leniency agreements and IBAMA embargoes in every lookup, on paid plans.
- NF-e rejections 181 and 182: validate the recipient's registration - from November 16, 2026, a recipient CNPJ that is not Active at Receita Federal gets the NF-e rejected. How to check before issuing.
- NF-e rejection 180: check the issuer's tax regime (CRT) - from November 16, 2026, SEFAZ rejects the invoice when the CRT does not match the regime of the issuer's CNPJ at Receita Federal (MEI that lost its status, company excluded from Simples Nacional). Which CRT to use and how to check.
Code on GitHub
Complete, runnable examples for every language live in the official repository: https://github.com/guidi-sistemas/cnpjapi-examples.
Before you start
You will need an API key. Create your free account at https://app.cnpjapi.com.br, generate the key and send it in the Authorization: Bearer header of every request (see Authentication).