CarsXE

The carsxe-go-package module is the official CarsXE client for Go. It wraps the REST API with idiomatic methods and handles authentication. Requires Go 1.18 or later.

Installation

go get github.com/carsxe/carsxe-go-package

Quick start

package main

import (
	"fmt"
	"github.com/carsxe/carsxe-go-package"
)

func main() {
	client := carsxe.New("CARSXE_API_KEY")
	vehicle := client.Specs(map[string]string{
		"vin": "WBAFR7C57CC811956",
	})
	fmt.Println(vehicle)
}

Methods

Core

MethodDescription
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

MethodDescription
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 return an error value alongside the result. Always check before using the response:

vehicle, err := client.Specs(map[string]string{"vin": "WBAFR7C57CC811956"})
if err != nil {
	fmt.Fprintln(os.Stderr, "CarsXE error:", err)
	os.Exit(1)
}
fmt.Println(vehicle)

Best practices

Read the key from the environment.

apiKey := os.Getenv("CARSXE_API_KEY")
if apiKey == "" {
	log.Fatal("CARSXE_API_KEY is not set")
}
client := carsxe.New(apiKey)

Create one client and reuse it. The client manages connection pooling internally — creating a new instance per request bypasses that benefit.

Store your key in an environment variable. Never hardcode it or commit it to source control.