# POST /api/v1/inventory/products/unit-costs/apply

> Apply unit cost bulk update

- **Tag:** inventory:products
- **Operation ID:** `apply_unit_cost_bulk_update_api_v1_inventory_products_unit_costs_apply_post`

## Description

Apply confirmed unit-cost updates from a validated CSV upload.

## Authentication

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

## Request body

Schema: `UnitCostBulkApplyRequest`

- `updates` (array · UnitCostBulkUpdateRowInput · required) → `UnitCostBulkUpdateRowInput` — Rows with new_unit_cost_cents set and validated via preview.
  - `row_number` (integer · required) — 1-based row number from the spreadsheet.
  - `sku` (string · required) — Variant SKU.
  - `variant_id` (string) — Optional variant UUID; when set, used instead of SKU matching.
  - `new_unit_cost_cents` (integer) — New unit cost in cents. Omit or null to skip the row.

## Responses

### 201 — Successful Response

Schema: `UnitCostBulkApplyResponse`

- `updated_count` (integer · required)
- `skipped_count` (integer · required)
- `error_count` (integer · required)
- `errors` (array · string)

### 400 — Bad Request - Invalid input

### 422 — Validation Error - Invalid data format

## Code samples

### cURL

```bash
curl -X POST 'https://api.ondayzero.com/api/v1/inventory/products/unit-costs/apply' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "updates": []
}'
```

### JavaScript

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

### Python

```python
import httpx

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

payload = {
  "updates": []
}

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

## See also

- HTML version: https://www.ondayzero.com/docs/reference/inventory-products/apply-unit-cost-bulk-update
- OpenAPI slice: https://www.ondayzero.com/docs/reference/inventory-products/apply-unit-cost-bulk-update/openapi.json
- Other endpoints in **inventory:products**: https://www.ondayzero.com/docs/reference/inventory-products
