Overview
This node integrates with the ViaCep API to retrieve address information based on a Brazilian postal code (CEP). It is useful for workflows that require validating, enriching, or standardizing address data in Brazil by fetching detailed location information such as street, neighborhood, city, and state from the CEP.
Practical examples include:
- Automatically filling address fields in forms after entering a CEP.
- Validating user input addresses in e-commerce checkout processes.
- Enriching customer databases with accurate location details.
Properties
Name | Meaning |
---|---|
Cep | The Brazilian postal code (CEP) to search for. Format: "xxxxx-xxx" or "xxxxxxxx". |
Additional Fields | Options to customize the request; currently supports: |
- Format Response | The format of the response returned by the API. Possible values: json (default), xml . |
Output
The node outputs the response from the ViaCep API in the selected format (json
or xml
). When JSON is selected, the output will be a structured object containing address details corresponding to the provided CEP, such as street name, neighborhood, city, state, and other related fields.
If XML format is chosen, the output will be the raw XML response as a string.
No binary data output is produced by this node.
Dependencies
- Requires internet access to call the public ViaCep API at
https://viacep.com.br/ws/
. - No authentication or API key is needed since ViaCep is a free service.
- No additional n8n credentials or environment variables are required.
Troubleshooting
- Invalid CEP format: Ensure the CEP is correctly formatted as either
xxxxx-xxx
orxxxxxxxx
. Invalid formats may cause the API to return errors or empty results. - CEP not found: If the CEP does not exist, the API returns an error or empty data. Verify the CEP is valid and active.
- Network issues: Connectivity problems can prevent reaching the ViaCep API. Check your network connection.
- Response format mismatch: Selecting XML format will return raw XML, which might require additional parsing downstream in your workflow.
Links and References
- ViaCep Official Website
- ViaCep API Documentation (API usage details available on the site)