curl --request POST \
--url https://api.base39.com.br/v2/companies/{idOrDocument}/graph/distance \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"document": "12345678909",
"ignore": [
{
"name": "JOAO DA SILVA",
"cpf": "12345678909"
}
],
"maxDepth": 6,
"maxPaths": 100
}
'import requests
url = "https://api.base39.com.br/v2/companies/{idOrDocument}/graph/distance"
payload = {
"document": "12345678909",
"ignore": [
{
"name": "JOAO DA SILVA",
"cpf": "12345678909"
}
],
"maxDepth": 6,
"maxPaths": 100
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
document: '12345678909',
ignore: [{name: 'JOAO DA SILVA', cpf: '12345678909'}],
maxDepth: 6,
maxPaths: 100
})
};
fetch('https://api.base39.com.br/v2/companies/{idOrDocument}/graph/distance', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.base39.com.br/v2/companies/{idOrDocument}/graph/distance",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'document' => '12345678909',
'ignore' => [
[
'name' => 'JOAO DA SILVA',
'cpf' => '12345678909'
]
],
'maxDepth' => 6,
'maxPaths' => 100
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.base39.com.br/v2/companies/{idOrDocument}/graph/distance"
payload := strings.NewReader("{\n \"document\": \"12345678909\",\n \"ignore\": [\n {\n \"name\": \"JOAO DA SILVA\",\n \"cpf\": \"12345678909\"\n }\n ],\n \"maxDepth\": 6,\n \"maxPaths\": 100\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.base39.com.br/v2/companies/{idOrDocument}/graph/distance")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"document\": \"12345678909\",\n \"ignore\": [\n {\n \"name\": \"JOAO DA SILVA\",\n \"cpf\": \"12345678909\"\n }\n ],\n \"maxDepth\": 6,\n \"maxPaths\": 100\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.base39.com.br/v2/companies/{idOrDocument}/graph/distance")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"document\": \"12345678909\",\n \"ignore\": [\n {\n \"name\": \"JOAO DA SILVA\",\n \"cpf\": \"12345678909\"\n }\n ],\n \"maxDepth\": 6,\n \"maxPaths\": 100\n}"
response = http.request(request)
puts response.read_body{
"sourceDocument": "<string>",
"targetDocument": "<string>",
"targetType": "cpf",
"found": true,
"expansions": 123,
"paths": [
"<array>"
],
"deepPaths": [
"<array>"
],
"cpfMatches": [
{
"nodeId": "<string>",
"name": "<string>",
"partialCpf": "<string>",
"ignored": true
}
],
"companiesBetween": [
{
"id": "<string>",
"type": "<string>",
"label": "<string>",
"entityType": "company",
"metadata": {
"cnpjBase": "<string>",
"tradeName": "<string>",
"document": "<string>",
"qualification": "<string>",
"startDate": "<string>",
"role": "<string>"
}
}
],
"peopleBetween": [
{
"id": "<string>",
"type": "<string>",
"label": "<string>",
"entityType": "company",
"metadata": {
"cnpjBase": "<string>",
"tradeName": "<string>",
"document": "<string>",
"qualification": "<string>",
"startDate": "<string>",
"role": "<string>"
}
}
],
"entitiesBetween": [
{
"id": "<string>",
"type": "<string>",
"label": "<string>",
"entityType": "company",
"metadata": {
"cnpjBase": "<string>",
"tradeName": "<string>",
"document": "<string>",
"qualification": "<string>",
"startDate": "<string>",
"role": "<string>"
}
}
],
"nodes": [
{
"id": "<string>",
"type": "<string>",
"label": "<string>",
"entityType": "company",
"metadata": {
"cnpjBase": "<string>",
"tradeName": "<string>",
"document": "<string>",
"qualification": "<string>",
"startDate": "<string>",
"role": "<string>"
}
}
],
"edges": [
{
"source": "<string>",
"target": "<string>",
"type": "<string>",
"label": "<string>"
}
],
"distance": {}
}Calculate Graph Distance
Expande conexões societárias até encontrar o documento alvo e retorna caminhos mínimos e matches de CPF parcial.
curl --request POST \
--url https://api.base39.com.br/v2/companies/{idOrDocument}/graph/distance \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"document": "12345678909",
"ignore": [
{
"name": "JOAO DA SILVA",
"cpf": "12345678909"
}
],
"maxDepth": 6,
"maxPaths": 100
}
'import requests
url = "https://api.base39.com.br/v2/companies/{idOrDocument}/graph/distance"
payload = {
"document": "12345678909",
"ignore": [
{
"name": "JOAO DA SILVA",
"cpf": "12345678909"
}
],
"maxDepth": 6,
"maxPaths": 100
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
document: '12345678909',
ignore: [{name: 'JOAO DA SILVA', cpf: '12345678909'}],
maxDepth: 6,
maxPaths: 100
})
};
fetch('https://api.base39.com.br/v2/companies/{idOrDocument}/graph/distance', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.base39.com.br/v2/companies/{idOrDocument}/graph/distance",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'document' => '12345678909',
'ignore' => [
[
'name' => 'JOAO DA SILVA',
'cpf' => '12345678909'
]
],
'maxDepth' => 6,
'maxPaths' => 100
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"strings"
"net/http"
"io"
)
func main() {
url := "https://api.base39.com.br/v2/companies/{idOrDocument}/graph/distance"
payload := strings.NewReader("{\n \"document\": \"12345678909\",\n \"ignore\": [\n {\n \"name\": \"JOAO DA SILVA\",\n \"cpf\": \"12345678909\"\n }\n ],\n \"maxDepth\": 6,\n \"maxPaths\": 100\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://api.base39.com.br/v2/companies/{idOrDocument}/graph/distance")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"document\": \"12345678909\",\n \"ignore\": [\n {\n \"name\": \"JOAO DA SILVA\",\n \"cpf\": \"12345678909\"\n }\n ],\n \"maxDepth\": 6,\n \"maxPaths\": 100\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.base39.com.br/v2/companies/{idOrDocument}/graph/distance")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"document\": \"12345678909\",\n \"ignore\": [\n {\n \"name\": \"JOAO DA SILVA\",\n \"cpf\": \"12345678909\"\n }\n ],\n \"maxDepth\": 6,\n \"maxPaths\": 100\n}"
response = http.request(request)
puts response.read_body{
"sourceDocument": "<string>",
"targetDocument": "<string>",
"targetType": "cpf",
"found": true,
"expansions": 123,
"paths": [
"<array>"
],
"deepPaths": [
"<array>"
],
"cpfMatches": [
{
"nodeId": "<string>",
"name": "<string>",
"partialCpf": "<string>",
"ignored": true
}
],
"companiesBetween": [
{
"id": "<string>",
"type": "<string>",
"label": "<string>",
"entityType": "company",
"metadata": {
"cnpjBase": "<string>",
"tradeName": "<string>",
"document": "<string>",
"qualification": "<string>",
"startDate": "<string>",
"role": "<string>"
}
}
],
"peopleBetween": [
{
"id": "<string>",
"type": "<string>",
"label": "<string>",
"entityType": "company",
"metadata": {
"cnpjBase": "<string>",
"tradeName": "<string>",
"document": "<string>",
"qualification": "<string>",
"startDate": "<string>",
"role": "<string>"
}
}
],
"entitiesBetween": [
{
"id": "<string>",
"type": "<string>",
"label": "<string>",
"entityType": "company",
"metadata": {
"cnpjBase": "<string>",
"tradeName": "<string>",
"document": "<string>",
"qualification": "<string>",
"startDate": "<string>",
"role": "<string>"
}
}
],
"nodes": [
{
"id": "<string>",
"type": "<string>",
"label": "<string>",
"entityType": "company",
"metadata": {
"cnpjBase": "<string>",
"tradeName": "<string>",
"document": "<string>",
"qualification": "<string>",
"startDate": "<string>",
"role": "<string>"
}
}
],
"edges": [
{
"source": "<string>",
"target": "<string>",
"type": "<string>",
"label": "<string>"
}
],
"distance": {}
}Authorizations
OAuth2 Authorization Code flow
Path Parameters
Company ID (cmp_*) or document (CNPJ)
Body
Documento alvo para encontrar conexão a partir da empresa base (CPF ou CNPJ)
"12345678909"
Lista de matches de CPF (nome + cpf) que devem ser ignorados na busca
Show child attributes
Show child attributes
Profundidade máxima do grafo para buscar conexões indiretas entre empresas e pessoas
1 <= x <= 8Quantidade máxima de caminhos de conexão profundos a retornar
1 <= x <= 500Response
Distance search result
Documento da empresa de origem (CNPJ)
Documento alvo normalizado (CPF ou CNPJ)
cpf, cnpj Indica se a conexão foi encontrada
Quantidade total de expansões realizadas no dataset
Todos os caminhos mínimos encontrados (array de IDs de nós por caminho)
Caminhos profundos encontrados entre origem e destino (empresas e pessoas), respeitando maxDepth
Matches de CPF parcial encontrados (incluindo ignorados)
Show child attributes
Show child attributes
Empresas intermediárias encontradas entre origem e destino (exclui os pontos de origem/destino)
Show child attributes
Show child attributes
Pessoas intermediárias encontradas entre origem e destino (exclui os pontos de origem/destino)
Show child attributes
Show child attributes
Todas as entidades intermediárias encontradas (empresas e pessoas)
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Distância mínima em arestas, quando encontrada