# PUT /api/v1/inventory/products/variants/{id}

> Update product variant

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

## Description

Update an existing variant.

## Authentication

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

## Parameters

- `id` (path, string · uuid, required)

## Request body

Schema: `VariantUpdateRequest`

- `id` (string) — Variant UUID (set from URL path).
- `unit_price` (integer) — Sale price in cents (e.g., 2999 = $29.99).
- `name` (string) — Variant name (e.g., 'Large - Blue').
- `sku` (string) — Stock Keeping Unit for inventory tracking.
- `manufacturer_sku` (string) — Manufacturer's SKU for ordering from suppliers.
- `unit_cost` (integer) — Cost price in cents for margin calculations.
- `unit_cost_precise` (number) — Precise unit cost in dollars with sub-cent precision (e.g. 0.0478).
- `uom` (string) — Unit of measure: EA, LB, G, KG, OZ, L, ML, etc.
- `default_vendor_id` (string) — UUID of the preferred vendor for this variant.
- `archived` (boolean) — Set to true to archive (hide) the variant.
- `initial_inventory_quantity` (integer) — Set initial inventory count (use when first setting up).
- `initial_inventory_quantity_date` (string · date-time) — Date for the initial inventory count (ISO 8601).

## Responses

### 200 — Successful Response

Schema: `VariantResponse`

- `id` (string · required) — Variant UUID.
- `product_id` (string · required) — Parent product UUID.
- `business_id` (string · required) — Business UUID.
- `created_at` (string · date-time · required) — Creation timestamp.
- `updated_at` (string · date-time · required) — Last update timestamp.
- `name` (string · required) — Variant name.
- `sku` (string) — Stock Keeping Unit.
- `manufacturer_sku` (string) — Manufacturer's SKU.
- `archived` (boolean) — Whether variant is archived.
- `price` (number) — Unit price in dollars (legacy field, prefer unit_price).
- `cost` (number) — Unit cost in dollars (legacy field, prefer unit_cost).
- `inventory_quantity` (integer) — Current inventory quantity (legacy, prefer inventory.on_hand).
- `shopify_variant_id` (string) — Shopify variant ID if synced from Shopify.
- `stripe_price_id` (string) — Stripe price ID if synced to Stripe.
- `stripe_product_id` (string) — Stripe product ID if synced to Stripe.
- `unit_price` (integer) — Sale price in cents.
- `unit_cost` (integer) — Cost price in cents.
- `unit_cost_precise` (number) — Precise unit cost in dollars with sub-cent precision.
- `uom` (string) — Unit of measure: EA, LB, G, KG, OZ, etc.
- `default_vendor_id` (string) — Preferred vendor UUID.
- `inventory` (InventorySummary) — Detailed inventory breakdown.
- `product_name` (string) — Parent product name (resolved).
- `margin_cents` (integer · required) — Profit margin in cents (unit_price - unit_cost).
- `margin_percentage` (number · required) — Profit margin as percentage of sale price.

### 400 — Bad request - invalid data

### 404 — Business or variant not found

### 422 — Validation error

## Code samples

### cURL

```bash
curl -X PUT 'https://api.ondayzero.com/api/v1/inventory/products/variants/{id}' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "id": "string",
  "unit_price": 0,
  "name": "string",
  "sku": "string",
  "manufacturer_sku": "string",
  "unit_cost": 0
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/inventory/products/variants/{id}', {
  method: 'PUT',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "id": "string",
  "unit_price": 0,
  "name": "string",
  "sku": "string",
  "manufacturer_sku": "string",
  "unit_cost": 0
}),
});
const data = await response.json();
```

### Python

```python
import httpx

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

payload = {
  "id": "string",
  "unit_price": 0,
  "name": "string",
  "sku": "string",
  "manufacturer_sku": "string",
  "unit_cost": 0
}

response = httpx.put("https://api.ondayzero.com/api/v1/inventory/products/variants/{id}", headers=headers, json=payload)
data = response.json()
```

## See also

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