🚗 CarsXE API (Go Package)

CarsXE is a powerful and developer-friendly API that gives you instant access to a wide range of vehicle data. From VIN decoding and market value estimation to vehicle history, images, OBD code explanations, and plate recognition, CarsXE provides everything you need to build automotive applications at scale.
🌐 Website: https://api.carsxe.com
📄 Docs: https://api.carsxe.com/docs
📦 All Products: https://api.carsxe.com/all-products
To get started with the CarsXE API, follow these steps:
-
Sign up for a CarsXE account:
-
Install the CarsXE Go package:
Run this command in your terminal:
go get -u github.com/carsxe/carsxe-go-package
-
Import the CarsXE API into your code:
import "github.com/carsxe/carsxe-go-package"
-
Initialize the API with your API key:
client := carsxe.New("YOUR_API_KEY")
-
Use the various endpoint methods provided by the API to access the data you need.
Usage
package main
import (
"fmt"
"github.com/carsxe/carsxe-go-package"
)
func main() {
client := carsxe.New("YOUR_API_KEY")
vin := "WBAFR7C57CC811956"
vehicle := client.Specs(map[string]string{"vin": vin})
fmt.Println(vehicle["input"].(map[string]interface{})["vin"])
}
📚 Endpoints
The CarsXE API provides the following endpoint methods:
Specs – Decode VIN & get full vehicle specifications
Required:
Optional:
deepdata
disableIntVINDecoding
Example:
vehicle := client.Specs(map[string]string{"vin": "WBAFR7C57CC811956"})
InternationalVINDecoder – Decode VIN with worldwide support
Required:
Optional:
Example:
intvin := client.InternationalVINDecoder(map[string]string{"vin": "WF0MXXGBWM8R43240"})
PlateDecoder – Decode license plate info (plate, country)
Required:
plate
country (always required except for US, where it is optional and defaults to 'US')
Optional:
state (required for some countries, e.g. US, AU, CA)
district (required for Pakistan)
Note:
- The
state parameter is required only when applicable (for
specific countries such as US, AU, CA, etc.).
- For Pakistan (
country='pk'), both state and district
are required.
Example:
decodedPlate := client.PlateDecoder(map[string]string{"plate": "7XER187", "state": "CA", "country": "US"})
MarketValue – Estimate vehicle market value based on VIN
Required:
Optional:
Example:
marketvalue := client.MarketValue(map[string]string{"vin": "WBAFR7C57CC811956"})
History – Retrieve vehicle history
Required:
Optional:
Example:
history := client.History(map[string]string{"vin": "WBAFR7C57CC811956"})
Images – Fetch images by make, model, year, trim
Required:
Optional:
year
trim
color
transparent
angle
photoType
size
license
Example:
images := client.Images(map[string]string{"make": "BMW", "model": "X5", "year": "2019"})
Recalls – Get safety recall data for a VIN
Required:
Optional:
Example:
recalls := client.Recalls(map[string]string{"vin": "1C4JJXR64PW696340"})
PlateImageRecognition – Read & decode plates from images
Required:
Optional:
Example:
plateimg := client.PlateImageRecognition("https://api.carsxe.com/img/apis/plate_recognition.JPG")
Required:
Optional:
Example:
vinocr := client.VinOCR("https://api.carsxe.com/img/apis/plate_recognition.JPG")
YearMakeModel – Query vehicle by year, make, model and trim (optional)
Required:
Optional:
Example:
yymm := client.YearMakeModel(map[string]string{"year": "2012", "make": "BMW", "model": "5 Series"})
ObdCodesDecoder – Decode OBD error/diagnostic codes
Required:
Optional:
Example:
obdcode := client.ObdCodesDecoder(map[string]string{"code": "P0115"})
LienAndTheft – Check lien and theft records by VIN
Required:
Optional:
Example:
lienTheft := client.LienAndTheft(map[string]string{"vin": "2C3CDXFG1FH762860"})
Notes & Best Practices
- Parameter requirements: Each endpoint requires specific parameters—see the Required/Optional fields above.
- Return values: All responses are Go maps (
map[string]any) for easy access and manipulation.
- Error handling: The client currently panics on network or JSON decode errors. Consider wrapping calls with
recover or modifying the client to return errors for production use.
- More info: For advanced usage and full details, visit the official API documentation.
Overall
The CarsXE Go package provides a wide range of powerful, easy-to-use tools for accessing and integrating vehicle data into your applications and services. Whether you're a developer or a business owner, you can quickly get the information you need to take your projects to the next level—without hassle or inconvenience.