# POST /api/v1/inventory/import/apply

> Apply import

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

## Description

Execute the confirmed import: create locations, products, variants, and set inventory levels. All changes happen in a single transaction.

## Authentication

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

## Request body

Schema: `ApplyRequest`

- `file_id` (string · required)
- `locations` (array · ApplyLocationDecision) → `ApplyLocationDecision`
  - `name` (string · required)
  - `action` (string) (one of: create, match, skip)
  - `existing_location_id` (string)
  - `location_type` (string)
  - `code` (string)
- `products` (array · ApplyProductDecision) → `ApplyProductDecision`
  - `name` (string · required)
  - `category` (string)
  - `action` (string) (one of: create, match, skip)
  - `existing_product_id` (string)
  - `variants` (array · ApplyVariantDecision)
- `levels` (array · ApplyLevelDecision) → `ApplyLevelDecision`
  - `variant_name` (string · required)
  - `variant_id` (string)
  - `location_name` (string)
  - `location_id` (string)
  - `on_hand` (number)
  - `action` (string) (one of: set, skip)

## Responses

### 201 — Successful Response

Schema: `ApplyResponse`

- `success` (boolean)
- `summary` (ApplyResultSummary) → `ApplyResultSummary`
  - `locations_created` (integer)
  - `products_created` (integer)
  - `variants_created` (integer)
  - `levels_set` (integer)
  - `errors` (array · string)

### 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/apply' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "file_id": "string"
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/inventory/import/apply', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "file_id": "string"
}),
});
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"
}

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

## See also

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