BrasilAPI CEP v2 icon

BrasilAPI CEP v2

Consulta CEP usando a BrasilAPI (v2)

BrasilAPI CEP v2

AI-generated

Overview

This node performs postal code (CEP) lookups for Brazilian addresses using the BrasilAPI v2 service. It is useful when you need to retrieve detailed address information based on a given CEP, such as street, neighborhood, city, and state data. Practical applications include form autofill for address fields, validating user input, or enriching customer data with location details.

Properties

Name Meaning
CEP The Brazilian postal code (CEP) to be queried. Must be provided as a string, e.g., "74310110".

Output

The node outputs an array of JSON objects, each corresponding to one input item. Each JSON object contains the address data returned by the BrasilAPI for the specified CEP. If the lookup is successful, the output includes detailed address information such as street, neighborhood, city, state, and other related fields.

If an error occurs during the request (e.g., invalid CEP or network issue), the output JSON will contain an error field with the error message and the original CEP value, allowing downstream nodes to handle failures gracefully.

Dependencies

  • Requires internet access to call the BrasilAPI endpoint: https://brasilapi.com.br/api/cep/v2/{cep}.
  • No special API keys or authentication tokens are needed.
  • The node uses HTTP GET requests to fetch data from the external BrasilAPI service.

Troubleshooting

  • Common issues:

    • Invalid or malformed CEP values may cause errors or empty responses.
    • Network connectivity problems can lead to request failures.
    • Rate limiting or downtime of the BrasilAPI service could result in errors.
  • Error messages:

    • The node returns an error message in the output JSON under the error key if the API request fails.
    • To resolve, verify the CEP format, check your internet connection, and ensure the BrasilAPI service is operational.

Links and References

Discussion