Metadata-Version: 2.5
Name: carauctions
Version: 0.1.0
Summary: Python client for TheCarApi — live European and Asian car auction inventory from Copart, OpenLane, Auto1, Encar, eCarsTrade, Schadeautos and CarVector.
Project-URL: Homepage, https://thecarapi.com
Project-URL: Documentation, https://thecarapi.com/docs
Project-URL: Source, https://github.com/mnenkov/carauctions-python
Project-URL: Get an API key, https://thecarapi.com/contact
Author-email: TheCarApi <info@thecarapi.com>
License: MIT License
        
        Copyright (c) 2026 TheCarApi
        
        Permission is hereby granted, free of charge, to any person obtaining a copy
        of this software and associated documentation files (the "Software"), to deal
        in the Software without restriction, including without limitation the rights
        to use, copy, modify, merge, publish, distribute, sublicense, and/or sell
        copies of the Software, and to permit persons to whom the Software is
        furnished to do so, subject to the following conditions:
        
        The above copyright notice and this permission notice shall be included in all
        copies or substantial portions of the Software.
        
        THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR
        IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY,
        FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE
        AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER
        LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM,
        OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE
        SOFTWARE.
License-File: LICENSE
Keywords: auction api,auto1,car auctions,car import,car prices,copart,ecarstrade,encar,openlane,schadeautos,used cars,vehicle data,vin
Classifier: Development Status :: 4 - Beta
Classifier: Intended Audience :: Developers
Classifier: License :: OSI Approved :: MIT License
Classifier: Programming Language :: Python :: 3
Classifier: Programming Language :: Python :: 3.9
Classifier: Programming Language :: Python :: 3.10
Classifier: Programming Language :: Python :: 3.11
Classifier: Programming Language :: Python :: 3.12
Classifier: Programming Language :: Python :: 3.13
Classifier: Topic :: Software Development :: Libraries :: Python Modules
Requires-Python: >=3.9
Requires-Dist: requests>=2.28
Provides-Extra: dev
Requires-Dist: flake8>=6.0; extra == 'dev'
Requires-Dist: pytest>=7.0; extra == 'dev'
Requires-Dist: responses>=0.23; extra == 'dev'
Description-Content-Type: text/markdown

# carauctions

