npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

cnpjob

v1.1.0

Published

SDK oficial para a API cnpj/ob — consulta CNPJ, sócios, CNAE e mais

Readme

cnpjob

SDK oficial Node.js para a API cnpj/ob — consulte qualquer CNPJ diretamente da Receita Federal com uma linha de código.

Instalação

npm install cnpjob

Início rápido

import CNPJob from 'cnpjob'

const client = new CNPJob('SUA_API_KEY')

const empresa = await client.lookup('12.345.678/0001-00')
console.log(empresa.razao_social) // EMPRESA EXEMPLO LTDA

Obtenha sua API key gratuita em app.cnpjob.com.br


Métodos

lookup(cnpj)

Consulta completa de uma empresa pelo CNPJ. Aceita qualquer formato (com ou sem máscara).

const empresa = await client.lookup('12.345.678/0001-00')

console.log(empresa.razao_social)        // EMPRESA EXEMPLO LTDA
console.log(empresa.nome_fantasia)       // Empresa Exemplo
console.log(empresa.situacao_cadastral)  // ATIVA
console.log(empresa.data_abertura)       // 2010-03-15
console.log(empresa.endereco.municipio)  // São Paulo
console.log(empresa.socios)             // [{ nome, qualificacao, ... }]

batch(cnpjs)

Consulta múltiplos CNPJs em uma única requisição (até 10 por chamada).

const resultado = await client.batch([
  '12345678000100',
  '33000167000101',
  '60701190000104',
])

resultado.results.forEach((empresa) => {
  console.log(empresa.cnpj, empresa.razao_social)
})

validate(cnpj)

Valida o formato e os dígitos verificadores de um CNPJ. Não consome cota.

const { valid } = await client.validate('12.345.678/0001-00')
console.log(valid) // true ou false

Resposta completa

{
  "cnpj": "12345678000100",
  "razao_social": "EMPRESA EXEMPLO LTDA",
  "nome_fantasia": "Empresa Exemplo",
  "situacao_cadastral": "ATIVA",
  "data_abertura": "2010-03-15",
  "natureza_juridica": "Sociedade Empresária Limitada",
  "porte": "MICRO EMPRESA",
  "capital_social": 10000.00,
  "endereco": {
    "logradouro": "Rua das Flores",
    "numero": "100",
    "complemento": "Sala 1",
    "bairro": "Centro",
    "municipio": "São Paulo",
    "uf": "SP",
    "cep": "01310-100"
  },
  "atividade_principal": {
    "codigo": "6201-5/01",
    "descricao": "Desenvolvimento de programas de computador sob encomenda"
  },
  "atividades_secundarias": [],
  "socios": [
    {
      "nome": "JOÃO DA SILVA",
      "qualificacao": "Sócio-Administrador",
      "pais_origem": "Brasil"
    }
  ]
}

Tratamento de erros

import CNPJob from 'cnpjob'

const client = new CNPJob('SUA_API_KEY')

try {
  const empresa = await client.lookup('00000000000000')
} catch (err) {
  console.error(err.message)
  // "CNPJ não encontrado"        → 404
  // "Limite de requisições"      → 429 (upgrade de plano)
  // "Chave de API inválida"      → 401
}

| Código | Causa | |--------|-------| | 401 | API key inválida ou ausente | | 403 | IP bloqueado pela allowlist | | 404 | CNPJ não encontrado | | 429 | Limite de requisições atingido |


Opções avançadas

const client = new CNPJob('SUA_API_KEY', {
  baseUrl: 'https://api.cnpjob.com.br/api', // padrão
})

Compatibilidade

  • Node.js 18+
  • Bun 1.0+
  • Edge Runtimes (Cloudflare Workers, Vercel Edge)
  • Next.js, Nuxt, Remix (server-side)

Usa fetch nativo — sem dependências externas.


Planos

| Plano | Req/dia | Req/min | Preço | |----------|-----------|---------|---------------| | Free | 10 | 2 | Grátis | | Pro | 10.000 | 60 | R$ 99/mês | | Business | 100.000 | 300 | R$ 299/mês |

Ver todos os planos →


Links

Licença

MIT