Brasil API icon

Brasil API

Consulta endpoints públicos da BrasilAPI

Overview

This node integrates with BrasilAPI, a public API providing various Brazilian data endpoints. Specifically, the "IBGE – UF por Código" operation fetches information about a Brazilian state (Unidade Federativa - UF) based on its numeric code. This is useful for workflows that need to translate or validate state codes into detailed state information such as name, abbreviation, and other metadata.

Practical examples include:

  • Validating user input where only the state code is provided.
  • Enriching datasets by converting state codes into full state details.
  • Automating address normalization or geographic reporting tasks.

Properties

Name Meaning
Código UF The numeric code of the Brazilian state (UF) to retrieve information for. Default is 35.

Output

The output is a JSON object containing the details of the Brazilian state corresponding to the provided code. The exact structure depends on the BrasilAPI response but typically includes fields like:

  • State name
  • State abbreviation (sigla)
  • Region
  • Other relevant metadata about the state

The node outputs this data in the json field of the item. There is no binary data output.

Example output snippet (illustrative):

{
  "id": 35,
  "sigla": "SP",
  "nome": "São Paulo",
  "regiao": {
    "id": 3,
    "sigla": "SE",
    "nome": "Sudeste"
  }
}

Dependencies

  • Requires internet access to call the BrasilAPI public endpoints.
  • No authentication or API keys are needed since BrasilAPI is publicly accessible.
  • Uses the HTTP client library internally to perform GET requests with a 10-second timeout.

Troubleshooting

  • Timeouts or network errors: Ensure the n8n instance has internet connectivity and can reach https://brasilapi.com.br.
  • Unsupported operation error: Occurs if an invalid operation is selected; ensure "IBGE – UF por Código" is chosen.
  • Invalid code input: If the provided state code does not exist, the API may return an error or empty result. Validate the code before use.
  • Unexpected API changes: Since the node relies on an external API, any changes or downtime on BrasilAPI could affect functionality.

Links and References

Discussion