Skip to content

cleisabino/datajud-cli

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

datajud-cli

A command-line tool to query Brazilian judicial process data from the CNJ DataJud public API.

Features

  • Query a process by its CNJ number (with or without formatting mask)
  • Output as table, JSON, or CSV
  • Local cache (24h TTL) to avoid repeated API calls
  • Supports multiple tribunals (TJBA, TJSP, TRF1, TJMG, STJ)
  • Retry with backoff on rate limits
  • Bulk query from file
  • Installable via pipx install datajud-cli

Installation

git clone https://github.com/cleisabino/datajud-cli.git
cd datajud-cli
python -m venv .venv
source .venv/bin/activate
pip install -e .

Copy .env.example to .env and add your DataJud API key:

cp .env.example .env
# edit .env and set DATAJUD_API_KEY

Get the public API key at: https://datajud-wiki.cnj.jus.br/api-publica/acesso/

Usage

Query a process

# with formatting mask (auto-normalized)
datajud query 8050490-37.2021.8.05.0001

# raw 20-digit number
datajud query 80504903720218050001

# different tribunal
datajud query 8050490-37.2021.8.05.0001 --tribunal tjsp

Output formats

# default: formatted table
datajud query 8050490-37.2021.8.05.0001

# JSON
datajud query 8050490-37.2021.8.05.0001 --json

# CSV (pipeable)
datajud query 8050490-37.2021.8.05.0001 --csv >> processos.csv

Cache

# skip cache and hit the API directly
datajud query 8050490-37.2021.8.05.0001 --no-cache

# clear local cache
datajud limpar-cache

Supported tribunals

Sigla Tribunal
tjba Tribunal de Justiça da Bahia
tjsp Tribunal de Justiça de São Paulo
trf1 Tribunal Regional Federal da 1ª Região
tjmg Tribunal de Justiça de Minas Gerais
stj Superior Tribunal de Justiça

Tech stack

Running tests

pytest tests/ -v

License

MIT — see LICENSE.


Built by Clei Sabino · Senior Backend Engineer · 7+ years building legal systems for Brazilian public sector.

About

CLI tool to query Brazilian judicial process data from CNJ's DataJud public API. Python.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages