ViaCep API
Overview
ViaCep is a free Brazilian zip code (CEP) API that returns address data including street, neighborhood, city, and state for any valid Brazilian postal code. No authentication is required, making it ideal for beginners building forms or address validation for Brazil. Responses are available in JSON or XML format.
Beginner Tip
Just replace the CEP in the URL with any valid 8-digit Brazilian zip code. Use the JSON format endpoint (/json/) for easiest parsing in modern apps.
Available Data
Example Response
{
"status": "success",
"data": {
"result": "Data from ViaCep",
"description": "Brazil RESTful zip codes API",
"timestamp": "2025-01-15T10:00:00Z"
}
} Field Reference
cep The Brazilian postal code in XXXXX-XXX format. logradouro Street name associated with the postal code. bairro Neighborhood or district name. localidade City name for the postal code. uf Two-letter Brazilian state abbreviation, e.g. SP for São Paulo. ibge IBGE code, a numeric identifier for the municipality. Implementation Example
const url = "https://viacep.com.br/";
const response = await fetch(url);
if (!response.ok) throw new Error(`Request failed: ${response.status}`);
const data = await response.json();
console.log(data); What Can You Build?
Note: These code examples are AI-generated and unverified. Always refer to the official API documentation for accurate usage.
Common Errors & Troubleshooting
Matrix Score Breakdown
Fully tested on Apr 5, 2026
Technical Specifications
Related Tags
Similar APIs
View All →administrative-divisons-db
⭐ Beginner's PickThe Administrative Divisions DB API provides a structured list of all administrative divisions (states, provinces, regions, cities) for countries around the world.
adresse.data.gouv.fr
adresse.data.gouv.fr provides programmatic access to address database of france, geocoding and reverse via REST API.
Airtel IP
⭐ Beginner's PickAirtel IP is a free, no-auth IP geolocation API that aggregates data from multiple sources to return the country associated with any given IP address.
bng2latlong
⭐ Beginner's Pickbng2latlong is a simple, free API that converts British National Grid (OSGB36) easting and northing coordinates into standard WGS84 latitude and longitude.
Cartes.io
⭐ Beginner's PickCartes.io is a free API that lets you create maps and add custom markers without signing up.