The carsxe NuGet package is the official CarsXE client for C# and .NET. It wraps the REST API with async methods and handles authentication. Requires .NET 6 or later.
Installation
dotnet add package carsxeOr via the NuGet Package Manager in Visual Studio: search for carsxe.
Quick start
using carsxe;
using System;
using System.Collections.Generic;
using System.Threading.Tasks;
class Program
{
static async Task Main(string[] args)
{
CarsXE carsxe = new CarsXE(Environment.GetEnvironmentVariable("CARSXE_API_KEY")!);
try
{
var vehicle = await carsxe.Specs(new Dictionary<string, string>
{
{ "vin", "WBAFR7C57CC811956" },
});
Console.WriteLine(vehicle);
}
catch (Exception ex)
{
Console.WriteLine($"Error: {ex.Message}");
}
}
}Methods
Core
| Method | Description |
|---|---|
Specs(params) | Decode a 17-character VIN into full vehicle specifications |
MarketValue(params) | Retail, trade-in, and auction value estimates |
Recalls(params) | Open safety recalls by VIN, make, model, or year |
PlateDecoder(params) | VIN lookup from a license plate (50+ countries) |
History(params) | Title events, salvage, junk, and insurance records |
Bulk recall batch
| Method | Description |
|---|---|
SubmitBulkRecallBatch(params) | Submit a batch of VINs for recall lookup |
GetBulkRecallBatchStatus(batchId) | Poll job status |
GetBulkRecallBatchResults(batchId) | Retrieve completed results |
GetBulkRecallBatchDownloadUrl(batchId) | Get a CSV download URL |
Error handling
Methods throw Exception on API errors. Wrap calls in a try/catch block:
try
{
var vehicle = await carsxe.Specs(new Dictionary<string, string> { { "vin", vin } });
Console.WriteLine(vehicle);
}
catch (Exception ex)
{
Console.WriteLine($"CarsXE error: {ex.Message}");
}Best practices
Store your key in environment variables or .NET User Secrets for local development:
# .NET User Secrets (local dev)
dotnet user-secrets set "CARSXE_API_KEY" "your_key_here"Create one instance and reuse it. All methods are async — don't create a new CarsXE instance per request.
In ASP.NET Core, register the client as a singleton via dependency injection:
// Program.cs
builder.Services.AddSingleton(new CarsXE(
builder.Configuration["CARSXE_API_KEY"]!
));