Skip to content
Switch branches/tags


Failed to load latest commit information.
Latest commit message
Commit time


A .NET client wrapper for both .NET Core & .NET Framework projects of Via CEP API

GitHub license time tracker



Branch Build status Last commit Tests
Master Build status GitHub last commit AppVeyor tests (branch)
Develop Build status GitHub last commit AppVeyor tests (branch)

Code Quality

Codacy Badge codecov Quality Gate Status Coverage

Maintainability Rating Lines of Code Technical Debt Duplicated Lines (%)

Reliability Rating Security Rating Code Smells Bugs Vulnerabilities


Github Releases

GitHub last release Github All Releases

Download the latest zip file from the Release page.

Nuget package manager

Package Version Downloads
ViaCEP ViaCEP NuGet Version ViaCEP NuGet Downloads


The package has two classes:

This package is fully compatible with Dependency Injection. Use the interface IViaCepClient and the constructor with HttpClient parameter with a IHttpClientFactory instance.

//your DI container
services.AddHttpClient<IViaCepClient, ViaCepClient>(client => { client.BaseAddress = new Uri(""); });

//then use in your domain service, handler, controller...
var viaCepClient = container.GetService<IViaCepClient>();
var result = await viaCepClient.SearchAsync("01001000", cancellationToken);

You can search using the zip code/postal code (AKA CEP) or using the address data (state initials - UF, city name and location name - street, avenue, park, square). Both methods support async and sync!

Querying by zip code / postal code (single result)

var result = new ViaCepClient().Search("01001000"); //searches for the postal code 01001-000
var address = result.Address; //Praça da Sé
var city = reuslt.City; //São Paulo
//do what you need with 'result' instance of ViaCEPResult.

Querying by address (list result)

var results = new ViaCepClient().Search("SP", "São Paulo", "Avenida Paulista"); //search for the Avenida Paulista in São Paulo / SP
foreach(var result in results){
    var address = result.Address;
    var neighborhood = result.Neighborhood;
    var zipCode = result.ZipCode;
    //do what you need with 'result' instance of ViaCEPResult.


  • 2020-10-23 - Version 3.1:
    • Add support to .NET Standard 2.0 and .NET Framework v4.6.1 and above - @guibranco