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

# Fetch IMS Inventory

> Retrieve paginated vehicle inventory from IMS feed data for a dealership.

`GET /v1/ims/vehicles`

Returns active vehicles from IMS feed imports for a dealership. Supports filtering by condition, make, model, and year range. Paginated.

## Parameters

| Name            | Type    | In    | Required | Default   | Description                                                                                                                                       |
| --------------- | ------- | ----- | -------- | --------- | ------------------------------------------------------------------------------------------------------------------------------------------------- |
| `api_key`       | string  | query | Yes      | --        | Your API key                                                                                                                                      |
| `dealership_id` | string  | query | Yes      | --        | Dealership public ID (e.g., `dlr_8cfc0b00a98b`)                                                                                                   |
| `condition`     | string  | query | No       | --        | Filter by condition: `New`, `Used`, or `Certified`                                                                                                |
| `make`          | string  | query | No       | --        | Filter by make (case-insensitive)                                                                                                                 |
| `model`         | string  | query | No       | --        | Filter by model (case-insensitive)                                                                                                                |
| `year_min`      | integer | query | No       | --        | Minimum model year                                                                                                                                |
| `year_max`      | integer | query | No       | --        | Maximum model year                                                                                                                                |
| `page`          | integer | query | No       | `1`       | Page number (1-indexed)                                                                                                                           |
| `per_page`      | integer | query | No       | `100`     | Results per page (max 500)                                                                                                                        |
| `format`        | string  | query | No       | `default` | Response format: `default` (IMS native fields) or `normalized` (maps to same field names as website vehicle data from `POST /v1/inventory/fetch`) |

## Example

```bash theme={null}
curl "https://api.autosnap.com/v1/ims/vehicles?api_key=YOUR_API_KEY&dealership_id=dlr_8cfc0b00a98b&condition=Used&per_page=50"
```

## Response

```json theme={null}
{
  "vehicles": [
    {
      "id": 42,
      "vin": "1GCHSCEA7L1214921",
      "stock_number": "M1382",
      "condition": "Used",
      "certified": false,
      "year": 2020,
      "make": "Chevrolet",
      "model": "Colorado 2WD",
      "trim": "Ext Cab LT",
      "body": null,
      "doors": null,
      "exterior_color": "WHITE",
      "interior_color": "BLACK",
      "odometer": 41899,
      "engine": null,
      "engine_cylinders": null,
      "transmission": "Automatic",
      "drivetrain": "2WD",
      "fuel_type": null,
      "city_mpg": 0,
      "highway_mpg": 0,
      "msrp": 0.0,
      "price": 0.0,
      "internet_price": 18999.0,
      "invoice": null,
      "book_value": null,
      "model_number": null,
      "description": "Carfax vehicle history report available...",
      "features": "2WD|ABS (4-Wheel)|AM/FM/HD Radio|...",
      "photo_urls": "https://imageserver.promaxinventory.com/...|https://...",
      "vdp_url": "https://www.preownedplus.com/VehicleDetails/...",
      "inventory_date": "2025-09-09",
      "days_in_stock": null,
      "series_detail": null,
      "video_url": null,
      "cab_type": null,
      "carfax_one_owner": null,
      "certification_program": null,
      "created_at": "2026-04-14T06:15:00+00:00",
      "updated_at": "2026-04-14T06:15:00+00:00"
    }
  ],
  "pagination": {
    "page": 1,
    "per_page": 50,
    "total": 87,
    "total_pages": 2
  }
}
```

<Note>
  Photo URLs and features are stored as pipe-delimited (`|`) strings. Split on `|` to get individual items.
</Note>

## Normalized Format

Use `format=normalized` to get the same field names as website-scraped vehicles from `POST /v1/inventory/fetch`. This lets you process both data sources with the same code.

<Warning>
  When using `format=normalized`, the field names match the website inventory schema. However, some fields have different data types:

  * `photo_url_list`: A pipe-delimited string of URLs (e.g., `"https://img1.jpg|https://img2.jpg"`) rather than the JSON array of objects returned by the website fetch endpoint.
  * `features`: A pipe-delimited string (e.g., `"AWD|Leather|Sunroof"`) rather than a JSON array.

  Parse these fields by splitting on the `|` character.
</Warning>

```bash theme={null}
curl "https://api.autosnap.com/v1/ims/vehicles?api_key=YOUR_API_KEY&dealership_id=dlr_8cfc0b00a98b&format=normalized&per_page=1"
```

