# Brazil Court Cases - DataJud CNJ (Processos Judiciais) (`sadzinn/datajud-processos-brasil`) Actor

Fetch Brazilian court case metadata and full movement history from the official CNJ DataJud public API. Batch lookup by case number with automatic court detection.

- **URL**: https://apify.com/sadzinn/datajud-processos-brasil.md
- **Developed by:** [Kauã Fernandes Ferreira](https://apify.com/sadzinn) (community)
- **Categories:** Automation, Jobs, Other
- **Stats:** 2 total users, 1 monthly users, 100.0% runs succeeded, 0 bookmarks
- **User rating**: No ratings yet

## Pricing

from $0.01 / 1,000 results

This Actor is paid per event. You are not charged for the Apify platform usage, but only a fixed price for specific events.

Learn more: https://docs.apify.com/platform/actors/running/actors-in-store#pay-per-event

## What's an Apify Actor?

Actors are web data automations that power AI and operations. They run on the Apify platform to scrape websites, process data, connect APIs, and automate workflows.
In Batch mode, an Actor accepts a well-defined JSON input, performs an action which can take anything from a few seconds to a few hours,
and optionally produces a well-defined JSON output, datasets with results, or files in key-value store.
In Standby mode, an Actor provides a web server which can be used as a website, API, or an MCP server.
Actors are written with capital "A".

## How to integrate an Actor?

If asked about integration, you help developers integrate Actors into their projects.
You adapt to their stack and deliver integrations that are safe, well-documented, and production-ready.
The best way to integrate Actors is as follows.

- **AI agents and MCP clients** — the [Apify MCP server](https://docs.apify.com/integrations/mcp.md) at `https://mcp.apify.com` (remote, streamable HTTP, OAuth on first use).
- **Agentic workflows and local Actor development** — [Agent Skills](https://apify.com/.well-known/agent-skills/index.json) with the [Apify CLI](https://docs.apify.com/cli/docs.md): `npm install -g apify-cli`, then `apify login`.
- **JavaScript/TypeScript projects** — the official [JS/TS client](https://docs.apify.com/api/client/js/docs.md): `npm install apify-client`.
- **Python projects** — the official [Python client](https://docs.apify.com/api/client/python/docs.md): `pip install apify-client`.
- **Any other language** — the [REST API](https://docs.apify.com/api/v2.md).

For usage examples, see the [API](#api) section below.

For more details, see Apify documentation as [Markdown index](https://docs.apify.com/llms.txt) and [Markdown full-text](https://docs.apify.com/llms-full.txt).

# README

## Brazil Court Cases Scraper - DataJud CNJ 🇧🇷⚖️

**Consulta de processos judiciais brasileiros em lote | Brazilian lawsuit lookup and monitoring**

Fetch official metadata and the **complete movement history (movimentos)** of Brazilian court cases directly from **DataJud** - the public API of Brazil's National Council of Justice (CNJ), the central database behind the entire Brazilian judiciary.

No scraping fragile court websites. No CAPTCHAs. No expensive enterprise legal APIs. Official data, clean JSON.

### Why this actor / Por que usar

| | Enterprise legal APIs (Jusbrasil, Escavador, Judit) | This actor |
|---|---|---|
| Pricing | Enterprise contracts, long sales cycles | Pay per result, start in 1 minute |
| Source | Mixed (scraping + official) | 100% official CNJ DataJud |
| Setup | API integration + contract | Paste case numbers, click Run |

### What you get / O que você recebe

For each case number (número único CNJ):

- ✅ Case class and CNJ class code (classe processual)
- ✅ Subjects (assuntos)
- ✅ Court and judicial body (tribunal, órgão julgador)
- ✅ Degree/instance (grau), format, system, confidentiality level
- ✅ Filing date and last update timestamp
- ✅ **Full chronological movement history** with date, CNJ code and name of each movimento
- ✅ Last movement summary (great for monitoring dashboards)

### Key features / Recursos

- 🔔 **Monitoring mode (monitoramento processual)** - remembers each case's last movement and returns **only cases that moved** since the previous run, with a `novosMovimentos` field listing exactly what changed. Schedule it daily and you have a lawsuit alert system
- **Automatic court detection** - the actor reads the court segment inside the CNJ case number and routes the query: all 27 state courts (TJSP, TJRJ, TJMG...), federal courts TRF1-6, labor courts TRT1-24, TST and STJ
- **Batch processing** - paste hundreds of case numbers in one run
- **Search mode** - query a court by class code, judicial body and filing date range (up to 10,000 results)
- **Resilient** - automatic retry with backoff on rate limits

### Monitoring mode - how to set it up / Como monitorar

The reason Brazilian companies pay monthly for legal monitoring services is simple: nobody wants to open 300 case pages every morning. Here is the same thing as a scheduled actor:

1. Put your case numbers in `processNumbers`
2. Set `onlyNewMovements: true`
3. Schedule the actor daily
4. Add an Apify webhook on "Run succeeded" pointing to Slack, n8n, Make, Zapier or your API

First run returns every case (with `isNovoNoMonitoramento: true`). From then on, **a run with nothing new returns zero items** - so any result you receive is a real update worth reading.

```json
{
    "processNumbers": ["1500133-05.2025.8.26.0159", "0001234-56.2024.5.02.0011"],
    "onlyNewMovements": true,
    "monitorName": "client-acme"
}
```

Use `monitorName` to keep separate monitors (one per client, per portfolio) inside the same account.

### Use cases / Casos de uso

- **Monitoramento processual em lote**: track the status of every lawsuit in your portfolio with one scheduled run + webhook
- **Due diligence**: check status and progress of known lawsuits involving suppliers, customers or M\&A targets
- **Legal analytics**: case volume by class, court body and period
- **Feed your legal CRM/BI**: flat JSON ready for spreadsheets, Power BI, Metabase or your database

### Input

```json
{
    "processNumbers": [
        "1500133-05.2025.8.26.0159",
        "0001234-56.2024.5.02.0011"
    ],
    "includeMovements": true
}
```

| Field | Description |
|---|---|
| `processNumbers` | List of CNJ case numbers, with or without punctuation. Court auto-detected |
| `tribunalAlias` | Optional: force a court alias (`tjsp`, `trf3`, `trt2`, `stj`...) |
| `includeMovements` | `true` (default) returns the full movement list; `false` returns lighter metadata |
| `onlyNewMovements` | Monitoring mode: return only cases that moved since the last run |
| `monitorName` | Isolate monitoring state (one monitor per client/portfolio) |
| `searchTribunal` + filters | Search mode: court alias + `searchClasseCodigo`, `searchOrgaoCodigo`, `searchDateFrom/To`, `maxResults` |

### Output (one item per case)

```json
{
    "numeroProcesso": "15001330520258260159",
    "tribunal": "TJSP",
    "grau": "G1",
    "classeCodigo": 278,
    "classeNome": "Termo Circunstanciado",
    "assuntos": ["Crimes de Trânsito"],
    "orgaoJulgador": "JUIZADO ESPECIAL CIVEL CRIM. DE CUNHA",
    "dataAjuizamento": "2025-04-14T00:00:00.000Z",
    "ultimaAtualizacao": "2026-07-01T03:12:44.000Z",
    "quantidadeMovimentos": 37,
    "ultimoMovimentoData": "2026-06-30T18:16:58.000Z",
    "ultimoMovimentoNome": "Petição",
    "movimentos": [
        {"data": "2025-04-14T13:20:00.000Z", "codigo": 26, "nome": "Distribuição"},
        {"data": "2026-06-30T18:16:58.000Z", "codigo": 85, "nome": "Petição"}
    ]
}
```

### FAQ

**Does it return party names, CPF or CNPJ?**
No. The CNJ public dataset excludes party information (Brazilian privacy law - LGPD). You get case metadata and movements. If you already know the case numbers (from your own records, contracts or filings), this actor gives you everything else.

**Is this legal?**
Yes. DataJud is the official public API of the CNJ, created exactly for programmatic access to judicial metadata (CNJ Resolution 331/2020).

**Which courts are supported?**
Auto-detection: 27 state courts (TJ), TRF1-6, TRT1-24, TST, STJ. Other segments (electoral, military) can be queried by setting `tribunalAlias` manually with the DataJud alias.

**What if CNJ rotates the public API key?**
The actor ships with the current official public key and lets you override it via the `apiKey` input. Updates are released quickly when CNJ changes it.

**How fresh is the data?**
DataJud is fed by the courts themselves. Most courts sync daily; `ultimaAtualizacao` shows the exact timestamp per case.

### Support / Suporte

Found an issue or need a feature (another court segment, webhook integration, CSV export)? Open an issue on the actor page - responses within 24h. Fala português? Pode abrir a issue em português.

# Actor input Schema

## `processNumbers` (type: `array`):

Brazilian unified case numbers (numero unico CNJ), with or without punctuation. Example: 1500133-05.2025.8.26.0159. The court is detected automatically from the number.

## `tribunalAlias` (type: `string`):

Force a specific court alias (e.g. tjsp, trf3, trt2, stj). Leave empty for automatic detection from each case number.

## `includeMovements` (type: `boolean`):

If enabled, each result includes the complete list of case movements (movimentos). Disable for lighter results with only case metadata.

## `onlyNewMovements` (type: `boolean`):

Turn this on for scheduled monitoring (monitoramento processual). The actor remembers each case's last movement and returns only cases that moved since the previous run, with a novosMovimentos field listing exactly what changed. Perfect for daily alerts via webhook.

## `monitorName` (type: `string`):

Optional label to isolate the monitoring memory, e.g. 'client-acme'. Leave empty and the state is keyed automatically by your case list.

## `searchTribunal` (type: `string`):

Search mode (use when no case numbers are given): court alias to query, e.g. tjsp.

## `searchClasseCodigo` (type: `integer`):

Filter by CNJ class code, e.g. 1116 for tax enforcement (execucao fiscal).

## `searchOrgaoCodigo` (type: `integer`):

Filter by orgao julgador code.

## `searchDateFrom` (type: `string`):

ISO date, e.g. 2025-01-01

## `searchDateTo` (type: `string`):

ISO date, e.g. 2025-12-31

## `maxResults` (type: `integer`):

Maximum number of cases returned in search mode (API caps at 10000).

## `apiKey` (type: `string`):

Optional. Defaults to the official CNJ public key. Override only if CNJ rotates the key before this actor is updated.

## Actor input object example

```json
{
  "processNumbers": [
    "1500133-05.2025.8.26.0159"
  ],
  "includeMovements": true,
  "onlyNewMovements": false,
  "maxResults": 100
}
```

# API

You can run this Actor programmatically using our API. Below are code examples in JavaScript, Python, and CLI, as well as the OpenAPI specification and MCP server setup.

## JavaScript example

```javascript
import { ApifyClient } from 'apify-client';

// Initialize the ApifyClient with your Apify API token
// Replace the '<YOUR_API_TOKEN>' with your token
const client = new ApifyClient({
    token: '<YOUR_API_TOKEN>',
});

// Prepare Actor input
const input = {
    "processNumbers": [
        "1500133-05.2025.8.26.0159"
    ]
};

// Run the Actor and wait for it to finish
const run = await client.actor("sadzinn/datajud-processos-brasil").call(input);

// Fetch and print Actor results from the run's dataset (if any)
console.log('Results from dataset');
console.log(`💾 Check your data here: https://console.apify.com/storage/datasets/${run.defaultDatasetId}`);
const { items } = await client.dataset(run.defaultDatasetId).listItems();
items.forEach((item) => {
    console.dir(item);
});

// 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/js/docs

```

## Python example

```python
from apify_client import ApifyClient

# Initialize the ApifyClient with your Apify API token
# Replace '<YOUR_API_TOKEN>' with your token.
client = ApifyClient("<YOUR_API_TOKEN>")

# Prepare the Actor input
run_input = { "processNumbers": ["1500133-05.2025.8.26.0159"] }

# Run the Actor and wait for it to finish
run = client.actor("sadzinn/datajud-processos-brasil").call(run_input=run_input)

# Fetch and print Actor results from the run's dataset (if there are any)
print("💾 Check your data here: https://console.apify.com/storage/datasets/" + run["defaultDatasetId"])
for item in client.dataset(run["defaultDatasetId"]).iterate_items():
    print(item)

# 📚 Want to learn more 📖? Go to → https://docs.apify.com/api/client/python/docs/quick-start

```

## CLI example

```bash
echo '{
  "processNumbers": [
    "1500133-05.2025.8.26.0159"
  ]
}' |
apify call sadzinn/datajud-processos-brasil --silent --output-dataset

```

## MCP server setup

```json
{
    "mcpServers": {
        "apify": {
            "command": "npx",
            "args": [
                "mcp-remote",
                "https://mcp.apify.com/?tools=sadzinn/datajud-processos-brasil",
                "--header",
                "Authorization: Bearer <YOUR_API_TOKEN>"
            ]
        }
    }
}

```

## OpenAPI specification

Download the OpenAPI definition: https://api.apify.com/v2/acts/MLTQX26T33rBUUH3j/builds/ky9muzufxgjOTgfH4/openapi.json
