---
title: "CNPJ Busca"
description: "API CNPJ Busca - Valide empresas e agilize cadastros em segundos"
lang: en
canonical: https://doc.apibrasil.io/apis/creditos/776132f2-77cb-47e9-b818-1ef5c322bcb6
markdown: https://doc.apibrasil.io/apis/creditos/776132f2-77cb-47e9-b818-1ef5c322bcb6.md
source: apibrasil-documentation
---

# CNPJ Busca

> API CNPJ Busca - Valide empresas e agilize cadastros em segundos

- **Category:** Company Lookup (CNPJ)
- **Billing:** per query, with the Bearer Token only
- **Price:** R$1.60 per query
- **Limit:** 990,000 per month
- **Registration:** requires a CNPJ
- **Version:** v2
- **Published by:** APIBrasil
- **OpenAPI specification:** https://doc.apibrasil.io/apis/creditos/776132f2-77cb-47e9-b818-1ef5c322bcb6/openapi.json

## How to call

**Base address:** `https://gateway.apibrasil.io/api/v2`

Authentication: the `Authorization: Bearer <token>` header. Nothing else.

With `homolog: true` in the body, the gateway answers from a fixed base, with the real shape of the response, and does not charge. The CPF 00000000000 belongs to that base and to nobody: use it in tests, never in production.

## Endpoints (1 endpoint)

### 1. POST /consulta/cnpj/credits

API CNPJ Busca - Valide empresas e reduza riscos em segundos

A API CNPJ Busca permite consultar dados de pessoas jurídicas via POST de forma rápida, segura e totalmente integrada ao seu sistema. Com o endpoint de consulta/cnpj/credits, você envia o CNPJ da empresa e recebe de volta informações estruturadas para validação cadastral, análise de risco e tomada de decisão automatizada. A integração é simples, com uso direto via cnpj-search, reduzindo o tempo de desenvolvimento e acelerando a entrada em produção. Use a API CNPJ Busca para qualificar leads B2B, validar fornecedores, clientes PJ e creditar limites com mais segurança, tudo em tempo real dentro do seu fluxo atual.

- **Method:** `POST`
- **Address:** `https://gateway.apibrasil.io/api/v2/consulta/cnpj/credits`
- **Route version:** v2

**Headers**

| Header | Value |
| --- | --- |
| `Content-Type` | `application/json` |
| `Authorization` | `Bearer $APIBRASIL_TOKEN` |

**Request body**

```json
{
  "cnpj": "00000000000000",
  "tipo": "cnpj-search",
  "homolog": true
}
```

**In cURL**

```bash
curl -X POST "https://gateway.apibrasil.io/api/v2/consulta/cnpj/credits" \
  -H "Content-Type: application/json" \
  -H "Authorization: Bearer $APIBRASIL_TOKEN" \
  -d '{"cnpj":"00000000000000","tipo":"cnpj-search","homolog":true}'
```

This endpoint accepts `homolog: true` in the body: the response comes back with valid data, `api_limit_for` equal to `homolog` and no charge.

**Sample response, from the catalog**

