# Code Auctions API — complete documentation

> This file contains the ENTIRE API documentation in one place. It is meant to be handed to an AI assistant so it can do the integration on its own.

Base: `https://reports.codeauctions.com/v1`  
Generated: 2026-12-03  
Platform version: 0.2.5

---

# Introduction

The Code Auctions API lets you do from your own system what you would otherwise
do by hand: generate vehicle history reports from a VIN, on Carfax and on
AutoCheck.

It is built for resellers and integrators. If you are not a developer, there is
a **Telegram bot** that does the same thing without writing any code.

## What you can do

| Module | What it is for | How you pay |
|---|---|---|
| **Vehicle reports** | Generate Carfax and AutoCheck reports by VIN. | Credits (packages) |
| **Seller Reserve API** | Show reserve availability and reveal a lot's reserve price. | Prepaid request packages |

## The essentials in four lines

- **Base:** `https://reports.codeauctions.com/v1`
- **Authentication:** `Authorization: Bearer rep_live_...` header
- **Format:** JSON both ways. UTF-8. Dates in UTC, ISO 8601.
- **To try it:** a `rep_test_` key spends nothing and calls no provider.

## How you sign up

You create your account at codeauctions.com. For security, **every account is
reviewed and approved by our team before it is activated**. Once approved, you
open your dashboard, create a key and you are calling. Until then, a `rep_test_`
key lets you try every endpoint without spending anything.

## What will never change in `/v1`

We commit to not breaking anything that already works:

- We do not remove fields from a response.
- We do not change the meaning of a field.
- We do not make a previously optional parameter required.

We may **add** new fields, so your code must ignore the ones it does not know.
A breaking change would ship as `/v2`, with `/v1` running in parallel and a
`Sunset` header warning months in advance.


---

# Get started in 5 minutes

## Try it right now, without registering

There is a public demo key printed in this documentation. Copy this and paste it
into your terminal:

```bash
curl -s https://reports.codeauctions.com/v1/ping \
  -H "Authorization: Bearer rep_test_gm4cWkJkptDIVZRn1uYYl7HQeflOClPxqhwv07OIKDy"
```

It returns fake responses with the exact structure of the real ones, spends
nothing, and is limited to 10 calls per
minute. To integrate for real, create your own test key: same behaviour, without
that limit.

## 1. Create your key

Open your dashboard, go to **API**, and press *Create test key*. It is created
instantly.

The key **is shown only once**. Store it in your secret manager: we do not keep
it in clear text anywhere, so if you lose it you have to revoke it and create
another one.

## 2. Check that it works

```bash
curl -s https://reports.codeauctions.com/v1/ping \
  -H "Authorization: Bearer rep_test_YOUR_KEY"
```

```json
{
  "data": { "pong": true, "mode": "test", "account_id": 42 },
  "mode": "test",
  "request_id": "req_7f3a9c21e8b04d5f9a1c"
}
```

If `mode` says `test`, you are good: nothing you do with that key spends money.

## 3. Generate your first report

```bash
curl -s --max-time 60 -X POST https://reports.codeauctions.com/v1/vehiclereports/reports \
  -H "Authorization: Bearer rep_test_YOUR_KEY" \
  -H "Content-Type: application/json" \
  -H "Idempotency-Key: $(uuidgen)" \
  -d '{"vin": "1HGCM82633A004352", "type": "carfax"}'
```

```json
{
  "data": {
    "vin": "1HGCM82633A004352",
    "type": "carfax",
    "report_url": "https://codeauctions.com/report/test-3a004352/",
    "pdf_url": null,
    "vehicle": "2019 Honda Accord EX-L",
    "generated_at": "2026-12-03T23:41:53Z",
    "age_days": 0,
    "fresh": true
  },
  "billing": { "charged": false, "reason": "Test mode: no balance or credits are spent, and no provider is called." },
  "mode": "test",
  "request_id": "req_c81f04ab7e2d"
}
```

For **AutoCheck**, send the same request with `"type": "autocheck"` and a
different `Idempotency-Key`. You can also use `POST /autocheck/reports`, whose
default and only supported type is `autocheck`. Both providers use the same
credits and the same `carfax:write` scope.

Look up a previously delivered AutoCheck report without spending credits:

```bash
curl -s 'https://reports.codeauctions.com/v1/vehiclereports/reports/1HGCM82633A004352?type=autocheck' \
  -H "Authorization: Bearer rep_test_YOUR_KEY"
```

Read `data.exists`, `data.report_url` and `data.pdf_url`. The PDF URL can be
`null` when only the web report is available; open `report_url` in that case.
Test URLs are sample report links, not paid vehicle-history documents.

## 4. Go live

Once your integration works:

1. Buy credits in your dashboard.
2. Create a `rep_live_` key.
3. Swap the key in your configuration. **Not a single URL changes.**

## What to know before you write code

- **A new report usually takes under a minute.** Set your HTTP client timeout to
  90 seconds or more. With the 10 seconds many libraries default to, you will
  see network errors on calls that actually succeeded.
- **Send `Idempotency-Key` on everything that charges.** If your connection
  drops after we charge and you retry, that header is what stops you being
  charged twice.
- **Store the `request_id` of every call.** If something goes wrong, that id
  finds your exact request in ten seconds. Without it, we are searching blind.
- **Ignore fields you do not know.** We will add new ones and we do not want to
  break anything for you.


---

# Authentication

Every call carries your key in the `Authorization` header:

```
Authorization: Bearer rep_live_a1b2c3d4e5f6...
```

We also accept `X-API-Key: rep_live_...` for convenience, but if you send both
we use the `Authorization` one.

## The two kinds of key

| Prefix | What it does |
|---|---|
| `rep_test_` | Realistic responses with the exact structure of the real ones. **Spends nothing and calls no provider.** |
| `rep_live_` | The real thing. Spends credits and balance. |

The prefix is not decoration: it lets GitHub's secret scanners detect a leaked
key, and it lets you tell production from test at a glance in a log.

## Scopes

Every key carries the list of what it may do. Grant only what you are going to
use: a read-only key cannot spend your credits if it leaks.

| Scope | What it allows |
|---|---|
| `carfax:read` | Read reports already generated, and the credit balance. |
| `carfax:write` | Generate new reports (spends credits). |
| `reserve:read` | Read reserve availability and request balance. |
| `reserve:write` | Reveal reserve prices (uses request units). |
| `account:read` | Read the account balance, usage and keys. |

You can also use a module wildcard, `carfax:*`, which is every scope of that
module. **A bare `*` does not exist**: an all-powerful key is exactly what we do
not want anyone creating by accident.

The historical names `carfax:read`, `carfax:write` and `carfax:*` apply to
**both Carfax and AutoCheck**, including the `/vehiclereports/` and `/autocheck/`
routes. Existing keys continue to work; do not invent `autocheck:*` or
`vehiclereports:*` scopes.

## Restrict by IP

Optional, and strongly recommended if your server has a fixed IP. You configure
it in the dashboard and it accepts single IPs and ranges (`198.51.100.0/24`). If
you fill it in, the key only works from there.

## If a key leaks

Two buttons in your dashboard:

- **Rotate** — creates a new key and lets you choose whether the old one dies
  now or in 24 hours. Choose 24 hours if you have to deploy: that way you do not
  cut off your own service.
- **Revoke all** — the red button, for when you do not know which one leaked. It
  cuts everything instantly and we email you the exact time.

## Authentication errors

| Code | HTTP | What happened |
|---|---|---|
| `no_api_key` | 401 | You did not send the header. |
| `invalid_api_key` | 401 | The key does not exist or is mistyped. |
| `revoked_api_key` | 401 | The key existed but has been revoked. |
| `ip_not_allowed` | 403 | Your IP is not on that key's allow list. |
| `insufficient_scope` | 403 | The key lacks the scope this endpoint requires. The error tells you which one. |
| `org_suspended` | 403 | Your account is suspended. The error carries the reason. |


---

# Test mode

A `rep_test_` key returns responses with **the exact structure** of the real
ones, but spends no credits, does not touch your balance and calls no provider.

It is not decoration: it is what lets you —or the AI helping you— build and
debug the whole integration without spending money.

## What changes and what does not

