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. It allows users to query diverse information such as postal codes (CEP), bank details, currency exchange rates, company registration data (CNPJ), vehicle pricing, weather forecasts, and more.

The node is useful for automating workflows that require up-to-date Brazilian public data without manual lookup. For example:

  • Validating or enriching addresses by fetching detailed CEP information.
  • Retrieving bank information by code for financial applications.
  • Getting currency exchange rates for financial calculations.
  • Accessing vehicle price tables for automotive services.
  • Fetching weather forecasts for planning or alerting systems.

Specifically, the "CEP (v1)" operation fetches address data based on a Brazilian postal code (CEP).

Properties

Name Meaning
CEP The Brazilian postal code (CEP) to look up. This should be a string representing the postal code.

Output

The node outputs JSON data corresponding to the selected operation's response from BrasilAPI.

For the "CEP (v1)" operation, the output JSON contains detailed address information related to the provided postal code, typically including fields like street, neighborhood, city, state, and other relevant location data.

No binary data output is produced by this node.

Example output structure for CEP (v1):

{
  "cep": "01001-000",
  "state": "SP",
  "city": "São Paulo",
  "neighborhood": "Sé",
  "street": "Praça da Sé",
  "service": "viacep"
}

Dependencies

  • The node depends on the external BrasilAPI service available at https://brasilapi.com.br/api.
  • No authentication or API keys are required to use this API.
  • The node uses HTTP GET requests with a timeout of 10 seconds per request.
  • No additional n8n credentials or environment variables are necessary.

Troubleshooting

  • Timeouts: If the API does not respond within 10 seconds, the request will fail. Ensure network connectivity and BrasilAPI availability.
  • Invalid CEP: Providing an invalid or non-existent CEP may result in an error or empty response. Validate input CEP format before using.
  • Unsupported Operation: If an unsupported operation value is set, the node throws an error indicating the operation is unsupported.
  • API Changes: Since the node relies on a public API, changes or downtime in BrasilAPI can cause failures. Check BrasilAPI status if issues arise.

Links and References

Discussion