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.

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.