```json theme={null}
{
  "vehicles": [
    {
      "id": 42,
      "vin": "1GCHSCEA7L1214921",
      "stocknum": "M1382",
      "condition": "Used",
      "certified": false,
      "year": 2020,
      "make": "Chevrolet",
      "model": "Colorado 2WD",
      "series": "Ext Cab LT",
      "body": null,
      "door_count": null,
      "exterior_color": "WHITE",
      "interior_color": "BLACK",
      "odometer": 41899,
      "engine": null,
      "engine_cyl_count": null,
      "engine_displacement": null,
      "transmission": "Automatic",
      "drivetrain_desc": "2WD",
      "fuel": null,
      "city_mpg": 0,
      "hwy_mpg": 0,
      "msrp": 0.0,
      "price": 0.0,
      "internet_price": 18999.0,
      "invoice_price": null,
      "book_value": null,
      "model_num": null,
      "vdp_link": "https://www.preownedplus.com/VehicleDetails/...",
      "photo_url_list": "https://imageserver...|https://...",
      "inventory_date": "2025-09-09",
      "age_days": null,
      "first_seen_at": "2026-04-14T06:15:00+00:00",
      "last_seen": "2026-04-14T06:15:00+00:00",
      "source": "ims"
    }
  ],
  "pagination": { "page": 1, "per_page": 1, "total": 87, "total_pages": 87 }
}
```

### Field Mapping (IMS → Normalized)

| IMS Field          | Normalized Field     | Notes                                      |
| ------------------ | -------------------- | ------------------------------------------ |
| `stock_number`     | `stocknum`           |                                            |
| `trim`             | `series`             |                                            |
| `doors`            | `door_count`         |                                            |
| `engine_cylinders` | `engine_cyl_count`   |                                            |
| `drivetrain`       | `drivetrain_desc`    |                                            |
| `fuel_type`        | `fuel`               |                                            |
| `highway_mpg`      | `hwy_mpg`            |                                            |
| `invoice`          | `invoice_price`      |                                            |
| `model_number`     | `model_num`          |                                            |
| `vdp_url`          | `vdp_link`           |                                            |
| `photo_urls`       | `photo_url_list`     |                                            |
| `days_in_stock`    | `age_days`           |                                            |
| `carfax_one_owner` | `carfax_1_owner`     |                                            |
| `series_detail`    | `series_detail`      | Passed through unchanged                   |
| --                 | `carfax_clean_title` | Always `null` (not available in IMS feeds) |
| --                 | `dealership_active`  | Always `true` for active IMS vehicles      |
| --                 | `source`             | Always `"ims"` in normalized format        |

Fields that exist in the website schema but have no IMS equivalent (e.g., `heading`, `price_components`, `in_transit`) are returned as `null`.

## Errors

| Status | Detail                               | Cause                                               |
| ------ | ------------------------------------ | --------------------------------------------------- |
| `403`  | `Not authorized for this dealership` | Your API key doesn't have access to this dealership |
| `404`  | `Dealership not found`               | Invalid dealership\_id                              |


## OpenAPI

````yaml GET /v1/ims/vehicles
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/ims/vehicles:
    get:
      tags:
        - ims
      summary: Fetch IMS Inventory
      description: >-
        List active vehicles from IMS feed imports for a dealership. Supports
        filtering and pagination.
      operationId: list_ims_vehicles
      parameters:
        - name: api_key
          in: query
          required: true
          schema:
            type: string
            title: Api Key
        - name: dealership_id
          in: query
          required: true
          schema:
            type: string
            title: Dealership Id
          description: Public ID (e.g. dlr_xxx) or internal ID
        - name: condition
          in: query
          required: false
          schema:
            type: string
            nullable: true
            title: Condition
          description: 'Filter: New, Used, or Certified'
        - name: make
          in: query
          required: false
          schema:
            type: string
            nullable: true
            title: Make
        - name: model
          in: query
          required: false
          schema:
            type: string
            nullable: true
            title: Model
        - name: year_min
          in: query
          required: false
          schema:
            type: integer
            nullable: true
            title: Year Min
        - name: year_max
          in: query
          required: false
          schema:
            type: integer
            nullable: true
            title: Year Max
        - name: page
          in: query
          required: false
          schema:
            type: integer
            default: 1
            title: Page
        - name: per_page
          in: query
          required: false
          schema:
            type: integer
            default: 100
            title: Per Page
          description: Max 500
        - name: format
          in: query
          required: false
          schema:
            type: string
            enum:
              - default
              - normalized
            default: default
            title: Format
          description: >-
            Response format. "default" returns IMS native fields. "normalized"
            maps fields to match the website vehicle schema (same as POST
            /v1/inventory/fetch).
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema: {}
        '403':
          description: Not authorized for this dealership
        '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

````