[![PyPI](https://img.shields.io/pypi/v/carauctions.svg)](https://pypi.org/project/carauctions/)
[![Python](https://img.shields.io/pypi/pyversions/carauctions.svg)](https://pypi.org/project/carauctions/)
[![License: MIT](https://img.shields.io/badge/license-MIT-blue.svg)](LICENSE)
[![Docs](https://img.shields.io/badge/docs-thecarapi.com-0b7285.svg)](https://thecarapi.com/docs)

**Python client for [TheCarApi](https://thecarapi.com) — live car auction inventory from
Copart, OpenLane, Auto1, Encar, eCarsTrade, Schadeautos and CarVector in one API.**

Search hundreds of thousands of live lots across Europe, South Korea and Japan. Filter by
brand, model, year, mileage, fuel, price and damage state. Pull full vehicle detail, image
galleries, price history, VIN history, market price references and landed import costs.

```bash
pip install carauctions
```

## Quickstart

```python
from carauctions import CarAuctionsClient

client = CarAuctionsClient(api_key="YOUR_KEY")

page = client.search(brand="BMW", year_from=2018, fuel="Diesel", limit=5)

for car in page:
    print(car["car_name_en"], car["registration_year"], car["public_price_eur"], "EUR")

print(f"{page.total} matching lots")
```

```
BMW 320d Touring 2019 14350.0 EUR
BMW 520d xDrive   2018 16900.0 EUR
BMW X3 xDrive20d  2020 24100.0 EUR
BMW 118d          2019  9800.0 EUR
BMW 330e          2021 27450.0 EUR
18342 matching lots
```

## Getting a key

Keys are issued per customer, and a **free trial key** is available.

**[→ Request a free trial key](https://thecarapi.com/contact)**

Once you have it, either pass it in directly or export it:

```bash
export CARAUCTIONS_API_KEY="your-key"
```

```python
client = CarAuctionsClient()   # picks the key up from the environment
```

## What you can pull

### Search and filter

```python
page = client.search(
    brand="Audi",
    model="A4",
    year_from=2017, year_to=2022,
    kilometers_to=150_000,
    price_from=5000, price_to=20_000,
    fuel="Diesel",
    gearbox="Automatic",
    country="DE",
    site="openlane,auto1",     # only these sources
    damaged=False,
    buy_now=True,
    sort="price_low",
    limit=50,
)
```

Every result row carries `auction_id`, `site_name`, `clean_make`, `clean_model`,
`registration_year`, `mileage`, `hp`, `fuel_group`, `gearbox_group`, `public_price_eur`,
`buy_now_price`, `current_price`, `thumbnail_url`, `auction_end_at`, `is_broken` and more.

### Page through everything

`iter_search` handles paging for you and yields one vehicle at a time:

```python
for car in client.iter_search(brand="Toyota", fuel="Hybrid", max_results=500):
    print(car["auction_id"], car["public_price_eur"])
```

### Full lot detail

```python
lot = client.auction("openlane", "1234567")

print(lot["chassis_number"], lot["co2"], lot["cylinder_capacity"])
print(len(lot["gallery_images"]), "photos")

history = client.price_history("openlane", "1234567")
images  = client.auction_images("openlane", "1234567")
```

### Underpriced lots

`top_offers` returns only cars priced below their market reference, with the reference
attached:

```python
for car in client.top_offers(min_savings_pct=20, site="openlane", limit=10):
    print(car["car_name_en"], f"-{car['top_offer_savings_pct']}%")
```

### VIN history

```python
client.vin_history("WBA8E9G50GNT12345")
```

### Import cost calculator

```python
quote = client.calculate(price=15000, origin="KR", destination="BG", site_name="encar")
print(quote["breakdown"]["estimated_total"])
```

### Filter options and catalog

```python
client.brands()                 # every brand with counts
client.models(brand="BMW")      # models for a brand
client.sites()                  # available auction sources + live counts
client.facets(brand="BMW")      # all facets for a query in one request
client.manufacturers()          # manufacturer catalog
```

## Sources

| Source | Origin | Inventory |
|---|---|---|
| OpenLane | EU | Live auctions |
| Auto1 | EU | Live auctions |
| eCarsTrade | EU | Live auctions |
| Copart | DE | Live auctions |
| Schadeautos | NL | Live listings |
| Encar | KR | Live listings |
| CarVector | JP | Live listings |

## Errors

Every failure is a typed exception carrying the API's message and the request id you should
quote when reporting a problem:

```python
from carauctions import RateLimited, PermissionDenied, InvalidRequest

try:
    page = client.search(site="ebay")
except InvalidRequest as e:
    print(e.message)       # "Unknown site 'ebay'. Valid sites: auto1, copart, ..."
    print(e.request_id)
except RateLimited as e:
    time.sleep(e.retry_after)
except PermissionDenied:
    print("Your key does not cover this endpoint")
```

`AuthenticationError`, `PermissionDenied`, `NotFound`, `InvalidRequest`, `RateLimited` and
`ServerError` all inherit from `CarAuctionsError`.

## Rate limits

The quota window from the last response is always available, so you can throttle yourself
before you get a 429:

```python
client.search(brand="BMW")
print(client.rate_limit.remaining, "requests left until", client.rate_limit.reset)
```

Requests that hit a 429 or a 5xx are retried automatically, honouring `Retry-After`. When a
key is nearly exhausted you get one standard Python warning on stderr, so a long-running job
tells you before it stalls rather than after.

## Documentation

Full endpoint reference, field dictionary and response schemas:
**[thecarapi.com/docs](https://thecarapi.com/docs)**

## License

MIT
