{"id":15650391,"url":"https://github.com/guibranco/viacep","last_synced_at":"2026-01-05T22:16:12.138Z","repository":{"id":47798524,"uuid":"170708557","full_name":"guibranco/ViaCEP","owner":"guibranco","description":"🇧🇷 📍 ViaCEP client wrapper for .NET projects","archived":false,"fork":false,"pushed_at":"2025-02-10T23:41:55.000Z","size":444,"stargazers_count":35,"open_issues_count":1,"forks_count":11,"subscribers_count":1,"default_branch":"main","last_synced_at":"2025-03-27T23:32:56.714Z","etag":null,"topics":["address","api","cep","code","correios","fazenda","gia","hacktoberfest","ibge","mf","postal","postalcode","viacep","webservice","ws","zip","zipcode"],"latest_commit_sha":null,"homepage":"http://guilherme.stracini.com.br/ViaCEP/","language":"C#","has_issues":true,"has_wiki":null,"has_pages":null,"mirror_url":null,"source_name":null,"license":"mit","status":null,"scm":"git","pull_requests_enabled":true,"icon_url":"https://github.com/guibranco.png","metadata":{"files":{"readme":"README.md","changelog":null,"contributing":null,"funding":null,"license":"LICENSE","code_of_conduct":null,"threat_model":null,"audit":null,"citation":null,"codeowners":null,"security":null,"support":null,"governance":null,"roadmap":null,"authors":null,"dei":null,"publiccode":null,"codemeta":null}},"created_at":"2019-02-14T14:57:13.000Z","updated_at":"2025-03-20T03:31:31.000Z","dependencies_parsed_at":"2023-02-13T21:40:22.420Z","dependency_job_id":"ff2342fe-5e65-4c3d-8efd-cf5946470663","html_url":"https://github.com/guibranco/ViaCEP","commit_stats":{"total_commits":276,"total_committers":9,"mean_commits":"30.666666666666668","dds":0.322463768115942,"last_synced_commit":"696771466fef36100f4d1249b8af435558f93e58"},"previous_names":[],"tags_count":159,"template":false,"template_full_name":null,"repository_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guibranco%2FViaCEP","tags_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guibranco%2FViaCEP/tags","releases_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guibranco%2FViaCEP/releases","manifests_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories/guibranco%2FViaCEP/manifests","owner_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners/guibranco","download_url":"https://codeload.github.com/guibranco/ViaCEP/tar.gz/refs/heads/main","host":{"name":"GitHub","url":"https://github.com","kind":"github","repositories_count":248860007,"owners_count":21173342,"icon_url":"https://github.com/github.png","version":null,"created_at":"2022-05-30T11:31:42.601Z","updated_at":"2022-07-04T15:15:14.044Z","host_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub","repositories_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repositories","repository_names_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/repository_names","owners_url":"https://repos.ecosyste.ms/api/v1/hosts/GitHub/owners"}},"keywords":["address","api","cep","code","correios","fazenda","gia","hacktoberfest","ibge","mf","postal","postalcode","viacep","webservice","ws","zip","zipcode"],"created_at":"2024-10-03T12:34:26.086Z","updated_at":"2026-01-05T22:16:12.091Z","avatar_url":"https://github.com/guibranco.png","language":"C#","funding_links":[],"categories":[],"sub_categories":[],"readme":"# ViaCEP SDK .NET\r\n\r\nA .NET client wrapper for both .NET Core \u0026 .NET Framework projects of [Via CEP API](https://viacep.com.br)\r\n\r\n[![GitHub license](https://img.shields.io/github/license/guibranco/ViaCep)](https://github.com/guibranco/ViaCep)\r\n[![time tracker](https://wakatime.com/badge/github/guibranco/ViaCEP.svg)](https://wakatime.com/badge/github/guibranco/ViaCEP)\r\n\r\n![Via CEP](https://raw.githubusercontent.com/guibranco/viacep/main/logo.png)\r\n\r\n## CI/CD\r\n\r\n| Build status | Last commit | Tests | Coverage | Code Smells | LOC |\r\n|--------------|-------------|-------|----------|-------------|-----|\r\n| [![Build status](https://ci.appveyor.com/api/projects/status/9jnsy1e08jhyxl7j/branch/main?svg=true)](https://ci.appveyor.com/project/guibranco/ViaCEP) | [![GitHub last commit](https://img.shields.io/github/last-commit/guibranco/ViaCEP/main)](https://github.com/guibranco/ViaCEP) | [![AppVeyor tests (branch)](https://img.shields.io/appveyor/tests/guibranco/ViaCEP/main?compact_message)](https://ci.appveyor.com/project/guibranco/ViaCEP) | [![Coverage](https://sonarcloud.io/api/project_badges/measure?project=guibranco_ViaCEP\\\u0026metric=coverage)](https://sonarcloud.io/dashboard?id=guibranco_ViaCEP) | [![Code Smells](https://sonarcloud.io/api/project_badges/measure?project=guibranco_ViaCEP\\\u0026metric=code_smells)](https://sonarcloud.io/dashboard?id=guibranco_ViaCEP) | [![Lines of Code](https://sonarcloud.io/api/project_badges/measure?project=guibranco_ViaCEP\\\u0026metric=ncloc)](https://sonarcloud.io/dashboard?id=guibranco_ViaCEP)\r\n\r\n## Code Quality\r\n\r\n[![Codacy Badge](https://app.codacy.com/project/badge/Grade/483c4901f0ea4a0d99e69be931ced362)](https://www.codacy.com/gh/guibranco/ViaCEP/dashboard?utm_source=github.com\\\u0026utm_medium=referral\\\u0026utm_content=guibranco/ViaCEP\\\u0026utm_campaign=Badge_Grade)\r\n[![Codacy Badge](https://app.codacy.com/project/badge/Coverage/483c4901f0ea4a0d99e69be931ced362)](https://www.codacy.com/gh/guibranco/ViaCEP/dashboard?utm_source=github.com\\\u0026utm_medium=referral\\\u0026utm_content=guibranco/ViaCEP\\\u0026utm_campaign=Badge_Grade)\r\n\r\n[![codecov](https://codecov.io/gh/guibranco/ViaCEP/branch/main/graph/badge.svg)](https://codecov.io/gh/guibranco/ViaCEP)\r\n[![CodeFactor](https://www.codefactor.io/repository/github/guibranco/ViaCEP/badge)](https://www.codefactor.io/repository/github/guibranco/ViaCEP)\r\n\r\n[![Maintainability](https://api.codeclimate.com/v1/badges/93ba8c7ae3e86ca7e2a7/maintainability)](https://codeclimate.com/github/guibranco/ViaCEP/maintainability)\r\n[![Test Coverage](https://api.codeclimate.com/v1/badges/93ba8c7ae3e86ca7e2a7/test_coverage)](https://codeclimate.com/github/guibranco/ViaCEP/test_coverage)\r\n\r\n[![Quality Gate Status](https://sonarcloud.io/api/project_badges/measure?project=guibranco_ViaCEP\\\u0026metric=alert_status)](https://sonarcloud.io/dashboard?id=guibranco_ViaCEP)\r\n[![Maintainability Rating](https://sonarcloud.io/api/project_badges/measure?project=guibranco_ViaCEP\\\u0026metric=sqale_rating)](https://sonarcloud.io/dashboard?id=guibranco_ViaCEP)\r\n\r\n[![Technical Debt](https://sonarcloud.io/api/project_badges/measure?project=guibranco_ViaCEP\\\u0026metric=sqale_index)](https://sonarcloud.io/dashboard?id=guibranco_ViaCEP)\r\n[![Duplicated Lines (%)](https://sonarcloud.io/api/project_badges/measure?project=guibranco_ViaCEP\\\u0026metric=duplicated_lines_density)](https://sonarcloud.io/dashboard?id=guibranco_ViaCEP)\r\n\r\n[![Reliability Rating](https://sonarcloud.io/api/project_badges/measure?project=guibranco_ViaCEP\\\u0026metric=reliability_rating)](https://sonarcloud.io/dashboard?id=guibranco_ViaCEP)\r\n[![Security Rating](https://sonarcloud.io/api/project_badges/measure?project=guibranco_ViaCEP\\\u0026metric=security_rating)](https://sonarcloud.io/dashboard?id=guibranco_ViaCEP)\r\n\r\n[![Bugs](https://sonarcloud.io/api/project_badges/measure?project=guibranco_ViaCEP\\\u0026metric=bugs)](https://sonarcloud.io/dashboard?id=guibranco_ViaCEP)\r\n[![Vulnerabilities](https://sonarcloud.io/api/project_badges/measure?project=guibranco_ViaCEP\\\u0026metric=vulnerabilities)](https://sonarcloud.io/dashboard?id=guibranco_ViaCEP)\r\n\r\n[![DeepSource](https://app.deepsource.com/gh/guibranco/ViaCEP.svg/?label=active+issues\\\u0026show_trend=true\\\u0026token=84Hhxk-J1hIHiVC_ojm17J3q)](https://app.deepsource.com/gh/guibranco/ViaCEP/?ref=repository-badge)\r\n\r\n---\r\n\r\n## Installation\r\n\r\n### Github Releases\r\n\r\n[![GitHub last release](https://img.shields.io/github/release-date/guibranco/ViaCEP.svg?style=flat)](https://github.com/guibranco/ViaCEP) [![Github All Releases](https://img.shields.io/github/downloads/guibranco/ViaCEP/total.svg?style=flat)](https://github.com/guibranco/ViaCEP)\r\n\r\nDownload the latest zip file from the [Release](https://github.com/GuiBranco/ViaCEP/releases) page.\r\n\r\n### Nuget package manager\r\n\r\n| Package | Version | Downloads |\r\n|------------------|:-------:|:-------:|\r\n| **ViaCEP** | [![ViaCEP NuGet Version](https://img.shields.io/nuget/v/ViaCEP.svg?style=flat)](https://www.nuget.org/packages/ViaCEP/) | [![ViaCEP NuGet Downloads](https://img.shields.io/nuget/dt/ViaCEP.svg?style=flat)](https://www.nuget.org/packages/ViaCEP/) |\r\n\r\n---\r\n\r\n## Usage\r\n\r\nThe package has two classes:\r\n\r\n*   [ViaCepClient](https://github.com/guibranco/ViaCEP/blob/main/ViaCEP/ViaCepClient.cs): The main class (methods).\r\n*   [ViaCepResult](https://github.com/guibranco/ViaCEP/blob/main/ViaCEP/ViaCepResult.cs): The result class (data).\r\n\r\nThis package is fully compatible with Dependency Injection. Use the interface *IViaCepClient* and the constructor with an HttpClient parameter and an IHttpClientFactory instance.\r\n\r\n```cs\r\n//your DI container\r\nservices.AddHttpClient\u003cIViaCepClient, ViaCepClient\u003e(client =\u003e { client.BaseAddress = new Uri(\"https://viacep.com.br/\"); });\r\n\r\n//then use in your domain service, handler, controller...\r\nvar viaCepClient = container.GetService\u003cIViaCepClient\u003e();\r\nvar result = await viaCepClient.SearchAsync(\"01001000\", cancellationToken);\r\n```\r\n\r\nYou can search using the zip code/postal code (AKA CEP) or the address data (state initials - UF, city name, and location name - street, avenue, park, square). Both methods support async and sync!\r\n\r\n### Querying by zip code / postal code (single result)\r\n\r\n```cs\r\nvar result = new ViaCepClient().Search(\"01001000\"); //searches for the postal code 01001-000\r\nvar address = result.Address; //Praça da Sé\r\nvar city = reuslt.City; //São Paulo\r\n//do what you need with 'result' instance of ViaCEPResult.\r\n```\r\n\r\n### Querying by address (list result)\r\n\r\n```cs\r\nvar results = new ViaCepClient().Search(\"SP\", \"São Paulo\", \"Avenida Paulista\"); //search for the Avenida Paulista in São Paulo / SP\r\nforeach(var result in results){\r\n    var address = result.Address;\r\n    var neighborhood = result.Neighborhood;\r\n    var zipCode = result.ZipCode;\r\n    //do what you need with 'result' instance of ViaCEPResult.\r\n}\r\n```\r\n\r\n## Changelog\r\n\r\n*   2024-09-02: Add explicitly support to .NET 6.0 and .NET 8.0 [#154](https://github.com/guibranco/ViaCEP/issues/154) by [@guibranco](https://github.com/guibranco)\r\n*   2023-07-28: Add integration tests [#71](https://github.com/guibranco/ViaCEP/issues/71) by [@Riju-bak](https://github.com/Riju-bak)\r\n*   2023-03-03: Update dependencies, change branch name, update logo. [@guibranco](https://github.com/guibranco)\r\n*   2021-06-21: Update dependencies version. [@guibranco](https://github.com/guibranco)\r\n*   2020-10-23: Support .NET Standard 2.0 and .NET Framework v4.6.1 and above. [@guibranco](https://github.com/guibranco)\r\n","project_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguibranco%2Fviacep","html_url":"https://awesome.ecosyste.ms/projects/github.com%2Fguibranco%2Fviacep","lists_url":"https://awesome.ecosyste.ms/api/v1/projects/github.com%2Fguibranco%2Fviacep/lists"}