> ## Documentation Index
> Fetch the complete documentation index at: https://docs.autosnap.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Setting Up a Dealership

> The three-endpoint workflow for onboarding a new dealership: resolve, setup, and poll for status.

Onboarding a dealership takes three calls: check that the site is supported with [Resolve Dealership](/api-reference/endpoints/resolve-dealer), start the setup with [Setup Dealership](/api-reference/endpoints/setup-dealer), then poll [Get Setup Status](/api-reference/endpoints/get-setup-status) until inventory is ready.

## Step 1 — Resolve the dealership

Before setting anything up, ask the resolve endpoint whether the site is supported and whether it already exists on your account. This call is fast and free of side effects — nothing is created.

```bash theme={null}
curl -X POST "https://api.autosnap.com/v1/dealers/resolve" \
  -H "Content-Type: application/json" \
  -d '{
    "api_key": "YOUR_API_KEY",
    "dealership_url": "https://www.carlblackroswell.com"
  }'
```

```json theme={null}
{
  "success": true,
  "website_url": "carlblackroswell.com",
  "dealership": {
    "name": "Carl Black Buick Gmc",
    "website": "carlblackroswell.com",
    "city": "Roswell",
    "state": "Georgia"
  },
  "supported": true,
  "setup_required": false,
  "resolution": { "method": "url", "confidence": 1.0 }
}
```

The two fields that decide your next move:

| `supported` | `setup_required` | What it means                               | What to do                         |
| ----------- | ---------------- | ------------------------------------------- | ---------------------------------- |
| `true`      | `true`           | Supported platform, not yet on your account | Proceed to Step 2                  |
| `true`      | `false`          | Already set up                              | Nothing — fetch inventory directly |
| `false`     | —                | Platform not currently supported            | Contact support                    |

You can also resolve by `dealer_name` + `vin`, by `vin` alone, or by `dealer_name` + `dealer_address` — see the [endpoint reference](/api-reference/endpoints/resolve-dealer) for the full matrix and how ambiguous matches (`LOW_CONFIDENCE_MATCH`, `DEALER_GROUP_DETECTED`) are reported.

## Step 2 — Start the setup

Setup is asynchronous: the call returns **HTTP 202** with a `setup_id` in well under a second, and detection plus configuration run in the background.

```bash theme={null}
curl -X POST "https://api.autosnap.com/v1/dealers/setup" \
  -H "Content-Type: application/json" \
  -d '{
    "api_key": "YOUR_API_KEY",
    "dealership_url": "https://www.carlblackroswell.com"
  }'
```

```json theme={null}
{
  "success": true,
  "setup_id": "setup_6420ad759b71",
  "status": "pending",
  "message": "Setup job created. Poll GET /v1/dealers/setup/{setup_id} for status, or wait for the setup.complete webhook.",
  "poll_url": "/v1/dealers/setup/setup_6420ad759b71"
}
```

<Note>
  If the dealership was previously deleted from your account, the same call **reactivates** the existing subscription instead — that path returns HTTP 200 with the completed result inline, and there is nothing to poll.
</Note>

## Step 3 — Poll for status

Poll the status endpoint with your `setup_id` every **5 seconds** until it resolves:

```bash theme={null}
curl "https://api.autosnap.com/v1/dealers/setup/setup_6420ad759b71?api_key=YOUR_API_KEY"
```

Two fields matter, in sequence:

1. **`status`** — the setup lifecycle: `pending` → `running` → `completed` (or `failed`, with an `error` field explaining why).
2. **`inventory_status`** — `status: "completed"` means the dealership is *configured*, not that vehicles are ready. Keep polling until `inventory_status` is `"available"`, then call [Fetch Inventory](/api-reference/endpoints/fetch-inventory).

```json theme={null}
{
  "success": true,
  "setup_id": "setup_6420ad759b71",
  "status": "completed",
  "inventory_status": "available"
}
```

Prefer push over polling? Subscribe to the `setup.complete` and `import.complete` [webhook events](/guides/handling-webhooks) before calling setup — `import.complete` fires the moment the first inventory import lands.

## How long does setup take?

Setup time is dominated by provider detection — fetching the dealer's site, identifying the platform, and validating the configuration. Typical times by platform, from recent production setups:

| Provider             | Typical setup time    |
| -------------------- | --------------------- |
| DealerInspire        | under 1 minute        |
| DealerOn             | \~1 minute            |
| Dealer.com           | 1–2 minutes           |
| TeamVelocity         | \~2 minutes           |
| CarsCommerce         | \~3 minutes           |
| DEP (DealerEProcess) | 3–8 minutes           |
| All other providers  | typically 1–3 minutes |

Heavily bot-protected sites can take up to **\~10 minutes** regardless of platform — that's the upper bound before a setup fails with a timeout. These numbers are averages, not guarantees; always drive your client off `status` and `inventory_status`, never a fixed wait.

## The whole flow in one script

```python theme={null}
import time, requests

API = "https://api.autosnap.com/v1"
KEY = "YOUR_API_KEY"
URL = "https://www.carlblackroswell.com"

# 1. Resolve
r = requests.post(f"{API}/dealers/resolve",
                  json={"api_key": KEY, "dealership_url": URL}).json()
if not r.get("supported"):
    raise SystemExit("Platform not supported — contact support")
if not r.get("setup_required"):
    raise SystemExit("Already set up — fetch inventory directly")

# 2. Setup
setup = requests.post(f"{API}/dealers/setup",
                      json={"api_key": KEY, "dealership_url": URL}).json()
setup_id = setup["setup_id"]

# 3. Poll until inventory is ready
while True:
    s = requests.get(f"{API}/dealers/setup/{setup_id}",
                     params={"api_key": KEY}).json()
    if s["status"] == "failed":
        raise SystemExit(f"Setup failed: {s.get('error')}")
    if s.get("inventory_status") == "available":
        print("Inventory ready — call POST /v1/inventory/fetch")
        break
    time.sleep(5)
```
