Fipe.Api.Br 0.1.0

dotnet add package Fipe.Api.Br --version 0.1.0
                    
NuGet\Install-Package Fipe.Api.Br -Version 0.1.0
                    
This command is intended to be used within the Package Manager Console in Visual Studio, as it uses the NuGet module's version of Install-Package.
<PackageReference Include="Fipe.Api.Br" Version="0.1.0" />
                    
For projects that support PackageReference, copy this XML node into the project file to reference the package.
<PackageVersion Include="Fipe.Api.Br" Version="0.1.0" />
                    
Directory.Packages.props
<PackageReference Include="Fipe.Api.Br" />
                    
Project file
For projects that support Central Package Management (CPM), copy this XML node into the solution Directory.Packages.props file to version the package.
paket add Fipe.Api.Br --version 0.1.0
                    
#r "nuget: Fipe.Api.Br, 0.1.0"
                    
#r directive can be used in F# Interactive and Polyglot Notebooks. Copy this into the interactive tool or source code of the script to reference the package.
#:package Fipe.Api.Br@0.1.0
                    
#:package directive can be used in C# file-based apps starting in .NET 10 preview 4. Copy this into a .cs file before any lines of code to reference the package.
#addin nuget:?package=Fipe.Api.Br&version=0.1.0
                    
Install as a Cake Addin
#tool nuget:?package=Fipe.Api.Br&version=0.1.0
                    
Install as a Cake Tool

FIPE C# SDK

CI

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+.

Install

dotnet add package Fipe.Api.Br

Quick start

using 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.

Authentication

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");

Endpoints

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/models

Look 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}");
}

Reference months

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);

Error handling

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}");
}

Example program

A runnable example that lists brands and prints an Amarok price from the live API:

dotnet run --project examples/Fipe.Examples

License

MIT

Product Compatible and additional computed target framework versions.
.NET net5.0 was computed.  net5.0-windows was computed.  net6.0 was computed.  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 was computed.  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 was computed.  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. 
.NET Core netcoreapp2.0 was computed.  netcoreapp2.1 was computed.  netcoreapp2.2 was computed.  netcoreapp3.0 was computed.  netcoreapp3.1 was computed. 
.NET Standard netstandard2.0 is compatible.  netstandard2.1 was computed. 
.NET Framework net461 was computed.  net462 was computed.  net463 was computed.  net47 was computed.  net471 was computed.  net472 was computed.  net48 was computed.  net481 was computed. 
MonoAndroid monoandroid was computed. 
MonoMac monomac was computed. 
MonoTouch monotouch was computed. 
Tizen tizen40 was computed.  tizen60 was computed. 
Xamarin.iOS xamarinios was computed. 
Xamarin.Mac xamarinmac was computed. 
Xamarin.TVOS xamarintvos was computed. 
Xamarin.WatchOS xamarinwatchos was computed. 
Compatible target framework(s)
Included target framework(s) (in package)
Learn more about Target Frameworks and .NET Standard.

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
0.1.0 101 7/26/2026