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

# Create Product

> Create a new product with inventory tracking and variant support

<Note>
  This endpoint creates a new product and automatically initializes inventory tracking. Products support multiple variants and can be associated with suppliers and categories.
</Note>

## Authentication

This endpoint requires a valid API key with `products:write` permissions.

```bash theme={null}
Authorization: Bearer YOUR_API_KEY
```

## Request Body

<ParamField body="name" type="string" required>
  Product name for display
</ParamField>

<ParamField body="sku" type="string" required>
  Unique stock keeping unit (SKU) identifier
</ParamField>

<ParamField body="description" type="string">
  Detailed product description
</ParamField>

<ParamField body="category" type="string">
  Product category (e.g., "Electronics", "Clothing", "Home & Garden")
</ParamField>

<ParamField body="brand" type="string">
  Brand or manufacturer name
</ParamField>

<ParamField body="price" type="object" required>
  Pricing information

  <Expandable title="Price object properties">
    <ParamField body="amount" type="integer" required>
      Price in cents (e.g., 1999 for \$19.99)
    </ParamField>

    <ParamField body="currency" type="string" required>
      ISO 4217 currency code (e.g., "USD", "EUR")
    </ParamField>

    <ParamField body="compare_at" type="integer">
      Original price for displaying discounts
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="cost" type="object">
  Cost information for margin calculations

  <Expandable title="Cost object properties">
    <ParamField body="amount" type="integer">
      Cost in cents
    </ParamField>

    <ParamField body="currency" type="string">
      ISO 4217 currency code
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="inventory" type="object">
  Inventory settings

  <Expandable title="Inventory object properties">
    <ParamField body="track_inventory" type="boolean">
      Whether to track inventory levels (default: true)
    </ParamField>

    <ParamField body="quantity" type="integer">
      Initial stock quantity
    </ParamField>

    <ParamField body="low_stock_threshold" type="integer">
      Threshold for low stock alerts
    </ParamField>

    <ParamField body="allow_backorder" type="boolean">
      Whether to allow orders when out of stock
    </ParamField>

    <ParamField body="warehouse_id" type="string">
      Primary warehouse ID for this product
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="dimensions" type="object">
  Product dimensions for shipping calculations

  <Expandable title="Dimensions object properties">
    <ParamField body="weight" type="number">
      Weight in pounds
    </ParamField>

    <ParamField body="length" type="number">
      Length in inches
    </ParamField>

    <ParamField body="width" type="number">
      Width in inches
    </ParamField>

    <ParamField body="height" type="number">
      Height in inches
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="variants" type="array">
  Product variants (e.g., different sizes, colors)

  <Expandable title="Variant object properties">
    <ParamField body="sku" type="string" required>
      Variant SKU
    </ParamField>

    <ParamField body="name" type="string" required>
      Variant name
    </ParamField>

    <ParamField body="options" type="object" required>
      Variant options (e.g., size: "M", color: "Blue")
    </ParamField>

    <ParamField body="price" type="object">
      Variant-specific pricing (overrides base product price)
    </ParamField>

    <ParamField body="inventory" type="object">
      Variant-specific inventory settings
    </ParamField>

    <ParamField body="barcode" type="string">
      UPC, EAN, or other barcode
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="images" type="array">
  Product images

  <Expandable title="Image object properties">
    <ParamField body="url" type="string" required>
      Image URL
    </ParamField>

    <ParamField body="alt_text" type="string">
      Alt text for accessibility
    </ParamField>

    <ParamField body="position" type="integer">
      Display order (1-based)
    </ParamField>

    <ParamField body="variant_ids" type="array">
      Associated variant IDs
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="supplier" type="object">
  Supplier information

  <Expandable title="Supplier object properties">
    <ParamField body="supplier_id" type="string">
      Existing supplier ID
    </ParamField>

    <ParamField body="supplier_sku" type="string">
      Supplier's SKU for this product
    </ParamField>

    <ParamField body="lead_time_days" type="integer">
      Expected days for reordering
    </ParamField>

    <ParamField body="minimum_order_quantity" type="integer">
      Minimum quantity for supplier orders
    </ParamField>
  </Expandable>
</ParamField>

<ParamField body="metadata" type="object">
  Additional custom fields as key-value pairs
</ParamField>

<ParamField body="tags" type="array">
  Array of string tags for categorization and search
</ParamField>

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

### Response

<ResponseField name="id" type="string">
  Unique product identifier
</ResponseField>

<ResponseField name="object" type="string">
  Always "product"
</ResponseField>

<ResponseField name="created_at" type="string">
  ISO 8601 timestamp of creation
</ResponseField>

<ResponseField name="updated_at" type="string">
  ISO 8601 timestamp of last update
</ResponseField>

<ResponseField name="name" type="string">
  Product name
</ResponseField>

<ResponseField name="sku" type="string">
  Product SKU
</ResponseField>

<ResponseField name="status" type="string">
  Product status
</ResponseField>

<ResponseField name="variants" type="array">
  Array of product variants with their IDs
</ResponseField>

<ResponseField name="inventory_summary" type="object">
  Summary of inventory across all variants
</ResponseField>

