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 requests library.
  • 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

No code

Overview and "which one to choose": Look up CNPJ without coding.

In a spreadsheet:

In automation tools (enrich leads/rows automatically):

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.

Beyond CNPJ lookup

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).