Senado Federal
Use official Senate data for factual legislative research and reproducible integrations.
- Legislative API:
https://legis.senado.leg.br/dadosabertos - Legislative Swagger:
https://legis.senado.leg.br/dadosabertos/api-docs/swagger-ui/index.html - Administrative API:
https://adm.senado.gov.br/adm-dadosabertos - Authentication: none
Route the task
- Read references/api-endpoints.md for legislative endpoints.
- Read references/response-shapes.md for nested JSON, historical cohorts, dates, and process identifiers.
- Read references/administrative-api.md for CEAP, personnel, procurement, and upstream-failure safeguards.
- Read references/cross-house.md when a proposal moved between the Senate and Chamber.
- For a quick inspection, run
python3 scripts/senado.py <command>. - For reusable Python code, import
SenadoClientorSenadoAdmClientfromsenado_client.py.
Core workflow
- Resolve the senator, matter, or legislative process to its official identifier before requesting details.
- Use
/senador/lista/atual.jsononly for current officeholders. For a historical cohort, query/senador/lista/legislatura/{legislatura}/{legislatura}.json?exercicio=S; the single-legislature route has produced a single record instead of the cohort. - Prefer
/processofor searches by author and for cross-house status. Theautorparameter on/materia/pesquisa/listais not reliable. - Parse the documented key path for the endpoint and normalize a terminal object or list with
as_list. Never use the first arbitrary list found by a depth-first search as a business result. - Preserve the distinction between
IdentificacaoProcessoand a SenateCodigoMateria; they are not interchangeable. - For current-day queries, interpret “today” in
America/Sao_Pauloand state the retrieval date when freshness matters. - Cite or return the exact API URL used when the answer needs to be auditable.
Important contracts
- Most legislative endpoints accept a
.jsonsuffix;/processosearch is queried without it. - Senator speeches use
dataInianddataFiminYYYYMMDD. Query one calendar year at a time because broad multi-year ranges can fail or time out. - Senator detail resources wrap results under endpoint-specific roots such as
DiscursosParlamentar,MateriasAutoriaParlamentar,MateriasRelatoriaParlamentar,VotacaoParlamentar,MembroComissaoParlamentar, andMandatoParlamentar. - A single result may be an object while multiple results are a list. Normalize only the expected terminal field.
- Administrative endpoints may return a raw list or
{ "data": [...] }; reject other success shapes instead of silently treating them as empty. - CEAP monetary values use
valorReembolsado, notvalor.
Python clients
from senado_client import SenadoAdmClient, SenadoClient
client = SenadoClient()
try:
senadores = await client.buscar_senador_por_nome("nome")
processos = await client.pesquisar_processos(
autor=senadores[0]["IdentificacaoParlamentar"]["NomeParlamentar"],
tramitando=True,
)
autorias = await client.get_autorias_senador(senadores[0]["IdentificacaoParlamentar"]["CodigoParlamentar"])
finally:
await client.close()
adm = SenadoAdmClient()
try:
despesas = await adm.get_ceap(2026)
total = sum(float(item["valorReembolsado"]) for item in despesas)
finally:
await adm.close()
Output discipline
- Separate Senate data from interpretation.
- Include the matter identification, process ID, current situation, responsible body, and latest relevant movement when available.
- Treat “no records” and “the administrative API failed” as different outcomes.
- For expenses, state the year, field aggregated, currency treatment, and filtering criteria.
