API Documentation
api.api_subtitle
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://www.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://www.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://www.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://www.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://www.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://www.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
Search for companies using various filters
Parameters
Parameter | Type | Description |
---|---|---|
business_sector | string | Filter by business sector code (CNAE) |
city | string | Filter by city name |
state | string | Filter by state code (UF) |
company_size | string | Filter by company size code |
opening_date_from | date | Filter by opening date (from) in YYYY-MM-DD format |
opening_date_to | date | Filter by opening date (to) in YYYY-MM-DD format |
trading_name | string | Filter by trading name |
neighborhood | string | Filter by neighborhood |
zip_code | string | Filter by ZIP code |
nature_code | string | Filter by legal nature code |
cnpj | string | Filter by CNPJ number |
situacao_cadastral | string | Filter by registration status code |
page | integer | Page number for pagination |
locale | string | Preferred language for response (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 detailed information for a specific company by CNPJ
Parameters
Parameter | Type | Description |
---|---|---|
cnpj | string | CNPJ number in the path |
locale | string | Preferred language for response (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 reference data including sectors, states, company sizes, and legal natures
Parameters
Parameter | Type | Description |
---|---|---|
locale | string | Preferred language for response (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)