CPFHub 1.0.0
dotnet add package CPFHub --version 1.0.0
NuGet\Install-Package CPFHub -Version 1.0.0
<PackageReference Include="CPFHub" Version="1.0.0" />
<PackageVersion Include="CPFHub" Version="1.0.0" />
<PackageReference Include="CPFHub" />
paket add CPFHub --version 1.0.0
#r "nuget: CPFHub, 1.0.0"
#:package CPFHub@1.0.0
#addin nuget:?package=CPFHub&version=1.0.0
#tool nuget:?package=CPFHub&version=1.0.0
CPFHub
Official .NET SDK for CPFHub.io — Brazilian CPF Lookup API
SDK oficial .NET para a CPFHub.io — API de consulta de CPF
What is CPFHub.io?
CPFHub.io is a REST API that returns name, gender, and date of birth from any Brazilian CPF number — in ~300ms, with 99.9% uptime, and full LGPD compliance.
CPFHub.io é uma API REST que retorna nome, gênero e data de nascimento a partir de qualquer CPF brasileiro — em ~300ms, com 99,9% de uptime e total conformidade com a LGPD.
10M+ CPFs queried · 1,300+ active companies · 99.9% uptime
Installation / Instalação
dotnet add package CPFHub
Or via the NuGet Package Manager:
Install-Package CPFHub
Quick Start
using CPFHub;
var client = new CPFHubClient("YOUR_API_KEY");
var result = await client.LookupAsync("00000000000");
Console.WriteLine(result.Name); // "Fulano de Tal"
Console.WriteLine(result.Gender); // "M"
Console.WriteLine(result.BirthDate); // "15/06/1990"
Get your free API key at app.cpfhub.io — no credit card required.
Obtenha sua chave gratuita em app.cpfhub.io — sem cartão de crédito.
API Reference
new CPFHubClient(string apiKey, CPFHubOptions? options = null)
var options = new CPFHubOptions
{
Timeout = TimeSpan.FromSeconds(5),
BaseUrl = "https://api.cpfhub.io"
};
var client = new CPFHubClient("YOUR_API_KEY", options);
client.LookupAsync(string cpf, CancellationToken ct = default) → Task<CPFResult>
Accepts CPF with or without formatting (000.000.000-00 or 00000000000).
CPFResult properties
| Property | Type | Description |
|---|---|---|
Cpf |
string |
CPF number (digits only) |
Name |
string |
Full name — "Fulano de Tal" |
NameUpper |
string |
Full name in uppercase |
Gender |
string |
"M" or "F" |
BirthDate |
string |
Date of birth — "DD/MM/YYYY" |
Day |
int |
Birth day |
Month |
int |
Birth month |
Year |
int |
Birth year |
Error Handling
using CPFHub;
using CPFHub.Exceptions;
var client = new CPFHubClient("YOUR_API_KEY");
try
{
var result = await client.LookupAsync("00000000000");
Console.WriteLine(result.Name);
}
catch (CPFHubException ex)
{
Console.WriteLine($"Error {ex.StatusCode}: {ex.Message}");
// 400 — Invalid CPF format
// 401 — Invalid or missing API key
// 404 — CPF not found
// 429 — Rate limit exceeded
// 500 — Server error
// 503 — Service temporarily unavailable
}
Examples
ASP.NET Core — Dependency Injection
// Program.cs
builder.Services.AddCPFHub(options =>
{
options.ApiKey = builder.Configuration["CPFHub:ApiKey"];
});
// OnboardingController.cs
[ApiController]
[Route("[controller]")]
public class OnboardingController : ControllerBase
{
private readonly ICPFHubClient _cpfHub;
public OnboardingController(ICPFHubClient cpfHub)
{
_cpfHub = cpfHub;
}
[HttpGet("{cpf}")]
public async Task<IActionResult> Verify(string cpf, CancellationToken ct)
{
var result = await _cpfHub.LookupAsync(cpf, ct);
return Ok(new { result.Name, result.Gender });
}
}
// appsettings.json
{
"CPFHub": {
"ApiKey": "YOUR_API_KEY"
}
}
Minimal API
var builder = WebApplication.CreateBuilder(args);
builder.Services.AddCPFHub(o => o.ApiKey = builder.Configuration["CPFHub:ApiKey"]);
var app = builder.Build();
app.MapGet("/cpf/{cpf}", async (string cpf, ICPFHubClient client) =>
{
var result = await client.LookupAsync(cpf);
return Results.Ok(result);
});
app.Run();
F#
open CPFHub
let client = CPFHubClient("YOUR_API_KEY")
let result = client.LookupAsync("00000000000") |> Async.AwaitTask |> Async.RunSynchronously
printfn "%s" result.Name
Rate Limits / Limites de Requisição
| Plan / Plano | Limit / Limite |
|---|---|
| Free / Grátis | 1 request every 2 seconds · 50 requests/month |
| Pro | 1 request per second · 1,000 requests/month |
| Corporate / Corporativo | Custom / Personalizado |
The SDK automatically retries on 429 with exponential backoff (up to 3 attempts).
Plans & Pricing / Planos e Preços
| Plan | Price | Included | Extra |
|---|---|---|---|
| Free | R$ 0/month | 50 lookups | — |
| Pro | R$ 149/month | 1,000 lookups | R$ 0,15/lookup |
| Corporate | Custom | Custom | Custom |
View full pricing at cpfhub.io →
Requirements / Requisitos
- .NET 6+
- Compatible with C#, F#, and VB.NET
Links
License / Licença
MIT © CPFHub.io
| Product | Versions Compatible and additional computed target framework versions. |
|---|---|
| .NET | net6.0 is compatible. net6.0-android was computed. net6.0-ios was computed. net6.0-maccatalyst was computed. net6.0-macos was computed. net6.0-tvos was computed. net6.0-windows was computed. net7.0 is compatible. net7.0-android was computed. net7.0-ios was computed. net7.0-maccatalyst was computed. net7.0-macos was computed. net7.0-tvos was computed. net7.0-windows was computed. net8.0 is compatible. net8.0-android was computed. net8.0-browser was computed. net8.0-ios was computed. net8.0-maccatalyst was computed. net8.0-macos was computed. net8.0-tvos was computed. net8.0-windows was computed. net9.0 was computed. net9.0-android was computed. net9.0-browser was computed. net9.0-ios was computed. net9.0-maccatalyst was computed. net9.0-macos was computed. net9.0-tvos was computed. net9.0-windows was computed. net10.0 was computed. net10.0-android was computed. net10.0-browser was computed. net10.0-ios was computed. net10.0-maccatalyst was computed. net10.0-macos was computed. net10.0-tvos was computed. net10.0-windows was computed. |
-
net6.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Http (>= 8.0.0)
-
net7.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Http (>= 8.0.0)
-
net8.0
- Microsoft.Extensions.DependencyInjection.Abstractions (>= 8.0.0)
- Microsoft.Extensions.Http (>= 8.0.0)
NuGet packages
This package is not used by any NuGet packages.
GitHub repositories
This package is not used by any popular GitHub repositories.
| Version | Downloads | Last Updated |
|---|---|---|
| 1.0.0 | 86 | 4/29/2026 |