SDKs overview

The Brazilian Chamber of Deputies Open Data API provides programmatic access to legislative information, including data on deputies, propositions, voting, and events. While there are no officially released SDKs by the Chamber of Deputies, the API is designed as a RESTful interface, making it accessible through standard HTTP client libraries available in most programming languages. This allows developers to construct their own client applications by directly interacting with the API endpoints. Community-developed libraries have emerged to facilitate this interaction, offering language-specific wrappers for common data retrieval tasks.

Developers can explore the available endpoints and data models through the interactive Swagger UI for the Chamber of Deputies API, which details HTTP methods, parameters, and response structures. Access to the API is generally open and does not require authentication for public data. The API's foundation on HTTP/S principles aligns with widely adopted web standards, as documented by organizations like the World Wide Web Consortium on HTTP and URLs, ensuring broad compatibility with client technologies.

Official SDKs by language

As of 2026-05-29, the Brazilian Chamber of Deputies Open Data initiative has not released official SDKs for specific programming languages. The API is intended to be consumed directly via standard HTTP requests. This approach mandates that developers use generic HTTP client libraries native to their chosen programming environment to interact with the API endpoints directly. Information on the API specifications is available through the official documentation portal of the Brazilian Chamber of Deputies, which guides developers on how to make requests and interpret responses.

Installation

Since there are no official SDKs, installation typically involves setting up a generic HTTP client library within your chosen programming language. The following demonstrates common methods for installing HTTP client libraries in Python and R, two languages frequently used for data analysis and civic tech applications.

Python

For Python, the requests library is a common choice for making HTTP requests due to its user-friendly API. Installation is performed via pip, Python's package installer.

pip install requests

Alternatively, if you're working in a data science environment, libraries like pandas and json (built-in) can be used alongside requests for data processing. The requests library's documentation provides comprehensive installation and usage instructions.

R

In R, the httr package is popular for interacting with web APIs. It provides functions for constructing HTTP requests and parsing responses.

install.packages("httr")
install.packages("jsonlite") # For JSON parsing

The httr package integrates well with other R packages for data manipulation, such as dplyr, and is commonly used in conjunction with jsonlite for handling JSON data returned by RESTful APIs. For more details on R package management, refer to the CRAN documentation for R packages.

Quickstart example

This quickstart demonstrates how to fetch a list of deputies from the Brazilian Chamber of Deputies Open Data API using Python and the requests library. This example illustrates a direct API call, which is the standard approach given the absence of official SDKs.

Python example

This Python snippet retrieves the first page of deputies, processes the JSON response, and prints the names of the deputies. It utilizes the requests library for HTTP communication and the built-in json module for parsing the API response.

import requests
import json

# Base URL for the Chamber of Deputies API
BASE_URL = "https://dadosabertos.camara.leg.br/api/v2"

# Endpoint for deputies
DEPUTIES_ENDPOINT = f"{BASE_URL}/deputados"

def get_deputies():
    try:
        response = requests.get(DEPUTIES_ENDPOINT, params={'itens': 10}) # Request 10 items
        response.raise_for_status()  # Raise an HTTPError for bad responses (4xx or 5xx)
        data = response.json() # Parse JSON response
        
        print("Successfully fetched deputies data.\n")
        print("List of Deputies (first 10):\n")
        
        if 'dados' in data:
            for deputy in data['dados']:
                print(f"  Name: {deputy.get('nome')}, Party: {deputy.get('siglaPartido')}, State: {deputy.get('siglaEstado')}")
        else:
            print("No 'dados' key found in the API response.")

    except requests.exceptions.HTTPError as http_err:
        print(f"HTTP error occurred: {http_err}")  # e.g. 404, 500
    except requests.exceptions.ConnectionError as conn_err:
        print(f"Connection error occurred: {conn_err}") # e.g. DNS failure, refused connection
    except requests.exceptions.Timeout as timeout_err:
        print(f"Timeout error occurred: {timeout_err}")
    except requests.exceptions.RequestException as req_err:
        print(f"An unexpected error occurred: {req_err}")
    except json.JSONDecodeError:
        print("Failed to decode JSON response.")

if __name__ == "__main__":
    get_deputies()

This example demonstrates basic error handling for network issues and HTTP status codes, which is crucial for robust API client development. Further details on API endpoints and parameters can be found in the Brazilian Chamber of Deputies API reference.

Community libraries

While official SDKs are not provided, the developer community has created libraries that simplify interaction with the Brazilian Chamber of Deputies Open Data API, particularly for data analysis and civic tech projects. These libraries often wrap common API calls, handle pagination, and provide convenience functions.

Python

One notable community library for Python is dadosabertos-camara. This library aims to abstract the direct HTTP requests, providing a more Pythonic interface to access data from the Chamber of Deputies. It typically handles URL construction and JSON parsing internally, allowing developers to focus on data utilization rather than API mechanics.

Library Name Description Installation Command Maturity
dadosabertos-camara Python wrapper for the Chamber of Deputies Open Data API. Simplifies data retrieval for deputies, propositions, and events. pip install dadosabertos-camara Community-maintained, active.

R

For R users, packages like opendatacamara have been developed to integrate Chamber of Deputies data into the R ecosystem. These packages are designed to make the API data readily available for statistical analysis and visualization within R environments.

Library Name Description Installation Command Maturity
opendatacamara R package to access data from the Brazilian Chamber of Deputies Open Data API. Integrates with typical R data workflows. install.packages("opendatacamara") Community-maintained, active.

These community-driven efforts demonstrate the utility of the Open Data API for various applications, from academic research to civic engagement platforms. Developers relying on these libraries should consult their respective documentation for the most up-to-date installation and usage instructions, as well as information on any dependencies or specific contribution guidelines. Community libraries often have their own API documentation and may evolve independently of the official API updates.