About

API for consulting the registration summary and CPF and CNPJ data at the Receita Federal, without the need to enter a date of birth or captchas. With a response time of less than 1 second, automate systems and increase the integrity of your database with complete and secure information.

Learn more at: www.cpfcnpj.com.br

Introduction

This document will provide instructions for fast integration to CPF.CNPJ services via HTTP (HTTP API).
Any programming language can be used.

Usage Rules

In order for us to be able to combat any kind of bot that would impair the performance of the API, we have defined usage limitations:

  • 3 consecutive queries with invalid token: Blocking for 5 minutes;
  • 3 consecutive queries of the same CPF/CNPJ in the same package in less than 1 minute: Blocking for 3 minutes;
  • 3 consecutive queries without credit in less than 1 minute: Block for 5 minutes;

Base URL

GET requests are made on a base URL under HTTPS protocol.

URL: https://api.cpfcnpj.com.br/

Firewall

Make sure you grant permissions on your firewall for the CloudFlare IPs.

Access the list of IPs for release: https://www.cloudflare.com/pt-br/ips/

Content-Type

The API data return will be via JSON.

Content-Type: application/json.

Timeout

Use the default timeout of 60 seconds. If you use a lower value, in case of API instability your request may be aborted before receiving the response, consuming credits.

Currently, the average turnaround time for queries is 2 seconds.

Tokens

To perform queries, it will be necessary to register the IP of the server that will perform them. To do this, access the option API > Tokens in your Control Panel. After the registration, your token will be generated to be inserted in the URL of the requisition.

Package IDs

In each request, it will be necessary to inform in the URL the ID of the desired Package, here named {pacote}.

To contract the desired packages, access the Control Panel. See them on our site.

ID
Pacote Returned Data Cost per Check (BRL)
1 CPF A
  • Full Name
R$0,15
7 CPF B
  • Full Name
  • Date of Birth
R$0,22
2 CPF C
  • Full Name
  • Date of Birth
  • Mother's Full Name
  • Genre
R$0,25
8 CPF D
  • Full Name
  • Date of Birth
  • Federal Revenue Service Registration Status
R$0,36
9 CPF E
  • Full Name
  • Mother's Full Name
  • Date of Birth
  • Genre
  • Federal Revenue Service Registration Status
R$0,47
3 CPF F
  • Full Name
  • Date of Birth
  • Genre
  • Complete Address

Available only under contract on the post-paid plan.

R$1,20
13 CPF G
  • Full Name
  • Level of probability of future default, according to SERASA.

Click here and read our article for more information.

R$1,00
14 CPF H
  • Full Name¹
  • Politically Exposed Person (PPE / PEP)

Click here and read our article for more information.

¹ If it is not a PPE, the return will be null.
² The charge is also made if the CPF consulted is not a PPE.

R$0,10²
15 CPF I
  • Companies in the Name

List of CNPJs in which the owner is a member of the corporate board.

R$0,20
4 CNPJ A
  • Corporate Name
R$0,13
5 CNPJ B
  • Corporate Name
  • Fantasy Name
  • Complete Address
R$0,24
10 CNPJ C
  • Corporate Name
  • Fantasy Name
  • Complete Address
  • Start of Activities
  • Phones
  • Faxes
  • E-mail
  • Federal Revenue Service Registration Status
R$0,32
6 CNPJ D
  • Corporate Name
  • Fantasy Name
  • Complete Address
  • Start of Activities
  • Phones
  • Faxes
  • E-mail
  • Code and Description of the Main Economic Activity
  • Legal Nature Code and Description
  • Name of Person Responsible for the Company
  • Company Size
  • Board of Partners and Directors (QSA)
  • Federal Revenue Service Registration Status
  • Information about Simples Nacional
R$0,45
11 CNPJ F
  • Corporate Name
  • Information about Simples Nacional
  • Information about SIMEI
  • Information about Suframa
R$0,30
12 CNPJ G
  • Corporate Name
  • Level of probability of future default, according to SERASA.

Click here and read our article for more information.

R$1,00
16 CNPJ H
  • State registrations
  • Corporate Name
R$0,15
17 CPF J
R$0,18

Making Queries

In a few steps, we will explain how the query is made by the CPF.CNPJ.

After generating the token, as in Introductionyou need to build the URL of the request.

Definition

Endpoint that will contain the TokenID of Pacote and the number of the CPF or CNPJ to be consulted, respectively.

URL: https://api.cpfcnpj.com.br/{token}/{pacote}/{cpfcnpj}

Request Parameters

Parameter Type Description Mandatory?
token string Token generated in the Control Panel.
pacote int ID of the package to be used, according to the table.
cpfcnpj string 11-digit CPF number or 14-digit CNPJ number.

URL examples:

See CPF in the package CPF E: https://api.cpfcnpj.com.br/5ae973d7a997af13f0aaf2bf60e65803/9/00000000000