<RequestExample>
  ```bash cURL theme={null}
  curl --location --request POST 'https://api.stateset.com/v1/products' \
  --header 'Content-Type: application/json' \
  --header 'Authorization: Bearer YOUR_API_KEY' \
  --data-raw '{
      "name": "Wireless Bluetooth Headphones",
      "sku": "WBH-001",
      "description": "Premium noise-cancelling wireless headphones with 30-hour battery life",
      "category": "Electronics",
      "brand": "AudioTech",
      "price": {
          "amount": 14999,
          "currency": "USD",
          "compare_at": 19999
      },
      "cost": {
          "amount": 7500,
          "currency": "USD"
      },
      "inventory": {
          "track_inventory": true,
          "quantity": 150,
          "low_stock_threshold": 20,
          "allow_backorder": false
      },
      "dimensions": {
          "weight": 0.5,
          "length": 8,
          "width": 7,
          "height": 3
      },
      "variants": [
          {
              "sku": "WBH-001-BLK",
              "name": "Wireless Bluetooth Headphones - Black",
              "options": {
                  "color": "Black"
              },
              "inventory": {
                  "quantity": 100
              }
          },
          {
              "sku": "WBH-001-WHT",
              "name": "Wireless Bluetooth Headphones - White",
              "options": {
                  "color": "White"
              },
              "inventory": {
                  "quantity": 50
              }
          }
      ],
      "images": [
          {
              "url": "https://example.com/images/headphones-main.jpg",
              "alt_text": "Wireless Bluetooth Headphones",
              "position": 1
          }
      ],
      "tags": ["electronics", "audio", "wireless", "bluetooth"]
  }'
  ```

  ```graphQL GraphQL theme={null}
  mutation CreateProduct {
    createProduct(input: {
      name: "Wireless Bluetooth Headphones"
      sku: "WBH-001"
      description: "Premium noise-cancelling wireless headphones with 30-hour battery life"
      category: "Electronics"
      brand: "AudioTech"
      price: {
        amount: 14999
        currency: "USD"
        compare_at: 19999
      }
      inventory: {
        track_inventory: true
        quantity: 150
        low_stock_threshold: 20
      }
    }) {
      id
      name
      sku
      status
      inventory_summary {
        total_quantity
        available_quantity
        reserved_quantity
      }
    }
  }
  ```

  ```javascript Node.js theme={null}
  const product = await stateset.products.create({
    name: "Wireless Bluetooth Headphones",
    sku: "WBH-001",
    description: "Premium noise-cancelling wireless headphones with 30-hour battery life",
    category: "Electronics",
    brand: "AudioTech",
    price: {
      amount: 14999,
      currency: "USD",
      compare_at: 19999
    },
    inventory: {
      track_inventory: true,
      quantity: 150,
      low_stock_threshold: 20,
      allow_backorder: false
    },
    variants: [
      {
        sku: "WBH-001-BLK",
        name: "Wireless Bluetooth Headphones - Black",
        options: { color: "Black" },
        inventory: { quantity: 100 }
      },
      {
        sku: "WBH-001-WHT",
        name: "Wireless Bluetooth Headphones - White",
        options: { color: "White" },
        inventory: { quantity: 50 }
      }
    ]
  });
  ```

  ```python Python theme={null}
  product = stateset.products.create({
      "name": "Wireless Bluetooth Headphones",
      "sku": "WBH-001",
      "description": "Premium noise-cancelling wireless headphones with 30-hour battery life",
      "category": "Electronics",
      "brand": "AudioTech",
      "price": {
          "amount": 14999,
          "currency": "USD",
          "compare_at": 19999
      },
      "inventory": {
          "track_inventory": True,
          "quantity": 150,
          "low_stock_threshold": 20,
          "allow_backorder": False
      }
  })
  ```
</RequestExample>

<ResponseExample>
  ```json Response theme={null}
  {
    "id": "prod_0901f083-aa1c-43c5-af5c-0a9d2fc64e30",
    "object": "product",
    "created_at": "2024-01-15T10:30:00Z",
    "updated_at": "2024-01-15T10:30:00Z",
    "name": "Wireless Bluetooth Headphones",
    "sku": "WBH-001",
    "description": "Premium noise-cancelling wireless headphones with 30-hour battery life",
    "category": "Electronics",
    "brand": "AudioTech",
    "status": "active",
    "price": {
      "amount": 14999,
      "currency": "USD",
      "compare_at": 19999
    },
    "cost": {
      "amount": 7500,
      "currency": "USD"
    },
    "inventory": {
      "track_inventory": true,
      "low_stock_threshold": 20,
      "allow_backorder": false
    },
    "inventory_summary": {
      "total_quantity": 150,
      "available_quantity": 150,
      "reserved_quantity": 0,
      "by_warehouse": {
        "wh_001": {
          "available": 150,
          "reserved": 0
        }
      }
    },
    "variants": [
      {
        "id": "var_1234567890",
        "sku": "WBH-001-BLK",
        "name": "Wireless Bluetooth Headphones - Black",
        "options": {
          "color": "Black"
        },
        "inventory": {
          "quantity": 100,
          "available": 100,
          "reserved": 0
        }
      },
      {
        "id": "var_0987654321",
        "sku": "WBH-001-WHT",
        "name": "Wireless Bluetooth Headphones - White",
        "options": {
          "color": "White"
        },
        "inventory": {
          "quantity": 50,
          "available": 50,
          "reserved": 0
        }
      }
    ],
    "images": [
      {
        "id": "img_abc123",
        "url": "https://example.com/images/headphones-main.jpg",
        "alt_text": "Wireless Bluetooth Headphones",
        "position": 1
      }
    ],
    "tags": ["electronics", "audio", "wireless", "bluetooth"],
    "metadata": {}
  }
  ```
</ResponseExample>
