# POST /api/v1/inventory/import/preview

> Preview import

- **Tag:** inventory:import
- **Operation ID:** `preview_import_api_v1_inventory_import_preview_post`

## Description

After reviewing the AI analysis, confirm column mappings and sheet selections. Returns a full preview of locations, products, and inventory levels to be created.

## Authentication

Bearer token in `Authorization` header.
Required header: `x-business-id: <business uuid>`.

## Request body

Schema: `PreviewRequest`

- `file_id` (string · required)
- `selected_sheets` (array · string · required)
- `sheet_mappings` (array · SheetMappingConfirmation · required) → `SheetMappingConfirmation`
  - `sheet_name` (string · required)
  - `mapping` (object · required) — Map of standard field name → 0-based column index.
  - `data_start_row` (integer)
  - `exclude_rows` (array · integer)
- `location_decisions` (array · LocationDecision) → `LocationDecision`
  - `detected_name` (string · required)
  - `action` (string) (one of: create, match, skip)
  - `existing_location_id` (string)
  - `location_name` (string)
  - `location_type` (string)

## Responses

### 201 — Successful Response

Schema: `PreviewResponse`

- `file_id` (string · required)
- `to_create` (PreviewToCreate) → `PreviewToCreate`
  - `locations` (array · PreviewLocation) → `PreviewLocation`
  - `products` (array · PreviewProduct) → `PreviewProduct`
- `to_update` (PreviewToUpdate) → `PreviewToUpdate`
  - `inventory_levels` (array · PreviewInventoryLevel) → `PreviewInventoryLevel`
- `summary` (PreviewSummary) → `PreviewSummary`
  - `locations_to_create` (integer)
  - `products_to_create` (integer)
  - `variants_to_create` (integer)
  - `levels_to_set` (integer)
  - `existing_matched` (integer)
  - `skipped_rows` (integer)

### 400 — Bad Request - Invalid input

### 401 — Unauthorized - Authentication required

### 403 — Forbidden - Insufficient permissions

### 422 — Validation Error - Invalid data format

## Code samples

### cURL

```bash
curl -X POST 'https://api.ondayzero.com/api/v1/inventory/import/preview' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "file_id": "string",
  "selected_sheets": [],
  "sheet_mappings": []
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/inventory/import/preview', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "file_id": "string",
  "selected_sheets": [],
  "sheet_mappings": []
}),
});
const data = await response.json();
```

### Python

```python
import httpx

headers = {
    "Authorization": "Bearer dz_your_token",
    "x-business-id": "YOUR_BUSINESS_ID",
}

payload = {
  "file_id": "string",
  "selected_sheets": [],
  "sheet_mappings": []
}

response = httpx.post("https://api.ondayzero.com/api/v1/inventory/import/preview", headers=headers, json=payload)
data = response.json()
```

## See also

- HTML version: https://www.ondayzero.com/docs/reference/inventory-import/preview-import
- OpenAPI slice: https://www.ondayzero.com/docs/reference/inventory-import/preview-import/openapi.json
- Other endpoints in **inventory:import**: https://www.ondayzero.com/docs/reference/inventory-import