Consult CNPJ in the package CNPJ D: https://api.cpfcnpj.com.br/5ae973d7a997af13f0aaf2bf60e65803/6/27272134000118/0

Response Parameters

Check below the fields returned for CPFs and CNPJs.

Each query package has its own response parameters. So, integrate accordingly.

CPF Answers

Main response matrix that varies by package:

Parameter Type Description
status bool 1 for success in the request and 0 for request failure. If it returns 0see the error table.
cpf string Formatted CPF number queried with 14 digits.
nome string Full name of the holder (without accents).
nascimento string Date of birth of the holder in DD/MM/YYYY format.
mae string Full name of the holder's mother (without accents).
genero string M for Male;
F for Female.
situacao string Registration status with the Internal Revenue Service:
Regular, Cancelada, Suspensa, Pendente or Nula
risco risco[] Matrix of objects containing the level of probability of future default, according to SERASA. Click here and learn more.
endereco string Home address of the holder.
numero string Number in the address.
complemento string Address complement.
bairro string Address neighborhood.
cep string Address zip code.
cidade string City of address.
uf string Federation Unit of the address with 2 letters.
ppe ppe[] Matrix containing the list of possible positions of the Politically Exposed Person of the CPF consulted in package CPF H. If it is not a CPF, the matrix will be empty.
pacoteUsado int ID of the package used.
saldo int Balance of the used package after check.
consultaID string 16-digit query ID.
delay float Time taken to perform the query in seconds.
PPE Matrix

Matrix ppe[] containing a list of possible EPP positions:

Parameter Type Description
sigla string Function abbreviation of the political office
funcao string Function of the political office
nivel string Political Hierarchy Level
orgao string Politically active body
inicioexercicio string Job start date in format DD/MM/YYYY
fimexercicio string Job End Date in format DD/MM/YYYY
fimcarencia string End date of the job's grace period in the format DD/MM/YYYY

CNPJ Answers

Main response matrix that varies by package:

Parameter Type Description
status bool 1 for success in the request and 0 for request failure. If it returns 0see the error table.
cnpj string Formatted number of the CNPJ queried with 18 digits.
razao string Name of the company name.
fantasia string Company's trade name.
inicioAtividade string Start date of activities in DD/MM/YYYY format.
email string E-mail address on the company's registration form.
responsavel string Name of the person legally responsible for the company (without accentuation).
simplesNacional simplesNacional[] Matrix containing possible information from Simples Nacional.
simei simei[] Matrix containing possible SIMEI information.
matrizEndereco matrizEndereco[] Matrix of address objects.
matrizfilial matrizfilial[] Object matrix of the competent body.
telefones telefones[] Object matrix containing the company's phone number(s). A maximum of 2 phone numbers.
fax fax[] Object matrix containing the company's fax(es).
situacao situacao[] Object matrix containing data on the company's registration status with the Internal Revenue Service.
naturezaJuridica naturezaJuridica[] Object matrix containing legal nature data.
cnae cnae[] Object matrix containing data from the main CNAE.
porte porte[] Object matrix containing company size data.
socios socios[] Object matrix containing data of the member(s), QSA.
risco risco[] Matrix of objects containing the level of probability of future default, according to SERASA. Click here and learn more.
pacoteUsado int ID of the package used.
saldo int Balance of the used package after check.
consultaID string 16-digit query ID.
delay float Time taken to perform the query in seconds.
Matriz simplesNacional

Matrix simplesNacional[] containing information about possible opting for Simples Nacional:

Parameter Type Description
optante string Sim or Não currently.
inicio string Start date as Simples Nacional in the format DD/MM/YYYY
fim string End date as Simples Nacional in the format DD/MM/YYYY
Matriz simei

Matrix simei[] containing information about a possible SIMEI opting:

Parameter Type Description
optante string Sim or Não currently.
anteriores matrix Matrix anteriores[] containing the list of previous registrations as SEMEI.
Matriz anteriores

Matrix anteriores[] containing the list of previous registrations as SEMEI:

Parameter Type Description
inicio string Start date as SIMEI in format DD/MM/YYYY
fim string End date as SIMEI in format DD/MM/YYYY
detalhamento string Description about the record
Matriz matrizEndereco

Matrix matrizEndereco[] containing address information:

Parameter Type Description
cep string 9-digit zip code of the address.
tipo string Type of address, which can be:

Aeroporto, Avenida, Caminho, Colonia, Esplanada, Estrada, Fazenda, Ladeira, Lago, Loteamento, Nao Informado, Passarela, Quadra, Recanto, Rua, Sitio, Vale, Vereda, Via
logradouro string Company Address.
numero string Number in the company's address.
complemento string Address complement.
bairro string Address neighborhood.
cidade string City of address.
uf string Federation Unit of the address with 2 letters.
Matriz matrizfilial

Matrix matrizfilial[] containing information about the competent body being ID and Type, respectively:

Parameter Type Description
id int Body ID
tipo string Organ:

