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-packageQuick 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
| 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 |
Endpoint examples
Runnable examples for each method. All of them assume the client from Quick start.
International VIN Decoder
intvin := client.InternationalVINDecoder(map[string]string{
"vin": "WF0MXXGBWM8R43240",
})
fmt.Println(intvin)Market Value
marketvalue := client.MarketValue(map[string]string{
"vin": "WBAFR7C57CC811956",
})
fmt.Println(marketvalue)Vehicle History
history := client.History(map[string]string{
"vin": "WBAFR7C57CC811956",
})
fmt.Println(history)License Plate Decoder
decodedPlate := client.PlateDecoder(map[string]string{
"plate": "7XER187",
"state": "CA",
"country": "US",
})
fmt.Println(decodedPlate)Vehicle Images
images := client.Images(map[string]string{
"make": "BMW",
"model": "X5",
"year": "2019",
})
fmt.Println(images)Vehicle Recalls
recalls := client.Recalls(map[string]string{
"vin": "1C4JJXR64PW696340",
})
fmt.Println(recalls)Plate Image Recognition
plateimg := client.PlateImageRecognition(map[string]string{
"upload_url": "https://imagedelivery.net/moyiiSImjJPI_EZVxNMBBw/f49aed53-d736-4370-f3f4-97418841c800/public",
})
fmt.Println(plateimg)VIN OCR from Image
vinocr := client.VinOCR(map[string]string{
"upload_url": "https://imagedelivery.net/moyiiSImjJPI_EZVxNMBBw/f49aed53-d736-4370-f3f4-97418841c800/public",
})
fmt.Println(vinocr)Year-Make-Model Search
yymm := client.YearMakeModel(map[string]string{
"year": "2012",
"make": "BMW",
"model": "5 Series",
})
fmt.Println(yymm)OBD Code Decoder
obdcode := client.ObdCodesDecoder(map[string]string{
"code": "P0115",
})
fmt.Println(obdcode)Lien and Theft
lienAndTheft := client.LienAndTheft(map[string]string{
"vin": "2C3CDXFG1FH762860",
})
fmt.Println(lienAndTheft)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.
Official CarsXE SDK for Go.