```json
{
  "error": false,
  "message": "Dados válidos! Você foi tarifado em R$ 1,60.",
  "tax": "1,600",
  "valor_consulta": 1.6,
  "api_limit_for": "credit",
  "homolog": false,
  "data": {
    "results": [
      {
        "cnpj": "27894561000133",
        "dados_cadastrais": {
          "cd_cnae_fiscal_principal": "6201501",
          "cd_cnae_fiscal_secundarios": [
            "6204000",
            "6319400"
          ],
          "cd_natureza_juridica": "2062",
          "cd_qualificacao_responsavel": "49",
          "cd_ramo_atividade": "J",
          "classificacao_td": "Tecnologia",
          "cnpj_basico": "27894561",
          "cnpj_completo": "27894561000133",
          "cnpj_dv": "33",
          "cnpj_ordem": "0001",
          "data_inicio_atividade": "2021-09-15",
          "ds_cnae_fiscal_principal": "Desenvolvimento de programas de computador sob encomenda",
          "ds_cnae_fiscal_secundarios": [
            "Consultoria em tecnologia da informação",
            "Portais, provedores de conteúdo e outros serviços de informação na internet"
          ],
          "ds_natureza_juridica": "Sociedade Empresária Limitada",
          "ds_ramo_atividade": "INFORMAÇÃO E COMUNICAÇÃO",
          "ente_federativo_responsavel": null,
          "identificador_matriz_filial": "MATRIZ",
          "nome_cidade_exterior": null,
          "nome_fantasia": "TECH SOLUTIONS BRASIL",
          "pais": null,
          "razao_social_nome_empresarial": "TECH SOLUTIONS BRASIL LTDA"
        },
        "dados_contato": {
          "emails": [
            {
              "email": "[omitido]",
              "ordem": "0",
              "rfb": true
            }
          ],
          "faxs": [],
          "logradouros": [
            {
              "logradouro_bairro": "Centro",
              "logradouro_cep": "30140071",
              "logradouro_complemento": "Sala 1203",
              "logradouro_endereco": "Avenida Afonso Pena",
              "logradouro_geo_composed": {
                "lat": "-19.9245012",
                "lon": "-43.9352381"
              },
              "logradouro_latitude": "-19.9245012",
              "logradouro_longitude": "-43.9352381",
              "logradouro_municipio": "Belo Horizonte",
              "logradouro_numero": "1500",
              "logradouro_tipo": "Avenida",
              "logradouro_uf": "MG",
              "logradouro_uf_iso": "BR-MG",
              "ordem": "0",
              "rfb": true
            }
          ],
          "telefones": [
            {
              "_up": "2026-02-10",
              "ddd": "31",
              "ddi": null,
              "numero": "988776655",
              "ordem": "0",
              "rfb": true,
              "tipo": "CELULAR"
            }
          ]
        },
        "filiais": [],
        "firmografico": {
          "capital_social": "50000.00",
          "cd_porte_empresa": "03",
          "ds_faixa_faturamento": "Entre R$ 360.000,00 e R$ 3.600.000,00",
          "ds_porte_empresa": "EMPRESA DE PEQUENO PORTE",
          "faixa_funcionarios_presumidos": "11 até 20 funcionários",
          "porte_td": "Empresa de Pequeno Porte (EPP)",
          "quantidade_funcionarios_presumidos": "15",
          "quantidade_funcionarios_rais_1": null,
          "quantidade_funcionarios_rais_2": null,
          "valor_faturamento_presumido": "1250000.00"
        },
        "quadro_societario": {
          "mei_proprietario_cpf": null,
          "mei_proprietario_nome": null,
          "socios": [
            {
              "cd_faixa_etaria_socio": "5",
              "cd_identificador_socio": "2",
              "cd_qualificacao_socio": "49",
              "cd_representante_legal_qualificacao": "00",
              "cpf_cnpj_socio": "***123456**",
              "cpf_cnpj_socio_tratado": "12345678901",
              "data_entrada_sociedade": "2021-09-15",
              "ds_faixa_etaria_socio": "41 A 50 ANOS",
              "ds_identificador_socio": "PESSOA FÍSICA",
              "ds_qualificacao_socio": "Sócio-Administrador",
              "ds_representante_legal_qualificacao": "Não informada",
              "nome_socio_razao_social": "CARLOS EDUARDO FERREIRA",
              "pais": null,
              "representante_legal_cpf": "***000000**",
              "representante_legal_cpf_tratado": null,
              "representante_legal_nome": null
            }
          ]
        },
        "regime_tributario": {
          "opcao_mei": false,
          "opcao_mei_data_exclusao": null,
          "opcao_mei_data_opcao": null,
          "opcao_simples": true,
          "opcao_simples_data_exclusao": null,
          "opcao_simples_data_opcao": "2021-09-15",
          "regime_tributario": []
        },
        "situacao_cadastral": {
          "cd_situacao_cadastral": "2",
          "cd_situacao_cadastral_motivo": "00",
          "ds_situacao_cadastral": "ATIVA",
          "ds_situacao_cadastral_motivo": "SEM MOTIVO",
          "situacao_cadastral_data": "2021-09-15",
          "situacao_especial": null,
          "situacao_especial_data": null
        }
      }
    ]
  }
}
```

In the sample responses, the fields of the account that generated the sample (`user.first_name`, `user.email`, `user.cellphone`) come out as `[omitido]`. The rest is what the catalog publishes.

## Pitfalls: what an integration gets wrong without warning

Established from the responses the catalog itself publishes. In every one of them the code works on the happy path and fails silently everywhere else:

1. **The error arrives in the BODY, with HTTP 200.**
   The response carries a boolean `error` field and a `message`. Checking only `response.ok` or the HTTP status lets a failure through as a success. ALWAYS check `error === false` before reading `data`.

2. **`balance`, `tax` and `extra_charges.total` are STRINGS in Brazilian format — and the format varies between APIs.**
   Values seen in the catalog: `"154,380"`, `"497,84"`, `"0,000"` and `"0.19"`. Comma in some, dot in another; three decimal places in some, two in another. In JavaScript, `parseFloat("154,380")` returns `154` and drops the cents with no error at all, and `Number("154,380")` returns `NaN`. Write a converter that handles both separators, and never use these fields in a financial decision without converting them.

3. **Every call costs money.**
   Blind retries multiply the bill. Never automatically repeat a 4xx: a bad parameter repeated is still bad, and still charged. Retry only timeouts and 5xx, with exponential backoff and a small attempt ceiling.

4. **HTTP 402 means insufficient balance, and retrying does not fix it.**
   It is the one status that needs a human — a top-up. Treat it as a terminal error with its own message, and do not lump it in with generic 4xx.

5. **`extra_charges` bills on top of the lookup price.**
   When the body asks for add-on services, the response lists each one with its price plus a `total` that is NOT included in the base amount. If you show cost to an end user, add both.

## See also

- OpenAPI specification: https://doc.apibrasil.io/apis/creditos/776132f2-77cb-47e9-b818-1ef5c322bcb6/openapi.json
- API catalog: [API catalog](https://doc.apibrasil.io/apis.md)
- Official SDKs: [Official SDKs](https://doc.apibrasil.io/sdks.md)
- Documentation index: https://doc.apibrasil.io/llms.txt
- HTML version of this page: https://doc.apibrasil.io/apis/creditos/776132f2-77cb-47e9-b818-1ef5c322bcb6
