Authentication

Programmatic use of CNPJAPI is authenticated with an API key sent in the Authorization header, in Bearer format:

Authorization: Bearer cnpj_sua_chave

The key identifies your account, applies your plan's limits and enables usage-based billing.

Test key (no account)

To try the API before creating an account, use the public test key:

Authorization: Bearer cnpj_teste_exemplos

It only answers for three fictitious CNPJs (none exists at the Receita), with sample responses in the real API format, without using any quota:

CNPJ What it shows
98765432000198 Company with a sanction (IBAMA embargo on a branch), federal tax debt, installment plans with the Receita and a State Registration in SP
99999999000191 Company with no records, under Simples, with a State Registration in SP
12ABC34501DE35 The same records (sanction, federal tax debt and installment plans), in the alphanumeric format the Receita started using in 2026, without a State Registration

It works on GET /{cnpj} (native format, also with ?incluir=ie) and on GET /consulta/ie/{cnpj}. The alphanumeric sample has no State Registration, as in a real lookup (422 on the IE route and cnpj_alfanumerico with ?incluir=ie). Any other CNPJ, format or route returns 403, and there is a limit of 30 calls per minute per IP. The data is fictitious and fixed: to look up real companies, create your account and use your own key.

How to generate your API key

  1. Create your account at https://app.cnpjapi.com.br (there is a free plan to get started).
  2. In the portal, generate your API key.
  3. Send it in the Authorization header of every request (see Look up a CNPJ).

Treat the API key as a secret: keep it on the server (environment variables or a secrets vault), never in public code, repositories or front-end applications.

Open web lookup vs. programmatic use

The one-off web lookup (the search at https://cnpjapi.com.br) is open and requires no signup - it is meant to check a CNPJ on the spot, from the browser.

The API key is for programmatic use: it identifies your account, applies the plan limits and enables integration into systems, ERPs, CRMs and registration flows.

Authentication errors

Status Meaning
401 API key missing or invalid
403 No permission for the resource on your plan

See all codes in Errors.