| | Test mode | Live |
|---|---|---|
| Response structure | identical | identical |
| Error codes | the same | the same |
| `mode` in the response | `"test"` | `"live"` |
| `billing.charged` | always `false` | depends on the module |
| The provider is called | **no** | yes |
| Data | sample reports | real |

The same VIN selects the same sample outcome for either report type.
Timestamps and request IDs can change. Sample report URLs do not contain a
real purchased history report; `pdf_url` may be `null`.

## Sample data

### Vehicle reports

| VIN | What it returns |
|---|---|
| `1HGCM82633A004352` | A successful report. |
| `5NPE24AF1FH999999` | `provider_empty` — so you can test the no-records path. |
| any other valid VIN | A successful report for that VIN. |

## The public demo key

It is printed here so you can try without registering:

```
rep_test_gm4cWkJkptDIVZRn1uYYl7HQeflOClPxqhwv07OIKDy
```

It is a test key, so it spends nothing. It is limited to 10 calls per minute and everyone
shares it: to integrate for real, create your own.

```bash
curl -s https://reports.codeauctions.com/v1/vehiclereports/credits \
  -H "Authorization: Bearer rep_test_gm4cWkJkptDIVZRn1uYYl7HQeflOClPxqhwv07OIKDy"
```

## When you go live

Change the key and nothing else. **The URLs are the same.** If your integration
works against `rep_test_`, it works against `rep_live_`.


---

# Billing and pricing

Each module has its own balance and pricing. Review its rules before making
live requests.

## Vehicle reports

You buy a package of credits and each call spends 1 credit. Credits never expire.

| Package | Reports | Price | Per report |
|---|---|---|---|
| Starter | 3 | $10.00 | $3.33 |
| Pro | 10 | $25.00 | $2.50 |
| Business | 25 | $50.00 | $2.00 |
| Dealer | 50 | $80.00 | $1.60 |
| Volume | 300 | $450.00 | $1.50 |
| Partner | 1000 | $1300.00 | $1.30 |

Credits do not expire.

## Seller Reserve API

Seller Reserve API prepaid packages: $100.00 for 334 requests; $250.00 for 1,000 requests; $500.00 for 2,500 requests. A successful reveal uses one request. Every ten valid requests without a revealed price use one request.

| Package | Requests | Price | Nominal request rate |
|---|---|---|---|
| Starter | 334 | $100.00 | $0.30 |
| Growth | 1000 | $250.00 | $0.25 |
| Scale | 2500 | $500.00 | $0.20 |

Requests do not expire. Buy a listed package; custom amounts are not supported. Package totals and whole request quantities define your purchase.

## What is charged and what is not

**Each successful live report purchase costs one credit**, whether it is
Carfax or AutoCheck, and whether generated now or served from the archive.
Requesting both types costs two credits. API and Telegram share one credit
balance. A replay with the same idempotency key does not purchase again.

**For vehicle reports, you are not charged** when there is no answer: the resource does not exist, or
we could not look it up, or something failed on our side. In those cases you get
an error and, if you had already been charged, **you are refunded
automatically**. You do not have to claim it.

**Seller Reserve API:** buy one of the prepaid request packages listed above. Package size determines the nominal request rate; request quantities are rounded up in your favor. Each successful reveal uses one request. Every ten completed unrevealed results use one request; technical errors do not count. Batch availability is currently free after a paid package purchase while requests remain available. Packages use verified wallet top-ups from the active payment environment; promotional credits are ineligible. When PayPal Sandbox checkout is enabled, verified Sandbox top-ups can buy packages and exercise the complete Batch and LOT DETAIL flow with the same consumption and limits as Live checkout. Seller Reserve balances are separate in Sandbox and Live checkout; the module and `/reserve/balance` show the request balance for the active payment environment. A separately funded Live balance is required when switching to Live checkout. API `rep_test_` keys remain fixture-only and consume no requests; they are distinct from PayPal Sandbox. API consumption reports `billing.credits_used` and `billing.amount_usd:"0.00"`: the wallet was charged when the package was purchased, with no additional wallet debit per call.


## The `billing` block

Every successful response carries what you were charged:

```json
"billing": { "charged": true, "unit": "report", "quantity": 1, "credits_used": 1 }
```

```json
"billing": { "charged": false, "reason": "Test mode: no balance or credits are spent, and no provider is called." }
```

For prepaid products, `credits_used` reports the credits or requests consumed.
`amount_usd`, when present, reports a wallet debit for this call; it is `"0.00"`
for prepaid consumption with no additional wallet debit. Zero dollars does not
mean zero credits or requests consumed. `charged:false` means no consumption; a `reason` may explain
why, and a zero-cost prepaid result can instead report `credits_used:0`.

## Not being charged twice

Send the `Idempotency-Key` header with a value that is unique per operation (a
UUID works) on **everything that charges**. If your connection drops after we
charge and you retry with the same key, we return the original response without
charging again.

```bash
-H "Idempotency-Key: 550e8400-e29b-41d4-a716-446655440000"
```

Keys are remembered for 24 hours. Two warnings:

- **One key per operation.** If you reuse the same one with different data, we
  answer `400 idempotency_reused` — it is almost always a loop reusing the key
  by mistake, and telling you saves you hours.
- **After a transient error, the key is released.** If you get `no_credits`,
  `vin_busy`, `credits_busy` or `rate_limited`, you can top up or wait and
  **retry with the SAME key**. That is what the message tells you to do.

## When you run out of credit

You get a `402` with everything you need to fix it inside the error:

```json
{
  "error": {
    "type": "billing_error",
    "code": "no_credits",
    "message": "No credits left on the account. Buy a package to keep generating reports.",
    "details": { "credits_available": 0, "buy_url": "https://codeauctions.com/panel/?tab=credits", "packages": [ ... ] }
  }
}
```

And we email you **before** you run out. You can change the threshold in your
dashboard.


---

# Errors

Every error has the same shape. One handler covers the whole API:

```json
{
  "error": {
    "type": "invalid_request_error",
    "code": "bad_vin",
    "message": "The \"vin\" parameter must be a 17-character VIN (without the letters I, O or Q).",
    "param": "vin",
    "doc_url": "https://codeauctions.com/api/?doc=errors#bad-vin"
  },
  "mode": "live",
  "request_id": "req_7f3a9c21e8b04d5f9a1c"
}
```

- **`code`** is what your code should look at. It is stable.
- **`message`** is for a person. It can change.
- **`param`** appears when the problem is one specific parameter.
- **`details`** carries useful data depending on the case: credits available,
  packages on sale, the earliest date you can ask for…
- **`request_id`** is what you send us if you need help.

## The five families

| `type` | HTTP | What it means | What to do |
|---|---|---|---|
| `invalid_request_error` | 400, 404, 409 | Something in your request is wrong. | Fix the request. Retrying as-is will not help. |
| `authentication_error` | 401, 403 | Who you are or what you may do. | Check the key and its scopes. |
| `billing_error` | 402 | Money or credits are missing. | Top up and retry with the same `Idempotency-Key`. |
| `rate_limit_error` | 429 | You are going too fast. | Wait as long as `Retry-After` says. |
| `api_error` | 5xx | It is our fault. | Retry with increasing backoff. You were not charged. |

## Every code

### 400 — Malformed request

- `invalid_request`
- `missing_parameter`
- `invalid_parameter`
- `bad_vin`
- `bad_date`
- `future_date`
- `too_old`
- `idempotency_reused`

### 401 — Not authenticated

- `no_api_key`
- `invalid_api_key`
- `revoked_api_key`

### 402 — Payment required

- `reserve_funding_required`
- `reserve_no_credits`
- `insufficient_funds`
- `no_credits`
- `pass_required`

### 403 — Not allowed

- `ip_not_allowed`
- `insufficient_scope`
- `org_suspended`
- `module_disabled`

### 404 — Not found

- `not_found`
- `provider_empty`

### 409 — Conflict with the current state

- `reserve_busy`
- `already_exists`
- `in_progress`
- `vin_busy`
- `credits_busy`

### 429 — Too many requests

- `rate_limited`

### 500 — Our error

- `internal_error`

### 503 — Service unavailable

- `reserve_unavailable`
- `provider_error`
- `provider_unconfigured`
- `upstream_timeout`

