A .NET client for the FIPE API (/api/v2), which provides average vehicle prices in the Brazilian market from Fundação Instituto de Pesquisas Econômicas (FIPE). Prices are updated monthly.
Targets netstandard2.0 — works on .NET Core, .NET 5+, and .NET Framework 4.6.2+.
dotnet add package Fipe.Api.Brusing Fipe.Api.Br;
var client = new FipeClient();
var brands = await client.GetBrandsAsync(VehicleType.Cars);
foreach (var brand in brands)
{
Console.WriteLine($"{brand.Code} {brand.Name}");
}Vehicle types: VehicleType.Cars, VehicleType.Motorcycles, VehicleType.Trucks.
The free tier works without a token but is rate limited. With a subscription token:
var client = new FipeClient(subscriptionToken: "your-token");In DI scenarios, pass an HttpClient from IHttpClientFactory:
services.AddHttpClient<FipeClient>();
// or
var client = new FipeClient(httpClientFactory.CreateClient(), subscriptionToken: "your-token");Drill down brand → model → year → price:
var brands = await client.GetBrandsAsync(VehicleType.Cars); // GET /cars/brands
var models = await client.GetModelsAsync(VehicleType.Cars, "59"); // GET /cars/brands/59/models
var years = await client.GetYearsAsync(VehicleType.Cars, "59", "5940"); // GET /cars/brands/59/models/5940/years
var vehicle = await client.GetVehicleAsync(VehicleType.Cars, "59", "5940", "2014-3"); // GET /cars/brands/59/models/5940/years/2014-3
Console.WriteLine($"{vehicle.Model}: {vehicle.Price}");Browse by year:
var years = await client.GetYearsByBrandAsync(VehicleType.Cars, "59"); // GET /cars/brands/59/years
var models = await client.GetModelsByBrandYearAsync(VehicleType.Cars, "59", "2014-3"); // GET /cars/brands/59/years/2014-3/modelsLook up by FIPE code:
var years = await client.GetYearsByFipeCodeAsync(VehicleType.Cars, "005340-6"); // GET /cars/005340-6/years
var vehicle = await client.GetVehicleByFipeCodeAsync(VehicleType.Cars, "005340-6", "2014-3"); // GET /cars/005340-6/years/2014-3
var history = await client.GetHistoryByFipeCodeAsync(VehicleType.Cars, "005340-6", "2014-3"); // GET /cars/005340-6/years/2014-3/history
foreach (var entry in history.PriceHistory)
{
Console.WriteLine($"{entry.Month}: {entry.Price}");
}Prices are published per monthly reference table. Every endpoint accepts an optional reference to query a past table:
var references = await client.GetReferencesAsync(); // GET /references — e.g. Code "308", Month "abril de 2024"
var brands = await client.GetBrandsAsync(VehicleType.Cars, reference: 308);Non-success responses throw FipeApiException with the status code and body:
try
{
var vehicle = await client.GetVehicleAsync(VehicleType.Cars, "59", "5940", "1900-1");
}
catch (FipeApiException ex) when (ex.IsNotFound)
{
// unknown brand/model/year
}
catch (FipeApiException ex) when (ex.IsRateLimited)
{
// rate limited — back off or use a subscription token
}
catch (FipeApiException ex)
{
Console.WriteLine($"API returned {(int)ex.StatusCode}: {ex.Body}");
}A runnable example that lists brands and prints an Amarok price from the live API:
dotnet run --project examples/Fipe.ExamplesMIT