# POST /api/v1/inventory/products/variants

> Create product variant

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

## Description

Create a new product variant. When the business has Stripe connected, the variant is mirrored to Stripe Catalog (Product + Price); otherwise the variant is created locally with empty Stripe IDs and can be synced later.

## Authentication

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

## Request body

Schema: `VariantCreateRequest`

- `product_id` (string) — UUID of the parent product this variant belongs to.
- `unit_price` (integer) — Sale price in cents (e.g., 2999 = $29.99).
- `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 for $0.0478/gram).
- `name` (string) — Variant name (e.g., 'Large - Blue').
- `sku` (string) — Stock Keeping Unit - unique identifier for inventory.
- `manufacturer_sku` (string) — Manufacturer's SKU for supplier ordering.
- `barcode` (string) — Scannable barcode (UPC/EAN/QR). Distinct from SKU.
- `uom` (string) — Unit of measure: EA, LB, G, KG, OZ, L, ML, etc.
- `purchase_uom` (string) — Unit bought in (e.g. CASE); receipts in it convert to uom
- `purchase_uom_factor` (number | string) — Stock units per purchase unit (12 for a case of 12)
- `inventory_category` (string) — Which inventory ledger this item's cost sits in: raw_material, packaging or finished_good. Production runs and counts post by it.
- `default_vendor_id` (string) — UUID of the preferred vendor for this variant.
- `tax_code_id` (string) — UUID of the tax code that decides whether this variant is charged sales tax on invoices. Omit for the default: taxable.
- `initial_inventory_quantity` (integer) — Starting inventory quantity.
- `initial_inventory_quantity_date` (string · date-time) — Date for the initial inventory count (ISO 8601).

## Example request

```json
{
  "initial_inventory_quantity": 50,
  "name": "Large - Blue",
  "product_id": "019ab37c-9a0d-7000-8000-000000000001",
  "sku": "WIDGET-PRO-LG-BLU",
  "unit_cost": 1200,
  "unit_price": 2999
}
```

## Responses

### 201 — Variant created successfully

Schema: `SuccessEnvelope_VariantResponse_`

- `success` (boolean)
- `message` (string)
- `code` (string)
- `data` (VariantResponse)

### 400 — Bad request - invalid data

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 401 — Unauthorized - Missing or expired token, an MCP OAuth token used against the REST API, or no access to this business

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 403 — Forbidden - Insufficient permissions

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 404 — Business or product not found

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 409 — Variant with same SKU already exists

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

### 422 — Validation error

Schema: `ErrorResponse`

- `error` (string · required) — Error category: `validation_error`, `unauthorized`, `forbidden`, `not_found`, `conflict`, `rate_limited`, `server_error`, or `service_unavailable`.
- `message` (string · required) — Human-readable explanation, safe to show to end users.
- `code` (string · required) — Stable machine-readable code in `CATEGORY_NNN` form (e.g. `NOT_FOUND_006`, `AUTH_010`, `GEN_002`).
- `request_id` (string) — Correlation id for support requests. Echoes the `x-request-id` request header when one was supplied.
- `errors` (object) — Field-level validation messages keyed by field name. Present on 400/422 validation failures only.

## Code samples

### cURL

```bash
curl -X POST 'https://api.ondayzero.com/api/v1/inventory/products/variants' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "initial_inventory_quantity": 50,
  "name": "Large - Blue",
  "product_id": "019ab37c-9a0d-7000-8000-000000000001",
  "sku": "WIDGET-PRO-LG-BLU",
  "unit_cost": 1200,
  "unit_price": 2999
}'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/inventory/products/variants', {
  method: 'POST',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
    'Content-Type': 'application/json',
  },
  body: JSON.stringify({
  "initial_inventory_quantity": 50,
  "name": "Large - Blue",
  "product_id": "019ab37c-9a0d-7000-8000-000000000001",
  "sku": "WIDGET-PRO-LG-BLU",
  "unit_cost": 1200,
  "unit_price": 2999
}),
});
const data = await response.json();
```

### Python

```python
import httpx

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

payload = {'initial_inventory_quantity': 50,
 'name': 'Large - Blue',
 'product_id': '019ab37c-9a0d-7000-8000-000000000001',
 'sku': 'WIDGET-PRO-LG-BLU',
 'unit_cost': 1200,
 'unit_price': 2999}

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

## See also

- HTML version: https://www.ondayzero.com/docs/reference/inventory-products/create-variant
- OpenAPI slice: https://www.ondayzero.com/docs/reference/inventory-products/create-variant/openapi.json
- Other endpoints in **inventory:products**: https://www.ondayzero.com/docs/reference/inventory-products (markdown bundle: https://www.ondayzero.com/docs/reference/inventory-products.md, OpenAPI: https://www.ondayzero.com/docs/reference/inventory-products/openapi.json)
- Endpoint catalog: https://www.ondayzero.com/docs/reference/index.md
