The CarsXE Python SDK provides a simple and powerful way to integrate vehicle data into your Python applications. This guide will help you get started quickly.

For more information, see the <a href="https://pypi.org/project/carsxe/" target="\_blank" style={{textDecoration: 'underline'}}>package on PyPI</a>.

## Installation

Install the CarsXE Python package using pip:

`pip install carsxe`

## Setup

First, import the CarsXE client and initialize it with your API key:

<CodeGroup title="app.py">
  ```python 
import asyncio
from carsxe_api import CarsXE 
# Initialize the client 
carsxe = CarsXE('YOUR_API_KEY_HERE') 
```
</CodeGroup>
## Basic Usage

### VIN Specifications
<CodeGroup title="app.py">
```python
import asyncio
from carsxe_api import CarsXE
carsxe = CarsXE('YOUR_API_KEY')
vin = 'WBAFR7C57CC811956'
try:
    vehicle = asyncio.run(carsxe.specs({"vin": vin}))
    print(vehicle["input"]["vin"])
except Exception as error:
    print(f"Error: {error}")
```
</CodeGroup>

### International VIN Decoder

<CodeGroup title="app.py">
```python
import asyncio
from carsxe_api import CarsXE
carsxe = CarsXE('YOUR_API_KEY')
try:
    intvin = asyncio.run(carsxe.int_vin_decoder({"vin": "WF0MXXGBWM8R43240"}))
    print(intvin)
except Exception as error:
    print(f"Error: {error}")
```
</CodeGroup>

### Market Value

<CodeGroup title="app.py">
```python
import asyncio
from carsxe_api import CarsXE
carsxe = CarsXE('YOUR_API_KEY')
try:
    marketvalue = asyncio.run(carsxe.market_value({"vin": "WBAFR7C57CC811956"}))
    print(marketvalue)
except Exception as error:
    print(f"Error: {error}")
```
</CodeGroup>

### Vehicle History

<CodeGroup title="app.py">
```python
import asyncio
from carsxe_api import CarsXE
carsxe = CarsXE('YOUR_API_KEY')
try:
    history = asyncio.run(carsxe.history({"vin": "WBAFR7C57CC811956"}))
    print(history)
except Exception as error:
    print(f"Error: {error}")
```
</CodeGroup>

### License Plate Decoder

<CodeGroup title="app.py">
```python
import asyncio
from carsxe_api import CarsXE
carsxe = CarsXE('YOUR_API_KEY')
try:
    decoded_plate = asyncio.run(carsxe.plate_decoder({"plate": "7XER187", "state": "CA", "country": "US"}))
    print(decoded_plate)
except Exception as error:
    print(f"Error: {error}")
```
</CodeGroup>

### Vehicle Images

<CodeGroup title="app.py">
```python
import asyncio
from carsxe_api import CarsXE
carsxe = CarsXE('YOUR_API_KEY')
try:
    images = asyncio.run(carsxe.images({"make": "BMW", "model": "X5", "year": "2019"}))
    print(images)
except Exception as error:
    print(f"Error: {error}")
```
</CodeGroup>

### Vehicle Recalls

<CodeGroup title="app.py">
```python
import asyncio
from carsxe_api import CarsXE
carsxe = CarsXE('YOUR_API_KEY')
try:
    recalls = asyncio.run(carsxe.recalls({"vin": "1C4JJXR64PW696340"}))
    print(recalls)
except Exception as error:
    print(f"Error: {error}")
```
</CodeGroup>

### Plate Image Recognition

<CodeGroup title="app.py">
```python
import asyncio
from carsxe_api import CarsXE
carsxe = CarsXE('YOUR_API_KEY')
try:
    plateimg = asyncio.run(carsxe.plate_image_recognition({"upload_url": "https://imagedelivery.net/moyiiSImjJPI_EZVxNMBBw/f49aed53-d736-4370-f3f4-97418841c800/public"}))
    print(plateimg)
except Exception as error:
    print(f"Error: {error}")
```
</CodeGroup>

### VIN OCR from Image

<CodeGroup title="app.py">
```python
import asyncio
from carsxe_api import CarsXE
carsxe = CarsXE('YOUR_API_KEY')
try:
    vinocr = asyncio.run(carsxe.vin_ocr({"upload_url": "https://imagedelivery.net/moyiiSImjJPI_EZVxNMBBw/f49aed53-d736-4370-f3f4-97418841c800/public"}))
    print(vinocr)
except Exception as error:
    print(f"Error: {error}")
```
</CodeGroup>

### Year-Make-Model Search

<CodeGroup title="app.py">
```python
import asyncio
from carsxe_api import CarsXE
carsxe = CarsXE('YOUR_API_KEY')
try:
    yymm = asyncio.run(carsxe.year_make_model({"year": "2012", "make": "BMW", "model": "5 Series"}))
    print(yymm)
except Exception as error:
    print(f"Error: {error}")
```
</CodeGroup>

### OBD Code Decoder

<CodeGroup title="app.py">
```python
import asyncio
from carsxe_api import CarsXE
carsxe = CarsXE('YOUR_API_KEY')
try:
    obdcode = asyncio.run(carsxe.obd_codes_decoder({"code": "P0115"}))
    print(obdcode)
except Exception as error:
    print(f"Error: {error}")
```
</CodeGroup>

### Lien and Theft

<CodeGroup title="app.py">
```python
import asyncio
from carsxe_api import CarsXE
carsxe = CarsXE('YOUR_API_KEY')
try:
    lien_and_theft = asyncio.run(carsxe.lien_and_theft({"vin": "2C3CDXFG1FH762860"}))
    print(lien_and_theft)
except Exception as error:
    print(f"Error: {error}")
```
</CodeGroup>

Start building powerful automotive applications with CarsXE's Python SDK!
