CNPJ

Consulta de CNPJ

Razão social, situação cadastral, endereço, CNAE e quadro societário a partir de um CNPJ, direto da Receita Federal.

CNPJ lookup

Legal name, registration status, address, business activity and partners from a Brazilian company registry number (CNPJ), straight from the Federal Revenue.

SYNC resposta na mesma chamada answers in the same call

Endpoints

Endpoints

GET /api/v1/cnpj/{cnpj} busca os dados cadastrais de um CNPJ looks up a CNPJ's registration data

Parâmetros

Parameters

NomeNameOndeInDescriçãoDescription
cnpj path 14 dígitos, com ou sem pontuação (33683111000280 ou 33.683.111/0002-80) — precisa passar no dígito verificador oficial, não é só checagem de tamanho 14 digits, with or without punctuation (33683111000280 or 33.683.111/0002-80) — must pass the official check-digit algorithm, not just a length check

Exemplo

Example

curl https://api.alicercelabs.com.br/api/v1/cnpj/33683111000280 \
          -H "Authorization: Bearer <token>"
{
          "success": true,
          "data": {
            "cnpj": "33683111000280",
            "matriz": false,
            "razao_social": "SERVICO FEDERAL DE PROCESSAMENTO DE DADOS (SERPRO)",
            "nome_fantasia": "REGIONAL BRASILIA-DF",
            "situacao_cadastral": 2,
            "descricao_situacao_cadastral": "ATIVA",
            "data_inicio_atividade": "1967-06-30",
            "natureza_juridica": "Empresa Pública",
            "porte": "DEMAIS",
            "capital_social": 1786196100,
            "cnae_fiscal": { "codigo": 6204000, "descricao": "Consultoria em tecnologia da informação" },
            "cnaes_secundarios": [
              { "codigo": 6201501, "descricao": "Desenvolvimento de programas de computador sob encomenda" }
            ],
            "endereco": {
              "logradouro": "L2 SGAN", "numero": "601", "bairro": "Asa Norte",
              "cep": "70836900", "municipio": "Brasília", "uf": "DF"
            },
            "opcao_pelo_simples": false,
            "opcao_pelo_mei": false,
            "qsa": [
              { "nome": "FULANO DE TAL", "qualificacao": "Diretor", "cpf_cnpj_mascarado": "***641988**" }
            ],
            "meta": { "fonte": "local" }
          },
          "meta": { "elapsed_ms": 3, "request_id": "..." }
        }

meta.fonte dentro de data diz qual das duas fontes respondeu ("local" ou "brasilapi") — ver "Duas fontes" abaixo.

meta.fonte inside data says which of the two sources answered ("local" or "brasilapi") — see "Two sources" below.

Erros possíveis

Possible errors

StatusMotivoReason
400CNPJ inválido: os 14 dígitos não passam no dígito verificador oficialinvalid CNPJ: the 14 digits don't pass the official check-digit algorithm
401token ausente ou inválidomissing or invalid token
404CNPJ não encontrado — as duas fontes concordamCNPJ not found — both sources agree
429limite de taxa excedidorate limit exceeded
503as duas fontes falharamboth sources failed

Duas fontes

Two sources

Primeiro uma instância própria do minha-receita, com o dataset completo da Receita Federal — rápida, mas o snapshot não é ao vivo (atualizado por reimport manual, no ritmo que a Receita Federal publica, mensal). Se essa instância não responder ou disser que não encontrou, a chamada cai pra BrasilAPI, pública, gratuita, ao vivo. Um CNPJ registrado depois do último reimport da fonte local aparece "não encontrado" ali mesmo existindo de verdade — por isso um 404 local também aciona o fallback, não só falha de rede.

First, a self-hosted minha-receita instance with the Federal Revenue's full dataset — fast, but the snapshot isn't live (updated by manual reimport, on whatever cadence the Federal Revenue publishes, monthly). If that instance doesn't answer or says it can't find the CNPJ, the call falls through to BrasilAPI, public, free, live. A CNPJ registered after the local source's last reimport shows up "not found" there even though it genuinely exists — that's why a local 404 triggers the fallback too, not just a network failure.

Usando o SDK

Using the SDK

SDKs oficiais: Go · Python · JavaScript.

Official SDKs: Go · Python · JavaScript.

Buscar empresa por CNPJ

Look up a company by CNPJ

import (
	"context"
	"fmt"

	alicercelabs "github.com/alicercelabs/alicercesdk-go"
)

client := alicercelabs.New("alk_...") // ou um token JWT de login/register
ctx := context.Background()

empresa, err := client.CNPJ.Get(ctx, "33683111000280")
if err != nil {
	panic(err)
}
fmt.Println(empresa.RazaoSocial, empresa.DescricaoSituacaoCadastral)
from alicercelabs import AlicerceLabs

client = AlicerceLabs(api_key="alk_...")  # ou um token JWT de login/register

empresa = client.cnpj.get("33683111000280")
print(empresa["razao_social"], empresa["descricao_situacao_cadastral"])
import { AlicerceLabs } from "alicercesdk-javascript";

const client = new AlicerceLabs("alk_..."); // ou um token JWT de login/register

const empresa = await client.cnpj.get("33683111000280");
console.log(empresa.razao_social, empresa.descricao_situacao_cadastral);

Limites

Limits

100/dia · 4/hora sem token, por IP chamador; com token (JWT de login ou API key gerada no painel), 1.000/dia · 41/hora. Resposta em cache por 24h — chamadas repetidas pro mesmo CNPJ dentro desse período não tocam nenhuma das duas fontes.

100/day · 4/hour without a token, per calling IP; with one (a login JWT or an API key generated in the panel), 1,000/day · 41/hour. Response cached for 24h — repeated calls for the same CNPJ within that window never touch either source.