> ## Documentation Index
> Fetch the complete documentation index at: https://docs.launchmystore.io/llms.txt
> Use this file to discover all available pages before exploring further.

# Create Product

> Create a new product

# Create Product

Creates a new product in the store.

## Request

<CodeGroup>
  ```bash cURL theme={null}
  curl -X POST "https://api.launchmystore.io/api/v1/products.json" \
    -H "Authorization: Bearer YOUR_ACCESS_TOKEN" \
    -H "Content-Type: application/json" \
    -d '{
      "title": "Classic T-Shirt",
      "body_html": "<p>A comfortable cotton t-shirt.</p>",
      "status": "draft",
      "tags": ["cotton", "casual"],
      "variants": [
        {
          "title": "Small / Black",
          "price": 25.00,
          "sku": "TSHIRT-S-BLK",
          "inventory_quantity": 50
        }
      ]
    }'
  ```

  ```javascript Node.js theme={null}
  const response = await fetch('https://api.launchmystore.io/api/v1/products.json', {
    method: 'POST',
    headers: {
      'Authorization': 'Bearer YOUR_ACCESS_TOKEN',
      'Content-Type': 'application/json'
    },
    body: JSON.stringify({
      title: 'Classic T-Shirt',
      body_html: '<p>A comfortable cotton t-shirt.</p>',
      status: 'draft',
      tags: ['cotton', 'casual'],
      variants: [
        {
          title: 'Small / Black',
          price: 25.00,
          sku: 'TSHIRT-S-BLK',
          inventory_quantity: 50
        }
      ]
    })
  });
  ```
</CodeGroup>

## Body Parameters

<ParamField body="title" type="string" required>
  The product title
</ParamField>

<ParamField body="body_html" type="string">
  Product description (supports HTML)
</ParamField>

<ParamField body="handle" type="string">
  URL-safe handle. Auto-generated from title if not provided
</ParamField>

<ParamField body="status" type="string" default="draft">
  Product status: `active`, `draft`, `archived`
</ParamField>

<ParamField body="tags" type="array">
  Array of tags for organizing and filtering products
</ParamField>

<ParamField body="variants" type="array">
  Array of product variants. When a single variant is supplied, its
  pricing and stock are mirrored onto the product.

  <Expandable title="Variant Object">
    <ParamField body="title" type="string">
      Variant title. If omitted, it is built from `option1` / `option2` /
      `option3` (falling back to `Default`).
    </ParamField>

    <ParamField body="price" type="number">
      Variant price (e.g., `25.00`)
    </ParamField>

    <ParamField body="sku" type="string">
      Stock keeping unit
    </ParamField>

    <ParamField body="inventory_quantity" type="integer">
      Initial inventory quantity
    </ParamField>

    <ParamField body="weight" type="number">
      Weight value
    </ParamField>

    <ParamField body="weight_unit" type="string">
      Weight unit (e.g., `kg`, `g`, `lb`, `oz`)
    </ParamField>

    <ParamField body="option1" type="string">
      First option value (used to build the variant title)
    </ParamField>

    <ParamField body="option2" type="string">
      Second option value
    </ParamField>

    <ParamField body="option3" type="string">
      Third option value
    </ParamField>
  </Expandable>
</ParamField>

## Response

Returns the created product as a bare object under the `product` key
(HTTP `201`). Money fields are returned as decimal strings and IDs are
numeric. The header `X-LMS-Api-Version` advertises the contract version.

## Example Response

```json theme={null}
{
  "product": {
    "id": 482910,
    "title": "Classic T-Shirt",
    "handle": "classic-t-shirt",
    "body_html": "<p>A comfortable cotton t-shirt.</p>",
    "status": "draft",
    "tags": ["cotton", "casual"],
    "created_at": "2024-01-25T10:00:00.000Z",
    "updated_at": "2024-01-25T10:00:00.000Z",
    "variants": [
      {
        "id": 731204,
        "title": "Small / Black",
        "price": "25.00",
        "sku": "TSHIRT-S-BLK",
        "inventory_quantity": 50,
        "position": 1,
        "weight": 0,
        "weight_unit": "kg"
      }
    ],
    "options": [
      {
        "id": 1,
        "name": "Title",
        "position": 1,
        "values": ["Small / Black"]
      }
    ],
    "images": []
  }
}
```

## Error Response

Validation and other errors are returned as a standard `{ errors }`
body:

```json theme={null}
{
  "errors": {
    "base": ["title should not be empty"]
  }
}
```
