https://github.com/guibranco/cepaberto-sdk-dotnet
🇧🇷 📍 CEPAberto API client wrapper for .NET projects
https://github.com/guibranco/cepaberto-sdk-dotnet
api cep cepaberto csharp ddd geolocation hacktoberfest ibge nuget wrapper
Last synced: 2 months ago
JSON representation
🇧🇷 📍 CEPAberto API client wrapper for .NET projects
- Host: GitHub
- URL: https://github.com/guibranco/cepaberto-sdk-dotnet
- Owner: guibranco
- License: mit
- Created: 2018-08-15T19:21:33.000Z (almost 8 years ago)
- Default Branch: main
- Last Pushed: 2026-04-13T08:03:38.000Z (3 months ago)
- Last Synced: 2026-04-13T10:17:33.008Z (3 months ago)
- Topics: api, cep, cepaberto, csharp, ddd, geolocation, hacktoberfest, ibge, nuget, wrapper
- Language: C#
- Homepage: http://guilherme.stracini.com.br/CEPAberto/
- Size: 627 KB
- Stars: 4
- Watchers: 0
- Forks: 3
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# CEP Aberto SDK .NET
[CEP Aberto](htttp://www.cepaberto.com) API wrapper written in C# (.NET).
Implements all V3 features
[](https://github.com/guibranco/CEPAberto-SDK-dotnet)
[](https://wakatime.com/badge/github/guibranco/CEPAberto-SDK-dotnet)
[](https://app.deepsource.com/gh/guibranco/CEPAberto-SDK-dotnet/)

## CI/CD
| Build status | Last commit | Tests | Coverage | Code Smells | LOC |
|--------------|-------------|-------|----------|-------------|-----|
| [](https://ci.appveyor.com/project/guibranco/CEPAberto-SDK-dotnet) | [](https://github.com/guibranco/CEPAberto-SDK-dotnet) | [](https://ci.appveyor.com/project/guibranco/CEPAberto-SDK-dotnet) | [](https://sonarcloud.io/dashboard?id=guibranco_CEPAberto-SDK-dotnet) | [](https://sonarcloud.io/dashboard?id=guibranco_CEPAberto-SDK-dotnet) | [](https://sonarcloud.io/dashboard?id=guibranco_CEPAberto-SDK-dotnet)
## Code Quality
[](https://www.codacy.com/gh/guibranco/CEPAberto-SDK-dotnet/dashboard?utm_source=github.com&utm_medium=referral&utm_content=guibranco/CEPAberto-SDK-dotnet&utm_campaign=Badge_Grade)
[](https://www.codacy.com/gh/guibranco/CEPAberto-SDK-dotnet/dashboard?utm_source=github.com&utm_medium=referral&utm_content=guibranco/CEPAberto-SDK-dotnet&utm_campaign=Badge_Grade)
[](https://codecov.io/gh/guibranco/CEPAberto-SDK-dotnet)
[](https://www.codefactor.io/repository/github/guibranco/CEPAberto-SDK-dotnet)
[](https://codeclimate.com/github/guibranco/CEPAberto-SDK-dotnet/maintainability)
[](https://codeclimate.com/github/guibranco/CEPAberto-SDK-dotnet/test_coverage)
[](https://sonarcloud.io/dashboard?id=guibranco_CEPAberto-SDK-dotnet)
[](https://sonarcloud.io/dashboard?id=guibranco_CEPAberto-SDK-dotnet)
[](https://sonarcloud.io/dashboard?id=guibranco_CEPAberto-SDK-dotnet)
[](https://sonarcloud.io/dashboard?id=guibranco_CEPAberto-SDK-dotnet)
[](https://sonarcloud.io/dashboard?id=guibranco_CEPAberto-SDK-dotnet)
[](https://sonarcloud.io/dashboard?id=guibranco_CEPAberto-SDK-dotnet)
[](https://sonarcloud.io/dashboard?id=guibranco_CEPAberto-SDK-dotnet)
[](https://sonarcloud.io/dashboard?id=guibranco_CEPAberto-SDK-dotnet)
---
## Installation
### Github Releases
[](https://github.com/guibranco/CEPAberto-SDK-dotnet) [](https://github.com/guibranco/CEPAberto-SDK-dotnet)
Download the latest zip file from the [Release](https://github.com/guibranco/CEPAberto-SDK-dotnet/releases) page.
### Nuget package manager
| Package | Version | Downloads |
|------------------|:-------:|:-------:|
| **CEPAberto** | [](https://www.nuget.org/packages/CEPAberto/) | [](https://www.nuget.org/packages/CEPAberto/) |
---
## Features
This client supports the following operations/features of the API V3:
1. Get data based on postal code (CEP).
2. Get data of a nearest geo location (lat/lon) (Max of 10km).
3. Get data based on state initials (UF), city, neighborhood and street/address.
4. Get list of cities of a state based on state initials.
5. Update the postal code (CEP).
---
## Setup the CEPAbertoClient
Initializes a new instance of **CEPAbertoClient** class.
The API token can be found at [http://www.cepaberto.com/api_key](http://www.cepaberto.com/api_key) (A free registration is required!)
```cs
var client = new CEPAbertoClient("my API token");
//var postalData = client.GetData("00000000");
//var cities = client.GetCities("SP");
```
## Get data based on postal code (CEP)
Searches for a postal code data based on postal code
```cs
var client = new CEPAbertoClient("my API key");
var postalCode = "40010000";
var result = client.GetData(postalCode);
if(result.Success)
{
Console.WriteLine("Postal data for the zip code {0} found!", postalCode);
Console.WriteLine("Lat: {0} | Lon: {1}", result.Latitude, result.Longitude);
}
else
Console.WriteLine("No data for the zip code {0} available", postalCode);
```
### Get data of a nearest geo location (lat/lon) (Max of 10km)
Searches for the first postal code closest to the requested coordinates, limited to 10km (API limit, not library)
```cs
var client = new CEPAbertoClient("my API key");
var result = client.GetData("-20.55", "-43.63");
if(result.Success)
Console.WriteLine("Postal code found: {0}", result.PostalCode);
else
Console.WriteLine("Unable to find a postal data for the coordinates supplied!");
```
## Get data based on state initials (UF), city, neighborhood and street/address
Searches for a postal code data for the address supplied. Neighborhood and Street/Address are optional!
```cs
var client = new CEPAbertoClient("my API key");
var result = client.GetData("SP","Ubatuba");
if(result.Success)
Console.WriteLine("Postal code found: {0}", result.PostalCode);
else
Console.WriteLine("Cannot find postal code for Ubatuba/SP");
```
## Get list of cities of a state based on state initials
Get a list of cities for a given state (use state initials aka UF)
```cs
var client = new CEPAbertoClient("my API key");
var result = client.GetCities("AM");
if(result.Success)
foreach(var city in result.Cities)
Console.WriteLine("Found city {0} in Amazonas (AM)", city.Name);
```
## Update the postal code (CEP)
Request an update on postal codes that may be outdated or not registered.
Accepts upon 100 postal codes (CEP)
```cs
var client = new CEPAbertoClient("my API key");
var result = client.Update("03177010");
if(result.Success)
Console.WriteLine("Success on request update on postal code 03177-010");
```