DEV Community

Crime Brasil
Crime Brasil

Posted on

Querying 3M+ Brazil crime records with a free public REST API

Brazil has one of the most complex crime landscapes in Latin America — but getting clean, queryable data has historically been a nightmare of PDFs, broken government portals, and inconsistent formats.

We built Crime Brasil to fix that. It's a free platform with 3M+ geocoded crime records from RS, RJ and MG, exposed via a public REST API.

What's available

  • 3M+ individual crime records from Rio Grande do Sul (bairro-level granularity)
  • Municipality-level aggregates for Rio de Janeiro and Minas Gerais
  • Data from 2019–2026, updated monthly from official SSP sources
  • Rates per 100,000 inhabitants for fair regional comparison

Quick API examples

Get state-level totals for Rio Grande do Sul:

GET https://crimebrasil.com.br/api/heatmap/states?selected_states=RS
Enter fullscreen mode Exit fullscreen mode

Get municipality heatmap data:

GET https://crimebrasil.com.br/api/heatmap/municipios?selected_states=RJ&ano=2024
Enter fullscreen mode Exit fullscreen mode

Search for a location:

GET https://crimebrasil.com.br/api/search?q=Porto+Alegre
Enter fullscreen mode Exit fullscreen mode

Get detailed stats for a specific location:

GET https://crimebrasil.com.br/api/location-stats?state=RS&municipio=PORTO+ALEGRE&bairro=CENTRO+HISTORICO&ultimos_meses=12
Enter fullscreen mode Exit fullscreen mode

Python example

import httpx

base = "https://crimebrasil.com.br/api"

# Get top municipalities by crime rate in RJ
r = httpx.get(f"{base}/heatmap/municipios", params={
    "selected_states": "RJ",
    "ano": 2024,
    "rate_mode": True
})

data = r.json()
top10 = sorted(data, key=lambda x: x["weight"], reverse=True)[:10]
for m in top10:
    print(f"{m['name']}: {m['weight']:.1f} per 100K")
Enter fullscreen mode Exit fullscreen mode

Open data, open source

All source data comes from official Brazilian state security secretariats (SSP/RS, ISP/RJ, SEJUSP/MG) under open data laws. The platform itself is also open — explore it at https://crimebrasil.com.br or check our datasets on Kaggle, Zenodo, and HuggingFace.

Happy to answer questions about the data or methodology in the comments.

Top comments (0)