API Documentation

Conecte-se com nossa poderosa API para integrar dados de empresas em suas aplicações

Introduction

Welcome to the CNPJLeads API documentation. This API allows you to programmatically access company data from our database.

Authentication

All API requests require authentication using an API token. You can generate a token in your profile page.

Include your API token in the Authorization header of your requests:
Authorization: Bearer YOUR_API_TOKEN

Code Examples

curl -X GET "https://cnpjleads.com/api/v1/companies/search?state=SP&page=1" \
-H "Authorization: Bearer YOUR_API_TOKEN"
<?php
$ch = curl_init();
curl_setopt($ch, CURLOPT_URL, "https://cnpjleads.com/api/v1/companies/search?state=SP&page=1");
curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
curl_setopt($ch, CURLOPT_HTTPHEADER, [
    "Authorization: Bearer YOUR_API_TOKEN"
]);
$response = curl_exec($ch);
curl_close($ch);
$data = json_decode($response, true);
print_r($data);
fetch("https://cnpjleads.com/api/v1/companies/search?state=SP&page=1", {
    headers: {
        "Authorization": "Bearer YOUR_API_TOKEN"
    }
})
.then(response => response.json())
.then(data => console.log(data))
.catch(error => console.error("Error:", error));
import requests

url = "https://cnpjleads.com/api/v1/companies/search"
params = {"state": "SP", "page": 1}
headers = {"Authorization": "Bearer YOUR_API_TOKEN"}

response = requests.get(url, params=params, headers=headers)
data = response.json()
print(data)
import java.io.BufferedReader;
import java.io.InputStreamReader;
import java.net.HttpURLConnection;
import java.net.URL;

