Retrieve detailed information about a specific entity using its CPF, CNPJ, or internal element ID.
Authentication
This endpoint requires authentication via:
- Bearer token: Include
Authorization: Bearer <token> header
- Session cookie: Automatically sent by browser after login
Entity lookup must be enabled via the ENTITY_LOOKUP_ENABLED configuration.
Endpoints
Get Entity by CPF or CNPJ
GET /api/v1/entity/{cpf_or_cnpj}
Lookup an entity using its Brazilian tax identifier (CPF for individuals, CNPJ for companies).
CPF (11 digits) or CNPJ (14 digits). Formatting characters (dots, dashes, slashes) are automatically removed.Examples:
- CPF:
12345678900 or 123.456.789-00
- CNPJ:
12345678000100 or 12.345.678/0001-00
Get Entity by Element ID
GET /api/v1/entity/by-element-id/{element_id}
Lookup an entity using its internal Neo4j element ID.
Neo4j element ID (e.g., 4:abc123:1)
Response
Unique element ID for the entity in Neo4j graph database
Entity type in lowercase (e.g., “person”, “company”, “contract”)
Primary Neo4j label (e.g., “Person”, “Company”)
Identity verification confidence level:
strong - Person with valid formatted CPF
partial - Partner with incomplete identification
unknown - Person without valid CPF
null - Not applicable for non-person entities
Key-value pairs of entity properties. Common fields include:
- Person:
name, cpf, birth_date, mother_name
- Company:
razao_social, nome_fantasia, cnpj, uf
- Contract:
object, value, date, contractor
- Sanction:
type, date, sanctioning_body
Sensitive properties are sanitized before public exposure.
Data provenance informationSource database name (e.g., “receita_federal”, “compras_gov”, “tce_data”)
Original record identifier in source system
ISO 8601 timestamp of data extraction
Politically Exposed Person flag. True if the entity holds or held a public office matching PEP criteria.
exposure_tier
string
default:"public_safe"
Data sensitivity classification based on entity labels
Example Request
# By CPF
curl -X GET "https://api.br-acc.com/api/v1/entity/12345678900" \
-H "Authorization: Bearer YOUR_TOKEN"
# By CNPJ with formatting
curl -X GET "https://api.br-acc.com/api/v1/entity/12.345.678/0001-00" \
-H "Authorization: Bearer YOUR_TOKEN"
# By element ID
curl -X GET "https://api.br-acc.com/api/v1/entity/by-element-id/4:abc123:1" \
-H "Authorization: Bearer YOUR_TOKEN"
Example Response
{
"id": "4:abc123:1",
"type": "company",
"entity_label": "Company",
"identity_quality": null,
"properties": {
"razao_social": "Acme Construções LTDA",
"nome_fantasia": "Acme",
"cnpj": "12.345.678/0001-00",
"uf": "SP",
"capital_social": 500000.0,
"natureza_juridica": "Sociedade Empresária Limitada"
},
"sources": [
{
"database": "receita_federal",
"record_id": "cnpj_12345678000100",
"extracted_at": "2024-01-15T10:30:00Z"
}
],
"is_pep": false,
"exposure_tier": "public_safe"
}
Get Entity Timeline
GET /api/v1/entity/{entity_id}/timeline
Retrieve chronological events related to an entity.
Pagination cursor (ISO date string) for fetching next page
Maximum events per page (min: 1, max: 100)
Get Entity Connections
GET /api/v1/entity/{entity_id}/connections
Retrieve entities connected to this entity via relationships.
Graph traversal depth (min: 1, max: 4)
Comma-separated list of entity types to include (e.g., “company,person”)
Include relationships with confidence < 1.0
Get Entity Exposure
GET /api/v1/entity/{entity_id}/exposure
Calculate risk exposure index based on graph connections and attributes.
Error Responses
Invalid CPF or CNPJ format
Missing or invalid authentication token
Person entity access denied (when HIDE_PERSON_ENTITIES is enabled)
Entity not found in database
Privacy Controls
When the HIDE_PERSON_ENTITIES environment variable is enabled:
- Direct access to Person entities returns 403 Forbidden
- Only non-person entities can be retrieved
- This protects individual privacy in public deployments
Implementation Details
From entity.py:99-144:
- Validates CPF/CNPJ format using regex patterns
- Automatically formats identifiers (adds dots, dashes)
- Queries Neo4j using both raw and formatted identifiers
- Enforces access policies for person entities
- Infers identity quality from labels and CPF format
- Detects PEP status by matching role keywords