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

# Inventory Field Mapping

> Map source inventory fields to Better Data inventory fields.

## Overview

Inventory import sets on-hand and reserved quantities for SKU/location pairs.
The endpoint also creates missing product and location records when needed.

## Quick Start

1. Build a `levels[]` payload with one row per SKU/location.
2. POST to `/api/import/inventory`.
3. Poll `/api/import/status/[jobId]` for processed and failed counts.

## Field Reference

| Better Data Field  | Type   | Required | Example   | Description                              | Source System Analog    |
| ------------------ | ------ | -------- | --------- | ---------------------------------------- | ----------------------- |
| `skuId`            | string | YES      | `SKU-001` | SKU key tied to catalog import.          | Item code / variant SKU |
| `locationId`       | string | YES      | `DC-WEST` | External location code.                  | Warehouse / plant code  |
| `quantityOnHand`   | number | No       | `120`     | Physical stock quantity, default `0`.    | QOH                     |
| `quantityReserved` | number | No       | `20`      | Reserved stock quantity, default `0`.    | Allocated quantity      |
| `reorderPoint`     | number | No       | `40`      | Minimum quantity threshold, default `0`. | Reorder point           |

## Validation Rules

* `levels[]` must be present and non-empty.
* Each row requires `skuId` and `locationId`.
* `qtyAvailable` is computed as `quantityOnHand - quantityReserved`.

## Common Errors

| Error                           | Meaning                            | How to fix                         |
| ------------------------------- | ---------------------------------- | ---------------------------------- |
| `levels[] is required`          | Missing inventory rows.            | Send `{ "levels": [ ... ] }`.      |
| `skuId and locationId required` | A row is missing one or both keys. | Provide both fields for every row. |