## Retrying properly

- **Network timeout**: the purchase may have succeeded. Retry the same URL,
  payload and `Idempotency-Key`; never switch routes or types during a retry.
- **`no_credits` / `insufficient_funds`**: top up, then retry with the same key.
- **`vin_busy`, `credits_busy`, `rate_limited`**: wait, respect `Retry-After`
  when present, and retry with the same key.
- **`in_progress` with `error.details.idempotency_key`**: the original request
  is still running. Wait a few seconds and reuse the same key.
- **`in_progress` with `error.details.retry_after`**: the provider is delayed
  and this result is saved. Wait the suggested seconds (normally 300), then
  use a **new** key if you choose to purchase again. You were refunded. You
  can instead await `carfax.report.recovered` or check the free GET endpoint.
- **`provider_empty`**: there are no usable records. Do not retry in a loop.
- **Other 5xx**: start with bounded backoff and the same key to resolve any
  uncertain outcome. Completed errors may be replayed for 24 hours; if the
  same confirmed error persists, investigate before starting a new purchase.
- **Other 4xx**: fix the key, scope, VIN or request before trying again.


---

# Rate limits

| Key type | Requests per minute |
|---|---|
| `rep_live_` | 120 |
| `rep_test_` | 60 |
| Public demo | 10 |

The limit is per key, not per IP: a client behind a NAT does not eat their
colleagues' quota.

## Rate-limit headers

Authenticated requests that reach rate limiting include these headers, even
when plenty of quota remains. Authentication failures can omit them:

```
X-RateLimit-Limit: 120
X-RateLimit-Remaining: 87
X-RateLimit-Reset: 1756900800
```

`X-RateLimit-Reset` is the Unix timestamp at which the counter resets to zero.

## When you go over

`429 rate_limited`, with `Retry-After` in seconds:

```
HTTP/1.1 429
Retry-After: 34
```

Wait those seconds. Do not retry earlier: you would only burn next minute's
quota.

## If you need more

Write to us and we will look at it. First, two things that almost always solve
it without raising the limit:

- **Queue batches in your own application.** Vehicle Reports accepts one VIN
  and one report type per creation request. There is no batch endpoint.
- **Store what we already gave you.** Report links are permanent. Asking again
  for a VIN you already have burns quota and costs you another credit.

## Other limits

- **Report input:** one VIN and one report type per POST.
- **A report takes 5-30 seconds.** Set your timeout to 60 s or more.
- **`Idempotency-Key`:** remembered for 24 hours.


---

# Webhooks

Most of the time you call us and we answer. Webhooks are the other direction:
**we call you** when something happens in your account.

You do not need them to use the API — `POST /vehiclereports/reports` already returns the
report link in its own response. You need them for the things that happen when
nobody is holding a connection open:

- A report that timed out and got **recovered hours later** by our retry job.
- A report **someone on your team pulled from Telegram**, which your system never saw.
- Your **credits or balance running low**, before your calls start failing.

## Setting one up

In your dashboard, open **Webhooks**, add an https URL and pick the events you
want. We show you a **signing secret once** — store it next to your API key.

Then press **Send test event** and check that your endpoint answered `200`. The
dashboard shows exactly what your server replied, which is the fastest way to
tell a bad signature from a bad URL.

## The events

| Event | When |
|---|---|
| `carfax.report.completed` | A report finished and its link is ready |
| `carfax.report.recovered` | A report that had timed out was recovered later |
| `carfax.credits.low` | Your report credits are running out |
| `account.balance.low` | Your wallet balance is running out |

The `carfax.*` event names are retained for compatibility and cover **both
providers**. For report events, inspect `data.type` (`carfax` or `autocheck`)
to determine which report was delivered. Existing webhook subscriptions keep
working with the new routes.

There is no wildcard, on purpose. When we add a new event type you turn it on
yourself — that way a new event can never make your endpoint fail on something
you never asked for.

Each endpoint belongs to **one mode**. A `test` endpoint only ever receives
events from test keys, so you can point your staging system at it and it will
never react to a real order.

## What we send

A `POST` with `Content-Type: application/json` and this body:

```json
{
    "id": "evt_9f2c1a7b4e5d6a8c0b3f2e11",
    "type": "carfax.report.completed",
    "created": 1788744000,
    "mode": "live",
    "api_version": "v1",
    "request_id": "",
    "data": {
        "vin": "1HGCM82633A004352",
        "type": "carfax",
        "report_url": "https://codeauctions.com/report/example-3a004352/",
        "vehicle": "2019 Honda Accord EX-L",
        "generated_at": "2026-12-03T23:41:53+00:00",
        "age_days": 0,
        "fresh": true
    }
}
```

Headers you get:

| Header | What it is |
|---|---|
| `CodeAuctions-Signature` | The signature. See below. |
| `CodeAuctions-Event-Id` | Same as `id` in the body. Use it to discard duplicates. |
| `CodeAuctions-Event-Type` | Same as `type`. Handy for routing before you parse. |
| `CodeAuctions-Delivery-Attempt` | `1` the first time, `2` on the first retry, and so on. |

Answer **`2xx`** as soon as you have stored the event. Anything else counts as a
failure. Do the slow work afterwards, not before you answer — we wait 8 seconds
and then give up.

## Verifying the signature

The header looks like this:

```
CodeAuctions-Signature: t=1788744000,v1=5257a869e7ecebeda32affa62cdca3fa…
```

`t` is the moment **of this delivery attempt** — not the moment of the event,
which is `created` inside the body. They differ on retries, and the one you
verify against is `t`.

Rebuild the signed string as `t` + `.` + **the raw body exactly as you received
it** — do not re-serialize it, or the bytes change and nothing will ever match:

```php
$firma = hash_hmac( 'sha256', $t . '.' . $cuerpo_crudo, $secreto );
```

```javascript
const firma = crypto.createHmac('sha256', secreto)
                    .update(t + '.' + cuerpoCrudo)
                    .digest('hex');
```

```python
firma = hmac.new(secreto.encode(), f"{t}.{cuerpo_crudo}".encode(), hashlib.sha256).hexdigest()
```

Then compare it against **every** `v1=` in the header, with a constant-time
comparison (`hash_equals`, `crypto.timingSafeEqual`, `hmac.compare_digest`).

There can be more than one `v1=`: for **24 hours after you rotate the secret** we
sign with both the new one and the old one, so you can deploy without missing an
event. A verifier that only reads the first `v1=` will reject valid deliveries
during that window.

Finally, reject anything where `t` is more than **300 seconds** away from your
own clock, in either direction. That is what stops somebody replaying an old
delivery at you.

## When your server is down

We retry with a growing gap — about a minute, then five, fifteen, an hour, and on
up to twelve — for roughly a day, then stop. Each retry is signed again with a
fresh `t`.

Two things worth knowing:

- **After five failures in a row we turn the endpoint off** and email the account
  owner. While it is off we do **not** queue events for it, so turning it back on
  will not flood your server with everything it missed.
- **We do not follow redirects.** If your endpoint answers a `301` or `302` we
  treat it as a permanent failure — give us the final address instead.

## Duplicates

Aim to be idempotent. We use a conditional claim so the same delivery is not sent
twice, but network timeouts are network timeouts: if we do not hear a `2xx` we
try again, and your server may well have processed the first one. Key your
processing on `CodeAuctions-Event-Id` and you never have to think about it again.


---

# Telegram

Use the same Vehicle Reports account and credits from Telegram without an API
key or a custom integration. Both Carfax and AutoCheck are available.

## Link your Telegram account

