BrasilAPI CEP
AI-generatedOverview
This node performs postal code (CEP) lookups for Brazilian addresses using the BrasilAPI service. It is useful when you need to retrieve address details such as street, neighborhood, city, and state based on a given CEP. Practical applications include form autofill, address validation, or enriching customer data with location information.
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 BrasilAPI for the specified CEP. If the lookup is successful, the output JSON includes fields like street, neighborhood, city, state, and others as provided by the API.
In case of an error (e.g., invalid CEP or network issue), the output JSON will contain an error field with the error message and the original cep value that caused the failure.
Example successful output JSON:
{
"cep": "74310110",
"state": "GO",
"city": "Goiânia",
"neighborhood": "Setor Central",
"street": "Rua 1"
}
Example error output JSON:
{
"error": "CEP not found",
"cep": "00000000"
}
Dependencies
- Requires internet access to call the BrasilAPI endpoint:
https://brasilapi.com.br/api/cep/v1/{cep} - No additional credentials are needed.
- The node uses HTTP GET requests to fetch data from the public BrasilAPI service.
Troubleshooting
Common issues:
- Invalid or malformed CEP input may cause errors or empty results.
- Network connectivity problems can prevent API calls.
- BrasilAPI service downtime or rate limiting could result in errors.
Error messages:
"CEP not found"indicates the CEP does not exist or is not recognized by the API.- Other HTTP or network errors will be reported in the
errorfield of the output JSON.
Resolution tips:
- Ensure the CEP is correctly formatted (only digits, no spaces or special characters).
- Verify internet connection and API availability.
- Handle error outputs gracefully in your workflow to avoid interruptions.
Links and References
- BrasilAPI CEP Documentation: https://brasilapi.com.br/docs#tag/CEP