---
title: "Go"
description: "Official CarsXE SDK for Go."
canonical_url: "https://docs.carsxe.com/docs/sdks/go"
markdown_url: "https://docs.carsxe.com/docs/sdks/go.md"
last_updated: "1980-01-01"
---

# Go
URL: /docs/sdks/go
LLM index: /llms.txt
Description: Official CarsXE SDK for Go.

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

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

## Quick start

```go
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 |

## Error handling

Methods return an error value alongside the result. Always check before using the response:

```go
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.**

```go
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.

## Sitemap

See the full [sitemap](/sitemap.md) for all pages.
Docs-scoped sitemap: [/docs/sitemap.md](/docs/sitemap.md).
Well-known sitemap: [/.well-known/sitemap.md](/.well-known/sitemap.md).