public class ApiExample {
    public static void main(String[] args) {
        try {
            URL url = new URL("https://cnpjleads.com/api/v1/companies/search?state=SP&page=1");
            HttpURLConnection conn = (HttpURLConnection) url.openConnection();
            conn.setRequestMethod("GET");
            conn.setRequestProperty("Authorization", "Bearer YOUR_API_TOKEN");
            
            BufferedReader in = new BufferedReader(new InputStreamReader(conn.getInputStream()));
            String inputLine;
            StringBuffer response = new StringBuffer();
            while ((inputLine = in.readLine()) != null) {
                response.append(inputLine);
            }
            in.close();
            
            System.out.println(response.toString());
        } catch (Exception e) {
            e.printStackTrace();
        }
    }
using System;
using System.Net.Http;
using System.Threading.Tasks;

class Program
{
    static async Task Main(string[] args)
    {
        using (HttpClient client = new HttpClient())
        {
            client.DefaultRequestHeaders.Add("Authorization", "Bearer YOUR_API_TOKEN");
            
            HttpResponseMessage response = await client.GetAsync("https://cnpjleads.com/api/v1/companies/search?state=SP&page=1");
            response.EnsureSuccessStatusCode();
            
            string responseBody = await response.Content.ReadAsStringAsync();
            Console.WriteLine(responseBody);
        }
    }
}

Response Format

All API responses are returned in JSON format. Successful responses include a "success" field set to true, while error responses include an error message.

Rate Limiting

API requests are limited to 100 requests per minute per user. If you exceed this limit, you will receive a 429 Too Many Requests response.

Error Handling

The API uses standard HTTP status codes to indicate success or failure of requests. In case of an error, the response will include an error message.

Success Response (200 OK)

{
  "success": true,
  "data": { ... }
}

Error Response (400 Bad Request)

{
  "success": false,
  "message": "Invalid input parameters"
}

Languages

The API supports multiple languages. You can specify your preferred language using the "locale" parameter in your requests.

Locale Language
pt-br Português (Brasil)
en English
es Español

Pagination

Results are paginated to improve performance. You can navigate through pages using the "page" parameter and change the number of results per page using the "per_page" parameter.

Pagination Response Format

{
  "success": true,
  "total": 100,
  "per_page": 20,
  "current_page": 1,
  "last_page": 5,
  "from": 1,
  "to": 20,
  "data": [ ... ]
}

Endpoints

GET /api/v1/companies/search

Buscar empresas usando vários filtros

Parameters

Parameter Type Description
business_sector string Filtrar por código de setor de atividade (CNAE)
city string Filtrar por nome de cidade
state string Filtrar por código de estado (UF)
company_size string Filtrar por código de porte da empresa
opening_date_from date Filtrar por data de abertura (de) no formato YYYY-MM-DD
opening_date_to date Filtrar por data de abertura (até) no formato YYYY-MM-DD
trading_name string Filtrar por nome fantasia
neighborhood string Filtrar por bairro
zip_code string Filtrar por CEP
nature_code string Filtrar por código de natureza jurídica
cnpj string Filtrar por número de CNPJ
situacao_cadastral string Filtrar por código de situação cadastral
page integer Número da página para paginação
locale string Idioma preferido para resposta (pt-br, en, es)

Example Response

{
    "success": true,
    "total": 100,
    "per_page": 20,
    "current_page": 1,
    "last_page": 5,
    "from": 1,
    "to": 20,
    "data": [
        {
            "id": "12345678",
            "cnpj": "12345678000199",
            "razao_social": "EMPRESA EXEMPLO LTDA",
            "nome_fantasia": "EMPRESA EXEMPLO",
            "situacao_cadastral": "Ativa",
            "situacao_cadastral_code": "02",
            "porte_empresa": "Empresa de Pequeno Porte",
            "porte_empresa_code": "03",
            "cnae_fiscal": "6201500",
            "cnae_fiscal_descricao": "Desenvolvimento de programas de computador sob encomenda",
            "endereco": {
                "logradouro": "Rua Exemplo",
                "numero": "123",
                "complemento": "Sala 1",
                "bairro": "Centro",
                "municipio": "3550308",
                "municipio_nome": "São Paulo",
                "uf": "SP",
                "cep": "01234567"
            },
            "contato": {
                "ddd": "11",
                "telefone": "12345678",
                "email": "contato@exemplo.com"
            },
            "socios": [
                {
                    "nome": "SOCIO EXEMPLO",
                    "qualificacao": "49",
                    "tipo": "2",
                    "documento": "***123456**"
                }
            ],
            "data_inicio_atividades": "2010-01-01"
        }
    ]
}
GET /api/v1/companies/{cnpj}

Obter informações detalhadas de uma empresa específica por CNPJ

Parameters

Parameter Type Description
cnpj string Número de CNPJ no caminho
locale string Idioma preferido para resposta (pt-br, en, es)

Example Response

{
    "success": true,
    "data": {
        "id": "12345678",
        "cnpj": "12345678000199",
        "razao_social": "EMPRESA EXEMPLO LTDA",
        "nome_fantasia": "EMPRESA EXEMPLO",
        "situacao_cadastral": "Ativa",
        "situacao_cadastral_code": "02",
        "natureza_juridica": "SOCIEDADE EMPRESÁRIA LIMITADA",
        "natureza_juridica_code": "2062",
        "porte_empresa": "Empresa de Pequeno Porte",
        "porte_empresa_code": "03",
        "cnae_fiscal": "6201500",
        "cnae_fiscal_descricao": "Desenvolvimento de programas de computador sob encomenda",
        "endereco": {
            "logradouro": "Rua Exemplo",
            "numero": "123",
            "complemento": "Sala 1",
            "bairro": "Centro",
            "municipio": "3550308",
            "municipio_nome": "São Paulo",
            "uf": "SP",
            "cep": "01234567",
            "endereco_completo": "Rua Exemplo, 123 - Sala 1, Centro, São Paulo/SP - 01234-567"
        },
        "contato": {
            "ddd": "11",
            "telefone": "12345678",
            "telefone_formatado": "(11) 12345678",
            "email": "contato@exemplo.com"
        },
        "socios": [
            {
                "nome": "SOCIO EXEMPLO",
                "qualificacao": "49",
                "tipo": "2",
                "documento": "***123456**"
            }
        ],
        "data_inicio_atividades": "2010-01-01",
        "capital_social": "100000.00"
    }
}
GET /api/v1/reference-data

Obter dados de referência incluindo setores, estados, portes de empresas e naturezas jurídicas

Parameters

Parameter Type Description
locale string Idioma preferido para resposta (pt-br, en, es)

Example Response

{
    "success": true,
    "data": {
        "business_sectors": [
            {
                "code": "6201500",
                "description": "Desenvolvimento de programas de computador sob encomenda"
            }
        ],
        "states": [
            "AC",
            "AL",
            "AM",
            "AP",
            "BA"
        ],
        "company_sizes": [
            "01",
            "03",
            "05",
            "08"
        ],
        "legal_natures": [
            {
                "code": "2062",
                "description": "SOCIEDADE EMPRESÁRIA LIMITADA"
            }
        ],
        "registration_statuses": {
            "01": "Nula",
            "02": "Ativa",
            "03": "Suspensa",
            "04": "Inapta",
            "08": "Baixada"
        },
        "locale": "pt-br",
        "available_locales": {
            "pt-br": "Português (Brasil)",
            "en": "English",
            "es": "Español"
        }
    }
}

Need Help?

If you have any questions or need assistance with the API, please contact our support team:

Developer Resources

API Status

View current API status

Operational

Changelog

View API version history

Latest: v1.0.0 (2025-04-24)

FAQ

Frequently Asked Questions

View FAQ

Ready to integrate with our API? Get your API key and start building today