> ## 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.

# Get Setup Status

> Poll the status of an async dealer setup job.

`GET /v1/dealers/setup/{setup_id}`

<Note>
  **v1.0 schema lock.** The response shape on this page is the locked v1.0 contract. We will never remove a documented field, never rename a field, and never change a field's type without bumping to v2 (see [Versioning](/get-started/versioning)). The response shape varies by `status`: `pending` and `running` responses are subsets of the `completed` response; `failed` responses include an additional `error` field.
</Note>

Poll the status of a dealer setup job created by [Setup Dealership](/api-reference/endpoints/setup-dealer). Setup is async-only: every setup request returns a `setup_id`, and this endpoint is how you retrieve the result. Recommended polling interval: **5 seconds**.

## Parameters

| Name       | Type   | In    | Required | Description                                                              |
| ---------- | ------ | ----- | -------- | ------------------------------------------------------------------------ |
| `setup_id` | string | path  | Yes      | The setup ID returned by the setup endpoint (e.g., `setup_6420ad759b71`) |
| `api_key`  | string | query | Yes      | Your API key                                                             |

## Status Values

### `status` — Setup Lifecycle

| Status      | Description                                                                                        |
| ----------- | -------------------------------------------------------------------------------------------------- |
| `pending`   | Job created, not yet started                                                                       |
| `running`   | Detection and configuration in progress — the response includes an `elapsed_seconds` progress hint |
| `completed` | Detection finished, config created, first import triggered                                         |
| `failed`    | Setup failed — check the `error` field                                                             |

### `inventory_status` — Inventory Availability

This field tells you whether inventory data is ready to fetch. It is `null` until setup completes, then progresses through these states:

| Status      | Description                                    | Action                                                  |
| ----------- | ---------------------------------------------- | ------------------------------------------------------- |
| `null`      | Setup still in progress                        | Keep polling                                            |
| `importing` | Setup complete, first inventory import running | Keep polling, or subscribe to `import.complete` webhook |
| `available` | First import finished — inventory is ready     | Call `POST /v1/inventory/fetch`                         |
| `failed`    | First import failed                            | Contact support or retry setup                          |

<Note>
  **When is inventory ready?** `status: "completed"` means the dealership is configured, NOT that inventory is available. You must wait for `inventory_status: "available"` before calling the fetch endpoint.

  For real-time notification instead of polling, subscribe to the `import.complete` webhook event — it fires as soon as the first inventory import finishes.
</Note>

## Example

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

## Response — Pending / Running

While the job is in flight, the response carries the lifecycle status and timestamps. When `status` is `"running"`, an `elapsed_seconds` field reports how long detection has been running — typical jobs finish in 60 seconds; heavily bot-protected sites can take up to \~10 minutes.

```json theme={null}
{
  "success": true,
  "setup_id": "setup_6420ad759b71",
  "status": "running",
  "inventory_status": null,
  "dealership_url": "friendshipford.com",
  "created_at": "2026-04-09T12:00:00+00:00",
  "started_at": "2026-04-09T12:00:01+00:00",
  "completed_at": null,
  "elapsed_seconds": 42.5
}
```

## Response — Setup Complete, Importing

```json theme={null}
{
  "success": true,
  "setup_id": "setup_6420ad759b71",
  "status": "completed",
  "inventory_status": "importing",
  "dealership_url": "friendshipford.com",
  "created_at": "2026-04-09T12:00:00+00:00",
  "started_at": "2026-04-09T12:00:01+00:00",
  "completed_at": "2026-04-09T12:01:30+00:00",
  "provider": "CarsCommerce",
  "provider_confidence": 0.92,
  "dealership_id": "dlr_abc123",
  "configuration_id": 15,
  "subscription_id": 42,
  "config": {
    "base_url": "https://www.friendshipford.com",
    "inventory_type": "all",
    "site_id": "friendshipford"
  },
  "vehicle_counts": {
    "new": 150,
    "used": 200,
    "total": 350
  }
}
```

## Response — Inventory Available

```json theme={null}
{
  "success": true,
  "setup_id": "setup_6420ad759b71",
  "status": "completed",
  "inventory_status": "available",
  "dealership_url": "friendshipford.com",
  "created_at": "2026-04-09T12:00:00+00:00",
  "started_at": "2026-04-09T12:00:01+00:00",
  "completed_at": "2026-04-09T12:01:30+00:00",
  "provider": "CarsCommerce",
  "provider_confidence": 0.92,
  "dealership_id": "dlr_abc123",
  "configuration_id": 15,
  "subscription_id": 42
}
```

## Response — Failed

```json theme={null}
{
  "success": true,
  "setup_id": "setup_6420ad759b71",
  "status": "failed",
  "inventory_status": null,
  "dealership_url": "example.com",
  "error": "Could not detect website provider"
}
```

## Recommended Integration Pattern

```
1. POST /v1/dealers/setup
   → HTTP 202 + setup_id

2. Subscribe to webhooks: setup.complete, import.complete
   (Do this BEFORE setup, so you don't miss events)

3. Poll GET /v1/dealers/setup/{setup_id} every 5s
   → Wait for status: "completed"
   → Then wait for inventory_status: "available"

4. OR: Wait for import.complete webhook
   → Then call POST /v1/inventory/fetch
```

## Completed Response Fields

| Field              | Type           | Description                                                                                                                                            |
| ------------------ | -------------- | ------------------------------------------------------------------------------------------------------------------------------------------------------ |
| `setup_id`         | string         | Public setup ID (e.g., `setup_6420ad759b71`)                                                                                                           |
| `status`           | string         | Setup lifecycle status: `pending`, `running`, `completed`, `failed`                                                                                    |
| `inventory_status` | string \| null | Inventory availability: `null`, `importing`, `available`, `failed`                                                                                     |
| `config`           | object         | The detected provider configuration (base URL, inventory type, site ID, etc.)                                                                          |
| `vehicle_counts`   | object \| null | Vehicle count breakdown from detection (e.g., `{"new": 150, "used": 200, "total": 350}`). May be `null` if counts were not available during detection. |
| `dealership_id`    | string         | Public dealership ID (e.g., `dlr_abc123`)                                                                                                              |
| `configuration_id` | integer        | Internal configuration ID                                                                                                                              |
| `subscription_id`  | integer        | Internal subscription ID                                                                                                                               |

## Errors

| Status | Description                                  |
| ------ | -------------------------------------------- |
| 404    | Setup job not found for the given `setup_id` |


## OpenAPI

````yaml GET /v1/dealers/setup/{setup_id}
openapi: 3.0.3
info:
  title: AutosnapAI Origin API
  description: Dealer resolution, inventory management, and webhook APIs
  version: 1.0.0
servers:
  - url: https://api.autosnap.com
    description: Production
security: []
paths:
  /v1/dealers/setup/{setup_id}:
    get:
      tags:
        - origin
      summary: Get Setup Status
      description: Poll the status of an async setup job.
      operationId: get_setup_status_v1_dealers_setup__setup_id__get
      parameters:
        - name: setup_id
          in: path
          required: true
          schema:
            type: integer
            title: Setup Id
        - name: api_key
          in: query
          required: true
          schema:
            type: string
            title: Api Key
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
        input:
          title: Input
        ctx:
          type: object
          title: Context
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError

````