Wired through the API into your system, the CNPJ returns the Receita Federal record ready for your form, with the state registration and tax regime when the invoice needs them. The user types the CNPJ, the system does the rest.
Records that fill themselves in inside your product.
01
The CNPJ field queries the API
The user types the CNPJ with or without punctuation, the alphanumeric one included, and your server sends the API its 14 characters without punctuation, in uppercase. A CNPJ with invalid check digits comes back as a 400 error, free of charge.
Legal name, trade name, status, activities, address with the IBGE code, phones and emails arrive in the same response, the board of partners and administrators included, the same record your team opens in the app. The user only reviews what is already filled in.
RECEITA FEDERALSIMPLES NACIONALCCCCORREIOS · DNEAPIREQUEST200GET /v2/establishments/92746162000191Authorization: ••••A1F9API KEYS3 OF 10 ACTIVEProduction server••••A1F9Staging••••7KQ2NF-e integration••••Z0P4New customer••••A1F9CNPJ92.746.162/0001-91Legal nameEXEMPLO SISTEMAS LTDARFBTrade nameExemploRFBStatusACTIVERFBPrimary CNAE6201-5/01RFBEmailfiscal@empresa.exampleRFBState registration110.042.490.114CCCTax regimeSimples NacionalSNCEP01310-100RFBCityIBGE 3550308São Paulo · SPRFB02 · RECEITA FEDERAL RECORDEXAMPLE
03
State registration and regime before the invoice
Requested in expand, the CCC state registration and the tax regime come with the same lookup. The issuer knows whether the recipient pays ICMS, whether the registration is enabled and whether the company is in the Simples Nacional before issuing the NF-e.
RECEITA FEDERALSIMPLES NACIONALCCCCORREIOS · DNEAPIREQUEST200GET /v2/establishments/92746162000191?expand=company.taxRegime,stateRegistryAuthorization: ••••A1F9API KEYS3 OF 10 ACTIVEProduction server••••A1F9Staging••••7KQ2NF-e integration••••Z0P4New customer••••A1F9CNPJ92.746.162/0001-91Legal nameEXEMPLO SISTEMAS LTDARFBTrade nameExemploRFBStatusACTIVERFBPrimary CNAE6201-5/01RFBEmailfiscal@empresa.exampleRFBState registration110.042.490.114CCCTax regimeSimples NacionalSNCEP01310-100RFBCityIBGE 3550308São Paulo · SPRFB03 · STATE REGISTRATION AND REGIMEEXAMPLE
04
Address from the CEP
For a delivery or billing address, the CEP typed in fills the street, district, city and state from the Correios DNE, and the IBGE city code is stored for the tax documents.
RECEITA FEDERALSIMPLES NACIONALCCCCORREIOS · DNEAPIREQUEST200GET /v2/postal-codes/01310100Authorization: ••••A1F9API KEYS3 OF 10 ACTIVEProduction server••••A1F9Staging••••7KQ2NF-e integration••••Z0P4New customer••••A1F9CNPJ92.746.162/0001-91Legal nameEXEMPLO SISTEMAS LTDARFBTrade nameExemploRFBStatusACTIVERFBPrimary CNAE6201-5/01RFBEmailfiscal@empresa.exampleRFBState registration110.042.490.114CCCTax regimeSimples NacionalSNCEP01310-100DNECityIBGE 3550308São Paulo · SPDNE04 · ADDRESS FROM THE CEPEXAMPLE
05
One key per application
Each system or environment uses its own key, up to 10 active per organization, created in the app under API keys with a name and a color so each shows apart under Usage. Rotating or revoking one key leaves the others untouched.
Can I call the API straight from the browser or the app?
With a key, no: it must stay on your server, never in web pages or mobile apps. Without a key, public access, a limited, revocable courtesy with no service level, serves the CNPJ and CEP lookups at low volume, up to 5 requests per second and 5 concurrent per IP.
What happens if the Receita Federal does not respond?
The request goes on: the affected resource comes from the cache, the response returns with status 206 and that resource is not charged. Treat 206 as success and retry later if you need the updated data. With nothing cached, as on the first lookup of a CNPJ, the request cannot complete: retry later.
Does the API accept the alphanumeric CNPJ?
Yes. The operations accept both formats, with 14 characters, no punctuation and uppercase letters. Store the CNPJ as text, never as a number, to keep its letters and leading zeros.
What are the usage limits?
With a key, the limit follows the organization's plan, across all its keys: 5 requests per second and 5 concurrent on Free, 50 on Pro and up to 250 on Enterprise. Above that, the response is 429, free of charge. Queries draw on the same allowance your team uses in the app.
How do I migrate from another provider?
The API documentation has migration guides from ReceitaWS, BrasilAPI, CNPJ.ws, OpenCNPJ, SintegraWS, Infosimples and the earlier CNPJá APIs, with the matching operations and fields of each.