id 1: Matriz
id 2: Filial
Matriz telefones

Matrix telefones[] containing at least 1 company phone number:

Parameter Type Description
ddd string Telephone area code number
numero string Phone Number
Matriz fax

Matrix fax[] containing possible fax numbers for the company:

Parameter Type Description
ddd string Fax area code number
numero string Fax Number
Matriz situacao

Matrix situacao[] containing data on the company's registration status with the Federal Revenue Service:

Parameter Type Description
id int ID of the cadastral situation.
nome string Name of the cadastral status, being:

id 1: Baixada
id 2: Ativa
id 3: Suspensa
id 4: Inapta
id 8: Baixada
data string Date of cadastral status in the format DD/MM/YYYY.
Matriz naturezaJuridica

Matrix naturezaJuridica[] containing data of the legal nature.
Click HERE to access the official list of codes and descriptions.

Parameter Type Description
codigo string Code of the legal nature with 4 digits without hyphen.
descricao string Description of the legal nature.
Matriz cnae

Matrix cnae[] containing the company's main CNAE data.
Click HERE to access the table of codes and descriptions.

Parameter Type Description
divisao string Room code.
grupo string Group code.
classe string Class code.
subClasse string Subclass code.
fiscal string Complete CNAE code, numbers only.
descricao string CNAE Description.
Matriz porte

Matrix porte[] containing data on the company's size.

Parameter Type Description
id string Port ID.
descricao string Description of the size of the company, being:

id 0: Demais
id 1: Matriz
id 3: Demais
id 5: Demais
Matriz socios

Matrix socios[] containing data from the company's QSA.

Parameter Type Description
nome string Name of partner PF or PJ (without accentuation).
cnpj string Formatted CNPJ number in case you are a PJ partner.
tipo string Type of member.
capitalSocial float Percentage of the partner's capital stock in the company.
pais string Country of origin of the partner.
Matriz risco

Matrix risco[] containing score information in SERASA.

Parameter Type Description
nivel int Level ID.
descricao string Description of the level of risk, being:

level 0: Unknown
level 1: Bass
level 2: Medium
level 3: High
level 4: Highest
score string

Score level score range.

CPF:
Bass: 701-1000
Medium: 501-700
Tall: 301-500
Highest: 0-300

CNPJ:
Bass: 601-1000
Medium: 251-600
Tall: 101-250
Highest: 0-100

Checking Balances

Free of charge, check the balance of the desired package.

Definition

Endpoint that will contain the Token and ID of Package to be queried, respectively.

URL: https://api.cpfcnpj.com.br/{token}/saldo/{pacote}

Request Parameters

Parameter Type Description Mandatory?
token string Token generated in the Control Panel.
pacote int ID of the package to be used, according to the table.

Response Parameters

Matrix pacote[] containing package balance information.

Parameter Type Description
id int Package ID.
nome string Name of the queried package.
saldo int Balance of the queried package.

Error Codes

See below for all the types of errors returned in the parameter error e errorCode:

erroCodigo
Value error Description
100
CPF CPF inválido! Number entered is not a valid CPF.
101
CPF Informe um CPF com 11 dígitos! The CPF entered has less than 11 digits.
102
CPF O CPF informado não existe nas bases de dados da Receita Federal! Por favor, confira o número do CPF e tente novamente. The CPF is valid, but does not belong to any person. In some cases, the CPF is valid, exists in the Receita Federal, but has not yet propagated in the API according to the deadline stipulated in the terms of use.
200
CNPJ CNPJ inválido! The number entered is not a valid CNPJ.
201
CNPJ Informe um CNPJ com 14 dígitos! The CNPJ informed has less than 14 digits.
202
CNPJ O CNPJ informado não existe nas bases de dados da Receita Federal! Por favor, confira o número do CNPJ e tente novamente. The CNPJ is valid, but does not belong to any company. In some cases, the CNPJ is valid, exists in the Receita Federal, but has not yet propagated in the API as stipulated in the terms of use.
1000
CPF/CNPJ Token inválido! (...) The token informed does not belong to the IP that is performing the query.
1001
CPF/CNPJ Créditos insuficientes! You have no credits in the informed package, to perform queries.
1002
CPF/CNPJ Conta suspensa e/ou inativa! Please contact us to verify the reason.
1003
CPF/CNPJ Blacklist até *DATA* IP and Token temporarily suspended for not complying with one of the Usage Rules.
1004
CPF/CNPJ Pacote indisponível para consultas! The package ID entered is invalid or not available for queries.
1005
CPF/CNPJ Não é possível consultar *CPF/CNPJ* neste pacote! Failed to process request with vendor or internal error. Check with support.
1006
CPF/CNPJ Supplier 2 offline. Contact us! Data provider offline or experiencing instabilities. Please try again or contact us.
1007
CPF/CNPJ Limite de requisições (20) por segundo excedido. Por favor, tente novamente. Maximum limit of 20 queries per second.