| Title: | Access the 'ObrasGov' Open Data API |
| Version: | 0.1.0 |
| Description: | Provides a modern interface to the Brazilian federal government's 'ObrasGov' open data application programming interface (https://api-publica.obrasgov.gestao.gov.br). Retrieves data about public infrastructure projects, physical execution, contracts, commitments, geometries, feasibility studies, and project status histories. Results are returned as tidy tibbles with typed date columns, preserved nested relationships, pagination metadata, and optional multi-page collection. |
| License: | MIT + file LICENSE |
| URL: | https://github.com/StrategicProjects/obrasgovr, https://strategicprojects.github.io/obrasgovr/, https://api-publica.obrasgov.gestao.gov.br/obras/docs |
| BugReports: | https://github.com/StrategicProjects/obrasgovr/issues |
| Depends: | R (≥ 4.1.0) |
| Imports: | cli, httr2 (≥ 1.2.2), purrr (≥ 1.0.0), rlang (≥ 1.1.0), tibble (≥ 3.2.0) |
| Suggests: | covr, dplyr, knitr, rmarkdown, testthat (≥ 3.2.0), tidyr |
| VignetteBuilder: | knitr |
| Config/Needs/website: | pkgdown |
| Config/testthat/edition: | 3 |
| Encoding: | UTF-8 |
| Language: | en-US |
| Config/roxygen2/version: | 8.0.0 |
| NeedsCompilation: | no |
| Packaged: | 2026-07-16 19:26:18 UTC; leite |
| Author: | Andre Leite |
| Maintainer: | Andre Leite <leite@castlab.org> |
| Repository: | CRAN |
| Date/Publication: | 2026-07-24 09:30:09 UTC |
obrasgovr: Access ObrasGov open data
Description
obrasgovr provides a modern, typed interface to the ObrasGov open data
API. Each API resource is represented by a function that returns a
tibble::tibble(), preserving nested relationships in list-columns.
Details
Requests use HTTP/2 over TLS when supported by libcurl, with automatic
retries for transient failures and responsible request throttling. The API
does not require authentication.
Options
-
obrasgovr.base_url: alternative API base URL. -
obrasgovr.timeout: timeout for each request, in seconds. -
obrasgovr.user_agent: alternative HTTP user agent.
Author(s)
Maintainer: Andre Leite leite@castlab.org (ORCID)
Authors:
Andre Leite leite@castlab.org (ORCID)
Marcos Wasiliew marcos.wasiliew@sepe.pe.gov.br
Hugo Vasconcelos hugo.vasconcelos@ufpe.br (ORCID)
Carlos Amorim carlos.agaf@ufpe.br (ORCID)
Diogo Bezerra diogo.bezerra@ufpe.br (ORCID)
See Also
Retrieve budget commitments
Description
Retrieve budget commitments
Usage
get_commitments(
...,
page = 1L,
page_size = 50L,
all_pages = FALSE,
page_limit = Inf,
base_url = .obrasgovr_base_url()
)
obter_empenhos(
...,
pagina = 1L,
tamanho_da_pagina = 50L,
todas_paginas = FALSE,
limite_paginas = Inf,
base_url = .obrasgovr_base_url()
)
Arguments
... |
Named filters. See |
page |
First page to retrieve, starting at 1. |
page_size |
Number of records per page, between 1 and 200. |
all_pages |
If |
page_limit |
Maximum number of pages to retrieve when |
base_url |
HTTPS base URL. By default, uses the |
pagina, tamanho_da_pagina, todas_paginas, limite_paginas |
Portuguese
aliases for |
Value
A tibble containing budget commitments and financial execution amounts.
See Also
Other API resources:
get_contracts(),
get_feasibility_studies(),
get_geometries(),
get_last_update(),
get_physical_execution(),
get_projects(),
get_status_history()
Examples
if (interactive()) {
get_commitments(id_projeto_investimento = "134851.26-07")
}
Retrieve contracts
Description
Retrieve contracts
Usage
get_contracts(
...,
page = 1L,
page_size = 50L,
all_pages = FALSE,
page_limit = Inf,
base_url = .obrasgovr_base_url()
)
obter_contratos(
...,
pagina = 1L,
tamanho_da_pagina = 50L,
todas_paginas = FALSE,
limite_paginas = Inf,
base_url = .obrasgovr_base_url()
)
Arguments
... |
Named filters. See |
page |
First page to retrieve, starting at 1. |
page_size |
Number of records per page, between 1 and 200. |
all_pages |
If |
page_limit |
Maximum number of pages to retrieve when |
base_url |
HTTPS base URL. By default, uses the |
pagina, tamanho_da_pagina, todas_paginas, limite_paginas |
Portuguese
aliases for |
Value
A tibble containing contracts linked to infrastructure projects.
See Also
Other API resources:
get_commitments(),
get_feasibility_studies(),
get_geometries(),
get_last_update(),
get_physical_execution(),
get_projects(),
get_status_history()
Examples
if (interactive()) {
get_contracts(id_projeto_investimento = "134851.26-07")
}
Retrieve feasibility studies
Description
Retrieve feasibility studies
Usage
get_feasibility_studies(
...,
page = 1L,
page_size = 50L,
all_pages = FALSE,
page_limit = Inf,
base_url = .obrasgovr_base_url()
)
obter_estudos_viabilidade(
...,
pagina = 1L,
tamanho_da_pagina = 50L,
todas_paginas = FALSE,
limite_paginas = Inf,
base_url = .obrasgovr_base_url()
)
Arguments
... |
Named filters. See |
page |
First page to retrieve, starting at 1. |
page_size |
Number of records per page, between 1 and 200. |
all_pages |
If |
page_limit |
Maximum number of pages to retrieve when |
base_url |
HTTPS base URL. By default, uses the |
pagina, tamanho_da_pagina, todas_paginas, limite_paginas |
Portuguese
aliases for |
Value
A tibble containing feasibility studies linked to projects.
See Also
Other API resources:
get_commitments(),
get_contracts(),
get_geometries(),
get_last_update(),
get_physical_execution(),
get_projects(),
get_status_history()
Examples
if (interactive()) {
get_feasibility_studies(id_projeto_investimento = "134851.26-07")
}
Retrieve geometries
Description
Retrieve geometries
Usage
get_geometries(
...,
page = 1L,
page_size = 50L,
all_pages = FALSE,
page_limit = Inf,
base_url = .obrasgovr_base_url()
)
obter_geometrias(
...,
pagina = 1L,
tamanho_da_pagina = 50L,
todas_paginas = FALSE,
limite_paginas = Inf,
base_url = .obrasgovr_base_url()
)
Arguments
... |
Named filters. See |
page |
First page to retrieve, starting at 1. |
page_size |
Number of records per page, between 1 and 200. |
all_pages |
If |
page_limit |
Maximum number of pages to retrieve when |
base_url |
HTTPS base URL. By default, uses the |
pagina, tamanho_da_pagina, todas_paginas, limite_paginas |
Portuguese
aliases for |
Value
A tibble containing geometries and territorial identifiers.
See Also
Other API resources:
get_commitments(),
get_contracts(),
get_feasibility_studies(),
get_last_update(),
get_physical_execution(),
get_projects(),
get_status_history()
Examples
if (interactive()) {
get_geometries(sg_uf = "PE", page_size = 10)
}
Retrieve the data update timestamp
Description
Retrieve the data update timestamp
Usage
get_last_update(base_url = .obrasgovr_base_url())
obter_data_atualizacao(base_url = .obrasgovr_base_url())
Arguments
base_url |
HTTPS base URL. By default, uses the |
Value
A POSIXct value in the UTC time zone.
See Also
Other API resources:
get_commitments(),
get_contracts(),
get_feasibility_studies(),
get_geometries(),
get_physical_execution(),
get_projects(),
get_status_history()
Examples
if (interactive()) {
get_last_update()
}
Retrieve physical execution data
Description
Retrieve physical execution data
Usage
get_physical_execution(
...,
page = 1L,
page_size = 50L,
all_pages = FALSE,
page_limit = Inf,
base_url = .obrasgovr_base_url()
)
obter_execucao_fisica(
...,
pagina = 1L,
tamanho_da_pagina = 50L,
todas_paginas = FALSE,
limite_paginas = Inf,
base_url = .obrasgovr_base_url()
)
Arguments
... |
Named filters. See |
page |
First page to retrieve, starting at 1. |
page_size |
Number of records per page, between 1 and 200. |
all_pages |
If |
page_limit |
Maximum number of pages to retrieve when |
base_url |
HTTPS base URL. By default, uses the |
pagina, tamanho_da_pagina, todas_paginas, limite_paginas |
Portuguese
aliases for |
Value
A tibble containing execution percentages, instruments, and dates.
See Also
Other API resources:
get_commitments(),
get_contracts(),
get_feasibility_studies(),
get_geometries(),
get_last_update(),
get_projects(),
get_status_history()
Examples
if (interactive()) {
get_physical_execution(id_projeto_investimento = "134851.26-07")
}
Retrieve infrastructure projects
Description
Retrieves infrastructure projects and their nested relationships, including executors, recipients, funding sources, policy areas, and point geometries.
Usage
get_projects(
...,
page = 1L,
page_size = 50L,
all_pages = FALSE,
page_limit = Inf,
base_url = .obrasgovr_base_url()
)
obter_projetos(
...,
pagina = 1L,
tamanho_da_pagina = 50L,
todas_paginas = FALSE,
limite_paginas = Inf,
base_url = .obrasgovr_base_url()
)
Arguments
... |
Named filters accepted by the resource. See the complete list
with |
page |
First page to retrieve, starting at 1. |
page_size |
Number of records per page, between 1 and 200. |
all_pages |
If |
page_limit |
Maximum number of pages to retrieve when |
base_url |
HTTPS base URL. By default, uses the |
pagina, tamanho_da_pagina, todas_paginas, limite_paginas |
Portuguese
aliases for |
Value
A tibble. One-to-many relationships are preserved in list-columns.
Use result_metadata() to inspect pagination information.
See Also
Other API resources:
get_commitments(),
get_contracts(),
get_feasibility_studies(),
get_geometries(),
get_last_update(),
get_physical_execution(),
get_status_history()
Examples
if (interactive()) {
get_projects(uf_principal = "PE", page_size = 10)
}
Retrieve project status histories
Description
Retrieves the histories of cancelled or suspended projects, including reasons and remedial actions.
Usage
get_status_history(
...,
page = 1L,
page_size = 50L,
all_pages = FALSE,
page_limit = Inf,
base_url = .obrasgovr_base_url()
)
obter_historico_situacao(
...,
pagina = 1L,
tamanho_da_pagina = 50L,
todas_paginas = FALSE,
limite_paginas = Inf,
base_url = .obrasgovr_base_url()
)
Arguments
... |
Named filters. See |
page |
First page to retrieve, starting at 1. |
page_size |
Number of records per page, between 1 and 200. |
all_pages |
If |
page_limit |
Maximum number of pages to retrieve when |
base_url |
HTTPS base URL. By default, uses the |
pagina, tamanho_da_pagina, todas_paginas, limite_paginas |
Portuguese
aliases for |
Value
A tibble containing project status histories.
See Also
Other API resources:
get_commitments(),
get_contracts(),
get_feasibility_studies(),
get_geometries(),
get_last_update(),
get_physical_execution(),
get_projects()
Examples
if (interactive()) {
get_status_history(id_projeto_investimento = "134851.26-07")
}
List filters accepted by a resource
Description
Lists the filters published in the OpenAPI contract supported by this package. Unknown filters are rejected before a request is sent to prevent silently incorrect queries. Filter names and categorical values remain in Portuguese because they are part of the upstream API contract.
Usage
list_filters(resource)
obrasgov_filtros(recurso)
Arguments
resource |
A resource name returned by |
recurso |
Portuguese alias for |
Value
A tibble containing filter names, expected types, and allowed values when applicable.
Examples
list_filters("projects")
List available ObrasGov API resources
Description
List available ObrasGov API resources
Usage
list_resources()
obrasgov_recursos()
Value
A tibble containing each resource name, its corresponding function, API endpoint, and whether it is paginated.
Examples
list_resources()
Retrieve pagination metadata
Description
Retrieve pagination metadata
Usage
result_metadata(x)
obrasgov_metadados(x)
Arguments
x |
A tibble returned by a paginated package function. |
Value
A list containing the resource, totals reported by the API, and
retrieved pages; NULL for other objects.
Examples
result_metadata(tibble::tibble())