Gov APIportaltransparencia.gov.br ↗
Access Brazilian federal government data: public expenses, contracts, civil servants, benefits, travel records, sanctions, and tenders via a single structured API.
What is the Gov API?
This API exposes 10 endpoints covering Brazil's Federal Government Transparency Portal (portaltransparencia.gov.br), returning structured data on public expenditures, contracts, civil servants, sanctions, and more. The list_contracts endpoint alone returns fields like numeroContrato, dataAssinatura, situacao, and valorContratado. All monetary values are denominated in Brazilian Real, and every endpoint supports pagination via limit and offset parameters.
curl -X GET 'https://api.parse.bot/scraper/9e04b0c7-3205-4861-90a2-170abdecae1d/search_public_expenses?de=01%2F01%2F2024&ano=2026&ate=31%2F03%2F2024&mes=2&limit=3&offset=0' \ -H 'X-API-Key: $PARSE_API_KEY'
Typed, relational, agent-ready
A generated client with real types, enums, and the links between objects — the structure a flat JSON response can't carry. Autocompletes in your editor and reads cleanly to coding agents.
- Fully typed · autocompletes
- Objects link to objects
- Typed errors & pagination
Typed Python client. Set up the SDK in your uv project, then pull this API’s typed client:
uv add parse-sdk uv run parse init uv run parse add --marketplace portaltransparencia-gov-br-api
uv run parse add --marketplace pulls a pinned snapshot of this canonical API — it won’t change underneath you. To customize it, subscribe and swap to your own copy.
"""Walkthrough: Portal da Transparência SDK — bounded, re-runnable; every call capped."""
from parse_apis.portal_da_transparência_api import Transparencia, NotFoundError
transparencia = Transparencia()
# Search public expenses for Q1 2024
for expense in transparencia.expenses.search(de="01/01/2024", ate="31/03/2024", limit=3):
print(expense.mes_ano, expense.orgao_superior, expense.valor_despesa_paga)
# List civil servants named "MARIA" and drill into one's remuneration details
server = transparencia.servers.list(name="MARIA", limit=1).first()
if server:
print(server.nome, server.cargo, server.situacao)
detail = server.details.get()
for remuneration in detail.remunerations[:2]:
print(remuneration.period, remuneration.data)
# List government contracts
for contract in transparencia.contracts.list(de="01/01/2024", ate="31/03/2024", limit=3):
print(contract.numero_contrato, contract.orgao_superior, contract.valor_contratado)
# Check administrative sanctions with typed error handling
try:
for sanction in transparencia.sanctions.list(limit=3):
print(sanction.nome_sancionado, sanction.cadastro, sanction.cpf_cnpj)
except NotFoundError as exc:
print(f"not found: {exc}")
print("exercised: expenses.search / servers.list / server.details.get / contracts.list / sanctions.list")
Search public expenditure records by period. Returns paginated results ordered by month/year descending. Each record includes the government organ, budget function, expense group, and committed/liquidated/paid amounts in Brazilian Real format.
| Param | Type | Description |
|---|---|---|
| de | string | Start date in DD/MM/YYYY format. |
| ate | string | End date in DD/MM/YYYY format. |
| limit | integer | Maximum number of results per page. |
| offset | integer | Pagination offset (number of records to skip). |
{
"type": "object",
"fields": {
"data": "array of expenditure records with fields like mesAno, orgaoSuperior, funcao, valorDespesaEmpenhada, valorDespesaPaga",
"draw": "integer draw counter",
"error": "string or null error message",
"recordsTotal": "integer total records available",
"recordsFiltered": "integer total filtered records"
},
"sample": {
"data": {
"data": [
{
"funcao": "14 - Direitos da cidadania",
"mesAno": "03/2024",
"subFuncao": "122 - Administração geral",
"orgaoSuperior": "84000 - Ministério dos Povos Indígenas",
"valorDespesaPaga": "1.369.506,80",
"valorDespesaEmpenhada": "124.557,24"
}
],
"draw": 0,
"error": null,
"recordsTotal": 9223372036854776000,
"recordsFiltered": 9223372036854776000
},
"status": "success"
}
}About the Gov API
Public Expenditure Data
Three endpoints cover federal spending from different angles. search_public_expenses returns individual expenditure records with fields mesAno, orgaoSuperior, funcao, valorDespesaEmpenhada, valorDespesaPaga, and related amounts, filterable by date range using de and ate in DD/MM/YYYY format. get_expenses_by_organ aggregates the same budget execution data per government organ, useful for comparing committed vs. paid amounts across ministries. get_expenses_by_functional_programmatic breaks spending down by funcao and subFuncao budget classification categories.
Civil Servants and Benefits
list_servers returns a paginated roster of federal civil servants with masked CPF, organ assignment (orgaoServidorLotacao), position (cargo), and employment status (situa). An optional name substring filter narrows results. To get salary history, pass the numeric portion of idComFlagExisteDetalhamentoServidor (everything before the underscore) to get_server_details, which returns monthly remuneration breakdowns alongside name, state (UF), and masked CPF. list_benefits covers social benefit program disbursements at the state and municipality level, including uf, municipio, mesAno, and valor.
Contracts, Tenders, Travel, and Sanctions
list_contracts returns public procurement contracts with signing date, validity, contracting organ, contract value, and status. list_public_tenders covers procurement tenders with fields idLicitacao, modalidade, dataAbertura, and dataResultadoCompra, ordered by result date. list_travel exposes official government travel records including traveler name, destination (destinos), organ, total cost (valorTotal), and an urgency flag, ordered by departure date. list_sanctions returns CEIS/CEPIM registry entries for sanctioned individuals and entities, including cpfCnpj, nomeSancionado, cadastro, and dataInicialSancao.
Pagination and Date Filtering
All endpoints return recordsTotal and recordsFiltered alongside a draw counter, making it straightforward to implement cursor-style pagination. Date range filters (de, ate) accept DD/MM/YYYY strings. list_sanctions does not expose date filtering — it returns all records subject to pagination only.
The Gov API is a managed, monitored endpoint for portaltransparencia.gov.br — not a raw scraper you maintain. Every endpoint is automatically health-checked on a schedule, and when portaltransparencia.gov.br changes and a check fails, the API is automatically queued for repair and re-verified. It is built to keep working as the site underneath it changes.
This isn't an official portaltransparencia.gov.br API — it's an independent, maintained REST wrapper over public data. Where the source has no official API (or only a limited one), Parse gives you a stable contract over a source that never promised one, and keeps it current. Need a new endpoint or field? You can revise it yourself in plain English and the agent rebuilds it against the live site in minutes — contributing the change back to the shared API is free.
Will this API break when the source site changes?+
Is this an official API from the source site?+
Can I fix or extend this API myself if I need a new endpoint or field?+
What happens if I call an endpoint that has an issue?+
- Monitor monthly federal spending by ministry using
get_expenses_by_organand track changes invalorDespesaPagaover time. - Build a contractor due-diligence tool by cross-referencing
list_contractsvendor data againstlist_sanctionsCEIS/CEPIM entries. - Audit civil servant payroll by retrieving remuneration history via
get_server_detailsusing IDs sourced fromlist_servers. - Track social program disbursements by state and municipality using
list_benefitswithufandmunicipiofields. - Analyze procurement activity by querying
list_public_tendersfor tender modalities and result dates within a given period. - Flag government travel expense anomalies by querying
list_travelfor highvalorTotalrecords or urgency-flagged trips. - Map budget allocation by functional category using
get_expenses_by_functional_programmaticacrossfuncaoandsubFuncaofields.
| Tier | Price | Credits/month | Rate limit |
|---|---|---|---|
| Free | $0/mo | 100 | 5 req/min |
| Hobby | $30/mo | 1,000 | 20 req/min |
| Developer | $100/mo | 5,000 | 100 req/min |
One credit = one API call regardless of which marketplace API you call. Exceeding the rate limit returns a 429 response. Authenticate with the X-API-Key header.
Does portaltransparencia.gov.br have an official developer API?+
How does the civil servant lookup work across `list_servers` and `get_server_details`?+
list_servers returns a paginated list of federal employees. Each record includes an idComFlagExisteDetalhamentoServidor field formatted as {numericId}_{flag} (e.g. 3604575_1). To retrieve monthly remuneration history and personal details for a specific servant, pass only the numeric portion before the underscore to get_server_details as the server_id parameter.Can I filter sanctions records by date range or by sanction type (CEIS vs CEPIM)?+
list_sanctions does not currently support date or registry-type filtering — it returns all available sanction records ordered by sanctioned entity name, paginated via limit and offset. The cadastro field in each record identifies the registry type (CEIS or CEPIM). You can fork this API on Parse and revise it to add a filter parameter for cadastro or dataInicialSancao.Does the API cover state-level (estadual) or municipal government spending, not just federal?+
list_benefits includes state (uf) and municipality (municipio) fields, but those reflect where federal social benefits were disbursed, not state budget execution. You can fork this API on Parse and revise it to target state transparency portals where available.Are contracted values and expenses returned as numbers or formatted strings?+
valorDespesaEmpenhada, valorDespesaPaga, and valorContratado are returned in Brazilian Real format as strings (e.g. "R$ 1.234,56"). Downstream applications that need numeric computation should parse these strings to floats before processing.