# GET /api/v1/inventory/products/variants

> List product variants

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

## Description

Retrieve all variants with optional filtering by product.

## Authentication

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

## Parameters

- `product_id` (query, string, optional) — Filter by parent product ID
- `archived` (query, boolean, optional) — Filter by archived status
- `cursor` (query, string, optional) — Cursor for pagination
- `limit` (query, integer, optional) — Pagination limit
- `direction` (query, string, optional) — Pagination direction: 'next' or 'prev'
- `include_total_count` (query, boolean, optional) — Whether to include total count (expensive - avoid if possible)
- `sort_by` (query, string, optional) — Column name to sort by (e.g. 'created_at', 'amount', 'name'). When changing sort, reset cursor to None.
- `descending` (query, boolean, optional) — Sort direction: true for descending (newest/largest first), false for ascending

## Responses

### 200 — Successful Response

Schema: `VariantsListResponse`

- `items` (array · VariantResponse · required) → `VariantResponse` — List of items
  - `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.
- `total` (integer) — Total number of items (null when not calculated for performance)
- `limit` (integer) — Pagination limit
- `next_cursor` (string) — Cursor for next page
- `prev_cursor` (string) — Cursor for previous page
- `has_next` (boolean · required) — Whether there are more items
- `has_prev` (boolean · required) — Whether there are previous items

### 404 — Business not found

### 422 — Invalid query parameters

## Code samples

### cURL

```bash
curl -X GET 'https://api.ondayzero.com/api/v1/inventory/products/variants' \
  -H 'Authorization: Bearer dz_your_token' \
  -H 'x-business-id: YOUR_BUSINESS_ID'
```

### JavaScript

```javascript
const response = await fetch('https://api.ondayzero.com/api/v1/inventory/products/variants', {
  method: 'GET',
  headers: {
    Authorization: 'Bearer dz_your_token',
    'x-business-id': 'YOUR_BUSINESS_ID',
  },
});
const data = await response.json();
```

### Python

```python
import httpx

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

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

## See also

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