1. Open **Vehicle reports → Telegram** in your [dashboard](https://codeauctions.com/?tab=module&mod=vehiclereports&view=telegram).
2. Generate a connection code. Open the bot using the dashboard link, or send
   `/link ABC123` with your own six-character code. Codes expire after 15 minutes
   and can be used only once.
3. Buy a report package if the account is not activated yet. A successful
   purchase activates access; there is no manual approval step.
4. Send a 17-character VIN, or `/vin 1HGCM82633A004352`.
5. Choose **Carfax Report** or **AutoCheck Report** from the two buttons.

Sending a VIN and seeing the two buttons does not spend a credit. Each report
type you choose is a separate one-credit purchase; choosing both costs two
credits. The bot sends the PDF when available, or a link to the web report.
Generating usually takes 5–30 seconds.

## Avoid duplicate purchases

Repeated requests by the same Telegram user for the same VIN and report type
on the same UTC day reuse the existing operation. Carfax and AutoCheck have
separate operations. A request on a later UTC day is a new purchase. API
requests have their own `Idempotency-Key` and are separate purchases.

## Commands

| Command | What it does |
|---|---|
| `/start` | Open the welcome message; a dashboard connection link can also link you. |
| `/link CODE` | Connect this Telegram user to the account that issued the code. |
| `/vin VIN` | Show the two report provider buttons for that VIN. |
| `/balance` | Show the shared report-credit balance. |
| `/recent` | Show your latest five reports. |
| `/whoami` | Show which account you are connected to. |
| `/unlink` | Disconnect this Telegram user. |
| `/help` | Show help and available commands. |

## History and integrations

Open **Vehicle reports → Usage** to browse successful live purchases in pages
of ten, with VIN, report type, date, PDF/report link and **API** or **Telegram**
source. Failed calls and free lookups are excluded. Historical entries may
have only a web report link when no PDF was stored.

Webhook report events keep the names `carfax.report.completed` and
`carfax.report.recovered` for compatibility. Their `data.type` identifies
Carfax or AutoCheck. See **Webhooks** for signature verification, retries and
duplicate delivery handling.


---

# Full reference

Every endpoint, in one table. Each one links to its module, where the detail
lives.

| Method | Path | What it does | Charges | Scope |
|---|---|---|---|---|
| `GET` | `/v1/autocheck/credits` | Credits available and packages on sale | no | `carfax:read` |
| `GET` | `/v1/autocheck/reports/{vin}` | Look up a report already generated | no | `carfax:read` |
| `GET` | `/v1/autocheck/reports/{vin}/content` | Download a report to host on your own website | no | `carfax:read` |
| `GET` | `/v1/carfax/credits` | Credits available and packages on sale | no | `carfax:read` |
| `GET` | `/v1/carfax/reports/{vin}` | Look up a report already generated | no | `carfax:read` |
| `GET` | `/v1/carfax/reports/{vin}/content` | Download a report to host on your own website | no | `carfax:read` |
| `GET` | `/v1/vehiclereports/credits` | Credits available and packages on sale | no | `carfax:read` |
| `GET` | `/v1/vehiclereports/reports/{vin}` | Look up a report already generated | no | `carfax:read` |
| `GET` | `/v1/vehiclereports/reports/{vin}/content` | Download a report to host on your own website | no | `carfax:read` |
| `POST` | `/v1/autocheck/reports` | Generate a vehicle report | yes | `carfax:write` |
| `POST` | `/v1/carfax/reports` | Generate a vehicle report | yes | `carfax:write` |
| `POST` | `/v1/vehiclereports/reports` | Generate a vehicle report | yes | `carfax:write` |
| `POST` | `/v1/reserve/availability` | Show reserve availability badges | no | `reserve:read` |
| `GET` | `/v1/reserve/balance` | Read the Seller Reserve API balance | no | `reserve:read` |
| `POST` | `/v1/reserve/reveal` | Reveal a lot's reserve price | yes | `reserve:write` |
| `GET` | `/v1/ping` | Check that your key works | no | — |
| `GET` | `/v1/account` | Balance, credits and tier of your account | no | `account:read` |

## Machine-readable formats

- **OpenAPI 3.1:** [`/api/openapi.json`](/api/openapi.json)
- **Postman collection:** [`/api/postman.json`](/api/postman.json)
- **All the documentation in Markdown:** [`/api/md/api-complete.md`](/api/md/api-complete.md)

That last file is the one you hand to an AI assistant so it can do the
integration on its own.


---

# Vehicle reports

Generates vehicle history reports (Carfax and AutoCheck) from a VIN. Each successfully delivered report spends 1 credit from the shared Vehicle reports balance. API and Telegram use the same credits.

## How you pay

You buy a package of credits and each call spends 1 credit. Credits never expire.

| Package | Reports | Price | Per report |
|---|---|---|---|
| Starter | 3 | $10.00 | $3.33 |
| Pro | 10 | $25.00 | $2.50 |
| Business | 25 | $50.00 | $2.00 |
| Dealer | 50 | $80.00 | $1.60 |
| Volume | 300 | $450.00 | $1.50 |
| Partner | 1000 | $1300.00 | $1.30 |

Credits do not expire.

## Getting started

1. Check your credits with `GET /v1/vehiclereports/credits` and a key with `carfax:read`.
2. Check an existing purchase with `GET /v1/vehiclereports/reports/{vin}?type=carfax` or `type=autocheck`; this is free.
3. Generate with `POST /v1/vehiclereports/reports`, `carfax:write`, and JSON containing `vin` and `type` (`carfax` or `autocheck`). Omitted `type` defaults to `carfax`. Send a unique `Idempotency-Key`.
4. Host it on your own website: `GET /v1/vehiclereports/reports/{vin}/content?type=carfax&format=html` returns the report as a self-contained HTML document in base64 (also `format=pdf`), with no CodeAuctions branding. It is free. `report_url` and `pdf_url` are also available if you prefer to link to our copy.

Try it first with a `rep_test_` key: it spends no credits and calls no provider.

## What to know

- Every successful new POST spends 1 credit, including repeat VINs and cached reports. A replay with the same Idempotency-Key, route and payload within 24 hours returns the stored result without another charge. Use separate keys for Carfax and AutoCheck. A free GET checks reports already purchased by your account; use the correct type.
- POST /v1/autocheck/reports and GET /v1/autocheck/reports/{vin} are explicit AutoCheck routes; they default to autocheck and reject type=carfax. GET /v1/autocheck/credits reads the same shared balance. Existing /v1/carfax/* routes remain compatible and accept both types. All routes keep the existing carfax:read and carfax:write scopes.
- `generated_at` is the REAL date of the report and `fresh` tells you whether it was just generated. A new POST serves an archived copy only if it is at most 7 days old. A free GET can return older reports you already purchased.
- A new report usually takes under a minute. Set a timeout of at least 90 seconds.
- Reports are delivered without any CodeAuctions or third-party branding. GET /reports/{vin}/content returns the report you purchased as base64 (format=html or format=pdf) so you can serve it from your own domain; the HTML document is self-contained (pages embedded as images, with a selectable text layer) and loads nothing from other sites. It is free and you can call it as many times as you need.
- If something fails after you were charged, the credit is refunded automatically. You do not have to claim it.
- If you get a 409 vin_busy, there is another request in flight for that VIN: wait a few seconds and retry with the SAME Idempotency-Key.
- If the provider returns in_progress after a purchase, the credit is refunded and that response is retained under the original key. Check the report later with GET; if you need a new purchase, wait a few minutes and use a NEW Idempotency-Key. Other provider failures are also retained for 24 hours; a new intentional attempt needs a new key. no_credits, insufficient_funds, vin_busy, credits_busy and rate_limited allow retrying the SAME key.
- Telegram setup is under Vehicle reports → Telegram in the dashboard. Send the 6-letter link code to the bot, then send a VIN. Choose Carfax Report or AutoCheck Report. Sending a VIN is free; each chosen type costs 1 credit. Buttons expire in 15 minutes and only work for the linked sender. Repeating the same VIN and type on the same UTC day reuses the result; selecting both types costs 2 credits.
- Both report types emit the existing carfax.report.completed webhook event. Inspect data.type to distinguish Carfax from AutoCheck. A recovered report uses carfax.report.recovered. These event names remain compatible with existing subscriptions.
- Test responses have the same fields as live responses, but report_url is an illustrative URL and pdf_url is null; test mode does not create a real report. GET /reports/{vin}/content with a test key returns a small sample document for the test VIN.
- The API sends no emails. The response carries the link; if you want to notify your customer, do it from your system. The one exception: if the provider is slow and the report is recovered later, the account owner is emailed.
- Test VIN that works: 1HGCM82633A004352
- Test VIN with no records: 5NPE24AF1FH999999

## Endpoints

### `GET /v1/autocheck/credits`

**Credits available and packages on sale**

AutoCheck endpoint. Uses the same shared report credits. How many credits you have left and which packages you can buy. Spends nothing.

| | |
|---|---|
| Scope | `carfax:read` |
| Charges | no |
| `Idempotency-Key` | not needed |

#### Example

```bash
curl -s https://reports.codeauctions.com/v1/autocheck/credits \
  -H "Authorization: Bearer rep_live_YOUR_KEY"
```

#### Returns

| Field | What it is |
|---|---|
| `credits_available` | integer |
| `packages` | array — available packages with their price |

### `GET /v1/autocheck/reports/{vin}`

**Look up a report already generated**

AutoCheck endpoint. Uses the same shared report credits. Returns the link of a report you already generated, spending nothing. Use it BEFORE generating so you do not overspend: generating that VIN again DOES cost you another credit.

| | |
|---|---|
| Scope | `carfax:read` |
| Charges | no |
| `Idempotency-Key` | not needed |

#### Parameters

| Name | Type | Required | What it is |
|---|---|---|---|
| `vin` *(in the path)* | `string` | yes | Vehicle Identification Number (VIN), 17 characters. |
| `type` | `autocheck` | no | Always autocheck for this endpoint. Default: `autocheck`. |

#### Example

```bash
curl -s https://reports.codeauctions.com/v1/autocheck/reports/1HGCM82633A004352?type=autocheck \
  -H "Authorization: Bearer rep_live_YOUR_KEY"
```

```json
{
    "data": {
        "vin": "1HGCM82633A004352",
        "type": "autocheck",
        "exists": true,
        "report_url": "https://codeauctions.com/report/a1b2c3d4e5/",
        "pdf_url": "https://codeauctions.com/report/a1b2c3d4e5/Report-1HGCM82633A004352.pdf"
    }
}
```

#### Returns

| Field | What it is |
|---|---|
| `vin` | string |
| `type` | string |
| `exists` | boolean — whether you already have it |
| `report_url` | string\|null — the link, if it exists |
| `pdf_url` | string\|null — direct PDF link, when available |

#### Errors specific to this endpoint

- `bad_vin` — 400

### `GET /v1/autocheck/reports/{vin}/content`

**Download a report to host on your own website**

AutoCheck endpoint. Uses the same shared report credits. Returns a report you already purchased as base64 content, ready to store and serve from your own domain. `format=html` (default) is a single self-contained HTML document: the report pages are embedded as images with a selectable text layer, it loads nothing from other sites and carries no CodeAuctions branding. `format=pdf` returns the PDF when available. Spends nothing: call it right after `POST /reports`, or any time later.

| | |
|---|---|
| Scope | `carfax:read` |
| Charges | no |
| `Idempotency-Key` | not needed |

#### Parameters

| Name | Type | Required | What it is |
|---|---|---|---|
| `vin` *(in the path)* | `string` | yes | Vehicle Identification Number (VIN), 17 characters. |
| `type` | `autocheck` | no | Always autocheck for this endpoint. Default: `autocheck`. |
| `format` | `html` \| `pdf` | no | html (self-contained document) or pdf. Default: `html`. |

#### Example

```bash
curl -s https://reports.codeauctions.com/v1/autocheck/reports/1HGCM82633A004352/content?type=autocheck&format=html \
  -H "Authorization: Bearer rep_live_YOUR_KEY"
```

```json
{
    "data": {
        "vin": "1HGCM82633A004352",
        "type": "autocheck",
        "format": "html",
        "content_type": "text/html; charset=utf-8",
        "filename": "Report-1HGCM82633A004352.html",
        "encoding": "base64",
        "size_bytes": 1702522,
        "generated_at": "2026-08-29T14:03:11Z",
        "content_base64": "PCFET0NUWVBFIGh0bWw+…"
    }
}
```

#### Returns

| Field | What it is |
|---|---|
| `vin` | string |
| `type` | string |
| `format` | string — html or pdf |
| `content_type` | string — MIME type to serve it with |
| `filename` | string — suggested file name |
| `encoding` | string — always base64 |
| `size_bytes` | integer — size of the decoded file |
| `generated_at` | string\|null — ISO 8601 date the report was generated |
| `content_base64` | string — the file, base64-encoded |

#### Errors specific to this endpoint

- `bad_vin` — 400
- `not_found` — 404
- `provider_bad_response` — 500

### `GET /v1/carfax/credits`

**Credits available and packages on sale**

Compatible alias of the Vehicle reports endpoint. Accepts both report types. How many credits you have left and which packages you can buy. Spends nothing.

| | |
|---|---|
| Scope | `carfax:read` |
| Charges | no |
| `Idempotency-Key` | not needed |

#### Example

```bash
curl -s https://reports.codeauctions.com/v1/carfax/credits \
  -H "Authorization: Bearer rep_live_YOUR_KEY"
```

#### Returns

| Field | What it is |
|---|---|
| `credits_available` | integer |
| `packages` | array — available packages with their price |

### `GET /v1/carfax/reports/{vin}`

**Look up a report already generated**

Compatible alias of the Vehicle reports endpoint. Accepts both report types. Returns the link of a report you already generated, spending nothing. Use it BEFORE generating so you do not overspend: generating that VIN again DOES cost you another credit.

| | |
|---|---|
| Scope | `carfax:read` |
| Charges | no |
| `Idempotency-Key` | not needed |

#### Parameters

| Name | Type | Required | What it is |
|---|---|---|---|
| `vin` *(in the path)* | `string` | yes | Vehicle Identification Number (VIN), 17 characters. |
| `type` | `carfax` \| `autocheck` | no | Which report provider to use. Default: `carfax`. |

#### Example

```bash
curl -s https://reports.codeauctions.com/v1/carfax/reports/1HGCM82633A004352?type=carfax \
  -H "Authorization: Bearer rep_live_YOUR_KEY"
```

```json
{
    "data": {
        "vin": "1HGCM82633A004352",
        "type": "carfax",
        "exists": true,
        "report_url": "https://codeauctions.com/report/a1b2c3d4e5/",
        "pdf_url": "https://codeauctions.com/report/a1b2c3d4e5/Report-1HGCM82633A004352.pdf"
    }
}
```

#### Returns

| Field | What it is |
|---|---|
| `vin` | string |
| `type` | string |
| `exists` | boolean — whether you already have it |
| `report_url` | string\|null — the link, if it exists |
| `pdf_url` | string\|null — direct PDF link, when available |

#### Errors specific to this endpoint

- `bad_vin` — 400

### `GET /v1/carfax/reports/{vin}/content`

**Download a report to host on your own website**

Compatible alias of the Vehicle reports endpoint. Accepts both report types. Returns a report you already purchased as base64 content, ready to store and serve from your own domain. `format=html` (default) is a single self-contained HTML document: the report pages are embedded as images with a selectable text layer, it loads nothing from other sites and carries no CodeAuctions branding. `format=pdf` returns the PDF when available. Spends nothing: call it right after `POST /reports`, or any time later.

| | |
|---|---|
| Scope | `carfax:read` |
| Charges | no |
| `Idempotency-Key` | not needed |

#### Parameters

| Name | Type | Required | What it is |
|---|---|---|---|
| `vin` *(in the path)* | `string` | yes | Vehicle Identification Number (VIN), 17 characters. |
| `type` | `carfax` \| `autocheck` | no | Which report provider to use. Default: `carfax`. |
| `format` | `html` \| `pdf` | no | html (self-contained document) or pdf. Default: `html`. |

#### Example

```bash
curl -s https://reports.codeauctions.com/v1/carfax/reports/1HGCM82633A004352/content?type=carfax&format=html \
  -H "Authorization: Bearer rep_live_YOUR_KEY"
```

```json
{
    "data": {
        "vin": "1HGCM82633A004352",
        "type": "carfax",
        "format": "html",
        "content_type": "text/html; charset=utf-8",
        "filename": "Report-1HGCM82633A004352.html",
        "encoding": "base64",
        "size_bytes": 1702522,
        "generated_at": "2026-08-29T14:03:11Z",
        "content_base64": "PCFET0NUWVBFIGh0bWw+…"
    }
}
```

#### Returns

| Field | What it is |
|---|---|
| `vin` | string |
| `type` | string |
| `format` | string — html or pdf |
| `content_type` | string — MIME type to serve it with |
| `filename` | string — suggested file name |
| `encoding` | string — always base64 |
| `size_bytes` | integer — size of the decoded file |
| `generated_at` | string\|null — ISO 8601 date the report was generated |
| `content_base64` | string — the file, base64-encoded |

#### Errors specific to this endpoint

- `bad_vin` — 400
- `not_found` — 404
- `provider_bad_response` — 500

### `GET /v1/vehiclereports/credits`

**Credits available and packages on sale**

How many credits you have left and which packages you can buy. Spends nothing.

| | |
|---|---|
| Scope | `carfax:read` |
| Charges | no |
| `Idempotency-Key` | not needed |

#### Example

```bash
curl -s https://reports.codeauctions.com/v1/vehiclereports/credits \
  -H "Authorization: Bearer rep_live_YOUR_KEY"
```

#### Returns

| Field | What it is |
|---|---|
| `credits_available` | integer |
| `packages` | array — available packages with their price |

### `GET /v1/vehiclereports/reports/{vin}`

**Look up a report already generated**

Returns the link of a report you already generated, spending nothing. Use it BEFORE generating so you do not overspend: generating that VIN again DOES cost you another credit.

| | |
|---|---|
| Scope | `carfax:read` |
| Charges | no |
| `Idempotency-Key` | not needed |

#### Parameters

| Name | Type | Required | What it is |
|---|---|---|---|
| `vin` *(in the path)* | `string` | yes | Vehicle Identification Number (VIN), 17 characters. |
| `type` | `carfax` \| `autocheck` | no | Which report provider to use. Default: `carfax`. |

#### Example

```bash
curl -s https://reports.codeauctions.com/v1/vehiclereports/reports/1HGCM82633A004352?type=carfax \
  -H "Authorization: Bearer rep_live_YOUR_KEY"
```

```json
{
    "data": {
        "vin": "1HGCM82633A004352",
        "type": "carfax",
        "exists": true,
        "report_url": "https://codeauctions.com/report/a1b2c3d4e5/",
        "pdf_url": "https://codeauctions.com/report/a1b2c3d4e5/Report-1HGCM82633A004352.pdf"
    }
}
```

#### Returns

| Field | What it is |
|---|---|
| `vin` | string |
| `type` | string |
| `exists` | boolean — whether you already have it |
| `report_url` | string\|null — the link, if it exists |
| `pdf_url` | string\|null — direct PDF link, when available |

#### Errors specific to this endpoint

- `bad_vin` — 400

### `GET /v1/vehiclereports/reports/{vin}/content`

**Download a report to host on your own website**

Returns a report you already purchased as base64 content, ready to store and serve from your own domain. `format=html` (default) is a single self-contained HTML document: the report pages are embedded as images with a selectable text layer, it loads nothing from other sites and carries no CodeAuctions branding. `format=pdf` returns the PDF when available. Spends nothing: call it right after `POST /reports`, or any time later.

| | |
|---|---|
| Scope | `carfax:read` |
| Charges | no |
| `Idempotency-Key` | not needed |

#### Parameters

| Name | Type | Required | What it is |
|---|---|---|---|
| `vin` *(in the path)* | `string` | yes | Vehicle Identification Number (VIN), 17 characters. |
| `type` | `carfax` \| `autocheck` | no | Which report provider to use. Default: `carfax`. |
| `format` | `html` \| `pdf` | no | html (self-contained document) or pdf. Default: `html`. |

#### Example

```bash
curl -s https://reports.codeauctions.com/v1/vehiclereports/reports/1HGCM82633A004352/content?type=carfax&format=html \
  -H "Authorization: Bearer rep_live_YOUR_KEY"
```

```json
{
    "data": {
        "vin": "1HGCM82633A004352",
        "type": "carfax",
        "format": "html",
        "content_type": "text/html; charset=utf-8",
        "filename": "Report-1HGCM82633A004352.html",
        "encoding": "base64",
        "size_bytes": 1702522,
        "generated_at": "2026-08-29T14:03:11Z",
        "content_base64": "PCFET0NUWVBFIGh0bWw+…"
    }
}
```

#### Returns

| Field | What it is |
|---|---|
| `vin` | string |
| `type` | string |
| `format` | string — html or pdf |
| `content_type` | string — MIME type to serve it with |
| `filename` | string — suggested file name |
| `encoding` | string — always base64 |
| `size_bytes` | integer — size of the decoded file |
| `generated_at` | string\|null — ISO 8601 date the report was generated |
| `content_base64` | string — the file, base64-encoded |

#### Errors specific to this endpoint

- `bad_vin` — 400
- `not_found` — 404
- `provider_bad_response` — 500

### `POST /v1/autocheck/reports`

**Generate a vehicle report**

AutoCheck endpoint. Uses the same shared report credits. Generates a Carfax or AutoCheck report for a VIN and returns the link. It ALWAYS spends 1 credit, even if you had asked for that same VIN before: every call is a purchase. The response carries the real report date in `generated_at`, and `fresh` tells you whether it was just generated or comes from our archive (never older than 7 days). A new report usually takes under a minute: use a timeout of at least 90 seconds. To host the report on your own website, download it with `GET /reports/{vin}/content`.

| | |
|---|---|
| Scope | `carfax:write` |
| Charges | yes |
| `Idempotency-Key` | **required** |

#### Parameters

| Name | Type | Required | What it is |
|---|---|---|---|
| `vin` | `string` | yes | Vehicle Identification Number (VIN), 17 characters. |
| `type` | `autocheck` | no | Always autocheck for this endpoint. Default: `autocheck`. |

#### Example

```bash
curl -s -X POST https://reports.codeauctions.com/v1/autocheck/reports \
  -H "Authorization: Bearer rep_live_YOUR_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"vin":"1HGCM82633A004352","type":"autocheck"}'
```

```json
{
    "data": {
        "vin": "1HGCM82633A004352",
        "type": "autocheck",
        "report_url": "https://codeauctions.com/report/a1b2c3d4e5/",
        "pdf_url": "https://codeauctions.com/report/a1b2c3d4e5/Report-1HGCM82633A004352.pdf",
        "vehicle": "2019 Honda Accord EX-L",
        "generated_at": "2026-08-29T14:03:11Z",
        "age_days": 0,
        "fresh": true
    }
}
```

#### Returns

| Field | What it is |
|---|---|
| `vin` | string — the VIN you asked about |
| `type` | string — carfax or autocheck |
| `report_url` | string — permanent link to the report |
| `pdf_url` | string\|null — direct PDF link, null when only the HTML report is available |
| `vehicle` | string — vehicle description, empty when unavailable |
| `generated_at` | string — the REAL ISO 8601 date the report was generated |
| `age_days` | integer — how old the report is in days (0 = just generated) |
| `fresh` | boolean — true if it was generated on this call |

#### Errors specific to this endpoint

- `no_credits` — 402
- `bad_vin` — 400
- `vin_busy` — 409
- `in_progress` — 409
- `provider_error` — 503
- `provider_empty` — 404
- `provider_unavailable` — 500
- `provider_bad_response` — 500
- `storage_unavailable` — 500
- `storage_failed` — 500
- `module_disabled` — 403

### `POST /v1/carfax/reports`

**Generate a vehicle report**

Compatible alias of the Vehicle reports endpoint. Accepts both report types. Generates a Carfax or AutoCheck report for a VIN and returns the link. It ALWAYS spends 1 credit, even if you had asked for that same VIN before: every call is a purchase. The response carries the real report date in `generated_at`, and `fresh` tells you whether it was just generated or comes from our archive (never older than 7 days). A new report usually takes under a minute: use a timeout of at least 90 seconds. To host the report on your own website, download it with `GET /reports/{vin}/content`.

| | |
|---|---|
| Scope | `carfax:write` |
| Charges | yes |
| `Idempotency-Key` | **required** |

#### Parameters

| Name | Type | Required | What it is |
|---|---|---|---|
| `vin` | `string` | yes | Vehicle Identification Number (VIN), 17 characters. |
| `type` | `carfax` \| `autocheck` | no | Which report provider to use. Default: `carfax`. |

#### Example

```bash
curl -s -X POST https://reports.codeauctions.com/v1/carfax/reports \
  -H "Authorization: Bearer rep_live_YOUR_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"vin":"1HGCM82633A004352","type":"carfax"}'
```

```json
{
    "data": {
        "vin": "1HGCM82633A004352",
        "type": "carfax",
        "report_url": "https://codeauctions.com/report/a1b2c3d4e5/",
        "pdf_url": "https://codeauctions.com/report/a1b2c3d4e5/Report-1HGCM82633A004352.pdf",
        "vehicle": "2019 Honda Accord EX-L",
        "generated_at": "2026-08-29T14:03:11Z",
        "age_days": 0,
        "fresh": true
    }
}
```

#### Returns

| Field | What it is |
|---|---|
| `vin` | string — the VIN you asked about |
| `type` | string — carfax or autocheck |
| `report_url` | string — permanent link to the report |
| `pdf_url` | string\|null — direct PDF link, null when only the HTML report is available |
| `vehicle` | string — vehicle description, empty when unavailable |
| `generated_at` | string — the REAL ISO 8601 date the report was generated |
| `age_days` | integer — how old the report is in days (0 = just generated) |
| `fresh` | boolean — true if it was generated on this call |

#### Errors specific to this endpoint

- `no_credits` — 402
- `bad_vin` — 400
- `vin_busy` — 409
- `in_progress` — 409
- `provider_error` — 503
- `provider_empty` — 404
- `provider_unavailable` — 500
- `provider_bad_response` — 500
- `storage_unavailable` — 500
- `storage_failed` — 500
- `module_disabled` — 403

### `POST /v1/vehiclereports/reports`

**Generate a vehicle report**

Generates a Carfax or AutoCheck report for a VIN and returns the link. It ALWAYS spends 1 credit, even if you had asked for that same VIN before: every call is a purchase. The response carries the real report date in `generated_at`, and `fresh` tells you whether it was just generated or comes from our archive (never older than 7 days). A new report usually takes under a minute: use a timeout of at least 90 seconds. To host the report on your own website, download it with `GET /reports/{vin}/content`.

| | |
|---|---|
| Scope | `carfax:write` |
| Charges | yes |
| `Idempotency-Key` | **required** |

#### Parameters

| Name | Type | Required | What it is |
|---|---|---|---|
| `vin` | `string` | yes | Vehicle Identification Number (VIN), 17 characters. |
| `type` | `carfax` \| `autocheck` | no | Which report provider to use. Default: `carfax`. |

#### Example

```bash
curl -s -X POST https://reports.codeauctions.com/v1/vehiclereports/reports \
  -H "Authorization: Bearer rep_live_YOUR_KEY" \
  -H "Idempotency-Key: $(uuidgen)" \
  -H "Content-Type: application/json" \
  -d '{"vin":"1HGCM82633A004352","type":"carfax"}'
```

```json
{
    "data": {
        "vin": "1HGCM82633A004352",
        "type": "carfax",
        "report_url": "https://codeauctions.com/report/a1b2c3d4e5/",
        "pdf_url": "https://codeauctions.com/report/a1b2c3d4e5/Report-1HGCM82633A004352.pdf",
        "vehicle": "2019 Honda Accord EX-L",
        "generated_at": "2026-08-29T14:03:11Z",
        "age_days": 0,
        "fresh": true
    }
}
```

#### Returns

| Field | What it is |
|---|---|
| `vin` | string — the VIN you asked about |
| `type` | string — carfax or autocheck |
| `report_url` | string — permanent link to the report |
| `pdf_url` | string\|null — direct PDF link, null when only the HTML report is available |
| `vehicle` | string — vehicle description, empty when unavailable |
| `generated_at` | string — the REAL ISO 8601 date the report was generated |
| `age_days` | integer — how old the report is in days (0 = just generated) |
| `fresh` | boolean — true if it was generated on this call |

#### Errors specific to this endpoint

- `no_credits` — 402
- `bad_vin` — 400
- `vin_busy` — 409
- `in_progress` — 409
- `provider_error` — 503
- `provider_empty` — 404
- `provider_unavailable` — 500
- `provider_bad_response` — 500
- `storage_unavailable` — 500
- `storage_failed` — 500
- `module_disabled` — 403



---

# Seller Reserve API

Check whether a Copart or IAAI lot has a reserve, then reveal its amount on demand.

## Request packages

- A successfully revealed price uses **1 prepaid request**.
- Every **10 completed lookups without a revealed price** use 1 request. The remaining count carries over between calls and top-ups in the same payment environment. Technical errors and rejected requests do not count.
- Buy one of the packages below; the minimum purchase is **$100.00**. Each purchase adds its listed request quantity to your existing balance. Requests do not expire. Custom purchase amounts are not supported.

| Package | Total USD | Requests | Nominal request rate |
|---|---|---|---|
| Starter | $100.00 | 334 | $0.30 |
| Growth | $250.00 | 1000 | $0.25 |
| Scale | $500.00 | 2500 | $0.20 |

Package size determines the nominal rate. Request quantities are rounded up to whole requests in your favor; the listed package total and request quantity are the amounts you buy. There is no additional wallet charge when a request is consumed.

- Add money in **Billing**, then buy a package with your wallet in **[Seller Reserve API](https://codeauctions.com/?tab=module&mod=reserve)**. Reserve requests and vehicle report credits are separate.
- Packages use verified wallet top-ups from the active payment environment. Promotional credits are not eligible.
- Batch availability is currently free. Live batch checks require an active LIVE key with `reserve:read`, a purchased Reserve package and requests remaining in this module. The key's IP allow list must permit the request. A wallet deposit alone does not enable them; checks stop when the request balance reaches zero.

**Sandbox checkout:** when PayPal Sandbox is enabled, verified Sandbox top-ups can buy request packages and exercise the full Batch and LOT DETAIL flow, including the same request consumption and limits as Live checkout. **Seller Reserve balances are separate in Sandbox and Live checkout.** The module and `/reserve/balance` show the balance for the active payment environment; switching to Live checkout requires a separately funded Live balance.

PayPal Sandbox is different from a `rep_test_` API key. The complete checkout workflow uses an active `rep_live_` key with the required permissions; a `rep_test_` key always serves the limited fixtures below and consumes no requests. The API endpoints and parameters are the same for Sandbox and Live checkout. The response `mode` field describes the API key mode (`live` or `test`).

## Connect

Base URL: `https://reports.codeauctions.com/v1`. Append the paths below once; do not repeat `/v1`.

Create a key in **[Keys](https://codeauctions.com/?tab=keys)** with `reserve:read` and `reserve:write`. Use `rep_test_` during development and an active `rep_live_` key for real results. Existing keys need the required scopes, and any IP allow list must permit the request. Test and revoked keys cannot enable live access.

Send `Authorization: Bearer <API_KEY>` and `Content-Type: application/json` for POST requests. Keep the key in a server environment variable. Your website or extension must call your own authenticated backend; never embed a live key in browser code, an extension, URLs or analytics.

## Which lot identifier to send

Use the **same auction and visible lot identifier** for Batch and LOT DETAIL. Send the identifier as a numeric string of 1–12 digits; keep any leading zeros. Do not send a VIN, a full URL or a URL-derived identifier.

| Auction | Batch: each entry in `lots` | LOT DETAIL: `lot` |
|---|---|---|
| `copart` | The **Lot Number** shown on the results card or vehicle detail | The same **Lot Number** |
| `iaai` | The **Stock # / Stock Number** shown on the results card or vehicle detail | The same **Stock # / Stock Number** |

**IAAI has two different numbers.** The number in an IAAI `/VehicleDetail/{id}` URL is not the Stock Number. When the URL and the vehicle information differ, read **Stock #** from the card or detail and use that Stock Number for both API operations. Do not extract the URL number or try to substitute a VIN. If your application only has an IAAI URL, obtain its displayed Stock Number before making either request.

Illustration only: a vehicle displays **Stock # 12345678** while its URL ends in `/VehicleDetail/98765432`. Both requests below use `12345678`; neither uses `98765432`. These numbers illustrate the distinction and do not identify a verified live vehicle.

```json
{"auction":"iaai","lots":["12345678"]}
```

```json
{"auction":"iaai","lot":"12345678"}
```

The first body is for `/reserve/availability`; the second is for `/reserve/reveal` and also requires an `Idempotency-Key` header. Keep the auction alongside each identifier in your application: the same digits on Copart and IAAI are different identities. Batch a maximum of **50 lots from one auction per call**; split larger lists and send separate calls for Copart and IAAI. VIN lookup is not supported by either endpoint.

## Endpoints

| Method and path | Scope | Request | Response inside `data` |
|---|---|---|---|
| `POST /reserve/availability` | `reserve:read` | `auction`: `copart` or `iaai`; `lots`: 1–50 Copart Lot Number or IAAI Stock Number strings from that auction | `auction`, `lots`: array of `{lot,has_reserve}` |
| `POST /reserve/reveal` | `reserve:write` | `auction`: `copart` or `iaai`; `lot`: Copart Lot Number or IAAI Stock Number string | `auction`, `lot`, `revealed`, `reserve_price`, `currency` |
| `GET /reserve/balance` | `reserve:read` | None | `requests_remaining`, `unrevealed_in_cycle`, `batch_enabled`, `min_topup_usd`, `price_per_reveal_usd`, `pricing_model`, `packages` |

Availability returns `has_reserve: true`, `false` or `null`: show **Seller reserve**, **No reserve**, or **Availability unknown**, respectively. Batch responses never contain an amount. An unknown result is not a confirmed absence of reserve.

Reveal returns `revealed:true`, `reserve_price:"4500.00"`, `currency:"USD"` when a price is delivered. Otherwise `revealed:false` and `reserve_price:null`; show **Price unavailable**. A reserve is not a guaranteed winning bid or final purchase price.

Responses use `{data,billing,mode,request_id}`; errors use `{error:{type,code,message,details},mode,request_id}`. Treat price strings as decimal USD values. For a live reveal, `billing.credits_used` is the number of prepaid requests consumed (0 or 1), and `billing.amount_usd:"0.00"` means no additional wallet debit: the package was already paid for. A zero monetary amount does not mean no requests were consumed. Refresh `/reserve/balance` when updating your customer's allowance.

Balance returns `pricing_model:"prepaid_requests"`. `packages` contains the current catalog as `{slug,name,price_usd,requests,unit_price_usd}`; `price_usd` is the total package price and `unit_price_usd` is its nominal request rate. Read these values to display current purchase options, then link to the module to buy. `min_topup_usd` is the cheapest package price. The compatibility field `price_per_reveal_usd` is the nominal **base rate** (currently $0.30), not the rate of your previously purchased requests or a per-call debit. Balances can include requests from different packages.

## Try the Live example with your account

Open **[Live example](https://codeauctions.com/?tab=module&mod=reserve&view=example)** inside Seller Reserve API. It uses your signed-in account and your real Seller Reserve request balance for the active payment environment; it is not the free sample-key environment. **Both modes require an active LIVE key on your account, an eligible paid package and a positive request balance.** Create the key in **[Keys](https://codeauctions.com/?tab=keys)** before running an example. The dashboard selects an eligible existing key and attributes usage to it; you do not paste a secret into this tab, and it does not create a key for you.

Batch requires `reserve:read`; LOT DETAIL requires `reserve:write`. The selected key's IP allow list must permit your current dashboard request. A key limited to your backend's IP may not allow access from your browser's network. Review the restrictions in Keys or use another eligible LIVE key. Test keys, revoked keys and keys from another account cannot enable either mode. You can still read documentation and buy a package before creating a key.

- **Batch:** choose Copart or IAAI and paste up to 50 identifiers from that auction. Use Copart Lot Numbers or IAAI Stock Numbers as described above. Run the check to see an availability badge per lot; no reserve amount is shown. Batch currently consumes **0 requests**, but your account must have an eligible active LIVE key with `reserve:read`, have bought an eligible paid package and have requests remaining. The example shows Batch as enabled only when all requirements are met.
- **LOT DETAIL:** choose the auction and enter one matching identifier. Press **See reserve price** to make an intentional live lookup. A revealed price consumes **1 request**; each group of **10 completed unrevealed lookups** consumes 1 request. Technical errors and rejected operations do not consume requests or advance that counter. The same allowance and rate limits apply to the dashboard and your API integration.

An idempotent retry returns the original result without a second request debit. It can still report the original operation's `billing.credits_used`; do not add that usage again. To explore without using your balance, use the separate limited test key and its fixed sample lots documented below.

## One results-page to lot-detail example

Keep `CODEAUCTIONS_KEY` on your server. This sequence shows the three operations; make the reveal call only after an explicit customer action.

```bash
curl -s 'https://reports.codeauctions.com/v1/reserve/availability' \
  -H "Authorization: Bearer $CODEAUCTIONS_KEY" \
  -H 'Content-Type: application/json' \
  -d '{"auction":"copart","lots":["12345678","87654321"]}'

curl -s 'https://reports.codeauctions.com/v1/reserve/reveal' \
  -H "Authorization: Bearer $CODEAUCTIONS_KEY" \
  -H 'Content-Type: application/json' \
  -H 'Idempotency-Key: reserve-purchase-0001' \
  -d '{"auction":"copart","lot":"12345678"}'

curl -s 'https://reports.codeauctions.com/v1/reserve/balance' \
  -H "Authorization: Bearer $CODEAUCTIONS_KEY"
```

For a results page, batch only the visible lots and display badges. Store `{auction,lot}` with each card; for IAAI, `lot` is the displayed Stock Number. When the user opens the detail, carry that exact pair into the **See reserve price** action. Prevent double-clicks and display the amount only when `revealed` is true. Do not automatically reveal every search result or replace an IAAI Stock Number with its detail URL number. Store delivered results in your application so a page refresh can display a previously purchased result.

## Limits and retries

Live limits are shared by all keys on an account: **6 batch calls/minute**, at most **50 lots/call**; **10 reveal calls/minute**, at most **2 concurrent reveals**. Apply your own per-user limits and spending controls. General API limits also apply.

Reveal requires `Idempotency-Key`, unique per intentional purchase. Persist it with the auction and lot before sending. Retry an interrupted operation with the **same path, body and key**. Never reuse a purchase identifier for a different operation. A deliberate new lookup needs a new key. Set a timeout of at least 75 seconds; avoid overlapping retries.

| Code | HTTP | Action |
|---|---|---|
| `no_api_key` | 401 | For the Live example, create an active LIVE key in Keys. For the public API, send your API key in the Authorization header. |
| `insufficient_scope` | 403 | Use an active LIVE key with `reserve:read` for Batch or `reserve:write` for LOT DETAIL. |
| `ip_not_allowed` | 403 | Review the key's IP allow list; it must permit the address making the request. |
| `reserve_funding_required` | 402 | Buy a Reserve request package with eligible paid wallet funds, starting at $100.00. |
| `reserve_no_credits` | 402 | Add Reserve requests before retrying. |
| `reserve_busy` | 409 | Wait for your active operation to finish. |
| `rate_limited` | 429 | Wait for `Retry-After`. |
| `reserve_unavailable` | 503 | Retry with bounded backoff and the same idempotency key. |
| `invalid_parameter` | 400 | Correct the auction, lot identifiers or batch size. |
| `missing_parameter` | 400 | Include each required field. |
| `idempotency_reused` | 400 | A key was reused for a different operation. Restore the original request or use a new key for an intentional new purchase. |
| `in_progress` | 409 | An operation with this key is still running. Wait and retry the same operation. |

For `401` or `403`, correct authentication or scopes. After funding or waiting, retry the original operation with the same path, body and idempotency key. If a timeout or temporary failure continues, stop and contact support with `request_id`. Never repeatedly retry an unrevealed result as though it were a technical failure.

## Limited test key

Test mode returns samples, spends no requests, and cannot retrieve real lot prices. Use a maximum of **3 lots per test batch**. Test keys are limited to **2 calls/minute per IP**, **20 calls/day per IP**, and **60 calls/day per account**. The public demo shares one account and its daily quota across all visitors.

Sample lots: `12345678` demonstrates an available reserve and a revealed price of $4,500.00; `87654321` demonstrates no reserve; `11111111` demonstrates unknown availability and an unrevealed result. Other lot identifiers are rejected in test mode. Test balance values are illustrative and cannot enable live access. Use the sample key shown in this module, or create your own test key in Keys.
