# POST /api/v1/inventory/products/{id}/convert-to-variant

> Convert product to variant

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

## Description

Move a product's variants under another product and archive the source.

## Authentication

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

## Parameters

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

## Request body

Schema: `ConvertProductToVariantRequest`

- `target_product_id` (string · required) — UUID of the product that will become the parent.

## Responses

### 201 — Successful Response

### 400 — Bad Request - Invalid input

### 404 — Not Found - Resource does not exist

### 422 — Validation Error - Invalid data format

## Code samples

### cURL

```bash
curl -X POST 'https://api.ondayzero.com/api/v1/inventory/products/{id}/convert-to-variant' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID' \
  -H 'Content-Type: application/json' \
  -d '{
  "target_product_id": "string"
}'
```

### JavaScript

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

### Python

```python
import httpx

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

payload = {
  "target_product_id": "string"
}

response = httpx.post("https://api.ondayzero.com/api/v1/inventory/products/{id}/convert-to-variant", headers=headers, json=payload)
data = response.json()
```

## See also

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