---
title: "Create product variant"
method: POST
path: "/v2/commerce/products/{productId}/variants"
tags: ["Products"]
---

# Create product variant

`POST /v2/commerce/products/{productId}/variants`

## Request

- Base URL: `https://api.squarespace.com`
- URL: `https://api.squarespace.com/v2/commerce/products/{productId}/variants`
- Auth: HTTP bearer
- TypeScript: <https://skmtc.dev/squarespace/apis/commerce-api/docs/v2/commerce/products/:productId/variants/post.ts> (a function with typed inputs; its response is checked against the schema)

Creates a variant of a product. Creating a variant for a physical or service product requires that the product already has at least one attribute.

## Path parameters

- `productId` string, required

## Headers

- `Authorization` string, required
- `User-Agent` string, required

## Request body

- CreateVariantRequestV2
  - `attributes` object: Specifies attribute-value pairs for the variant. 100 char limit per key and per value with no more than six key-value pairs. Supported for PHYSICAL products only.
  - `gtin` string: Global Trade Item Number (GTIN). Optional. Must be 8, 12, 13, or 14 numeric digits. Whitespace, hyphens, and underscores are stripped before validation. Supported for PHYSICAL products only.
  - `mpn` string: Manufacturer Part Number (MPN). Optional. Must be alphanumeric and 70 characters or fewer. Whitespace, hyphens, and underscores are stripped before validation. Supported for PHYSICAL products only.
  - `pricing` ProductPricing, required: Present for DIGITAL products only. Digital products don't have variants, so pricing is at the product level.
    - `basePrice` MonetaryAmount: A monetary amount with currency code and decimal value.
      - `currency` object: ISO 4217 currency code.
        - `currencyCode` string
        - `defaultFractionDigits` integer
        - `displayName` string
        - `numericCode` integer
        - `numericCodeAsString` string
        - `symbol` string
      - `value` number: Decimal monetary value.
    - `onSale` boolean: Indicates whether the variant is sold according to its sale price. Present for PHYSICAL products only.
    - `salePrice` MonetaryAmount: A monetary amount with currency code and decimal value.
      - `currency` object: ISO 4217 currency code.
        - `currencyCode` string
        - `defaultFractionDigits` integer
        - `displayName` string
        - `numericCode` integer
        - `numericCodeAsString` string
        - `symbol` string
      - `value` number: Decimal monetary value.
  - `shippingMeasurements` ProductMeasurements: Measurements of the variant when it's shipped. Present for PHYSICAL products only.
    - `dimensions` ProductDimensions: Physical dimensions of the variant.
      - `height` number, float: Height of the variant.
      - `length` number, float: Length of the variant.
      - `unit` 'CENTIMETER' | 'INCH': Unit of measurement. Supported values: `INCH`, `CENTIMETER`.
      - `width` number, float: Width of the variant.
    - `weight` ProductWeight: Weight of the variant.
      - `unit` 'KILOGRAM' | 'POUND': Unit of measurement. Supported values: `KILOGRAM`, `POUND`.
      - `value` number, float: Weight amount.
  - `sku` string, required: Merchant-defined code that identifies the product variant. Value must be unique among variants. Leading and trailing whitespace is removed.
  - `stock` ProductStock: Available stock for the variant. Present for PHYSICAL products only.
    - `quantity` integer: Number of units that can be purchased.
    - `unlimited` boolean: Indicates whether the variant has unlimited stock.

## Response `201`

The ProductVariant was created successfully.

- union: A product variant. The shape depends on the product type.
  - object: A variant of a PHYSICAL product.
    - `id` string
    - `image` ProductImage: Product image assigned to the variant.
      - `altText` string: Alt text for the image; impacts SEO and appears in search results.
      - `availableFormats` string[]: Available image sizes. Use with `images.url` and a `format` query parameter to retrieve the image at a particular width.
      - `id` string: Unique ProductImage id.
      - `orderIndex` integer: Position of the image in the product's image list.
      - `originalSize` object: Image size when first uploaded.
      - `url` string: Absolute URL of the image hosted on Squarespace.
    - `sku` string
    - `attributes` object
    - `gtin` string
    - `mpn` string
    - `pricing` FullProductPricing
      - `basePrice` MonetaryAmount: A monetary amount with currency code and decimal value.
        - `currency` object: ISO 4217 currency code.
          - `currencyCode` string
          - `defaultFractionDigits` integer
          - `displayName` string
          - `numericCode` integer
          - `numericCodeAsString` string
          - `symbol` string
        - `value` number: Decimal monetary value.
      - `onSale` boolean
      - `salePrice` MonetaryAmount: A monetary amount with currency code and decimal value.
        - `currency` object: ISO 4217 currency code.
          - `currencyCode` string
          - `defaultFractionDigits` integer
          - `displayName` string
          - `numericCode` integer
          - `numericCodeAsString` string
          - `symbol` string
        - `value` number: Decimal monetary value.
    - `shippingMeasurements` ProductMeasurements: Measurements of the variant when it's shipped. Present for PHYSICAL products only.
      - `dimensions` ProductDimensions: Physical dimensions of the variant.
        - `height` number, float: Height of the variant.
        - `length` number, float: Length of the variant.
        - `unit` 'CENTIMETER' | 'INCH': Unit of measurement. Supported values: `INCH`, `CENTIMETER`.
        - `width` number, float: Width of the variant.
      - `weight` ProductWeight: Weight of the variant.
        - `unit` 'KILOGRAM' | 'POUND': Unit of measurement. Supported values: `KILOGRAM`, `POUND`.
        - `value` number, float: Weight amount.
    - `stock` ProductStock: Available stock for the variant. Present for PHYSICAL products only.
      - `quantity` integer: Number of units that can be purchased.
      - `unlimited` boolean: Indicates whether the variant has unlimited stock.
  - object: A variant of a GIFT_CARD product.
    - `id` string
    - `image` ProductImage: Product image assigned to the variant.
      - `altText` string: Alt text for the image; impacts SEO and appears in search results.
      - `availableFormats` string[]: Available image sizes. Use with `images.url` and a `format` query parameter to retrieve the image at a particular width.
      - `id` string: Unique ProductImage id.
      - `orderIndex` integer: Position of the image in the product's image list.
      - `originalSize` object: Image size when first uploaded.
      - `url` string: Absolute URL of the image hosted on Squarespace.
    - `sku` string
    - `pricing` SimpleProductPricing
      - `basePrice` MonetaryAmount: A monetary amount with currency code and decimal value.
        - `currency` object: ISO 4217 currency code.
          - `currencyCode` string
          - `defaultFractionDigits` integer
          - `displayName` string
          - `numericCode` integer
          - `numericCodeAsString` string
          - `symbol` string
        - `value` number: Decimal monetary value.
  - object: A variant of a SERVICE product.
    - `id` string
    - `image` ProductImage: Product image assigned to the variant.
      - `altText` string: Alt text for the image; impacts SEO and appears in search results.
      - `availableFormats` string[]: Available image sizes. Use with `images.url` and a `format` query parameter to retrieve the image at a particular width.
      - `id` string: Unique ProductImage id.
      - `orderIndex` integer: Position of the image in the product's image list.
      - `originalSize` object: Image size when first uploaded.
      - `url` string: Absolute URL of the image hosted on Squarespace.
    - `sku` string
    - `attributes` object
    - `pricing` FullProductPricing
      - `basePrice` MonetaryAmount: A monetary amount with currency code and decimal value.
        - `currency` object: ISO 4217 currency code.
          - `currencyCode` string
          - `defaultFractionDigits` integer
          - `displayName` string
          - `numericCode` integer
          - `numericCodeAsString` string
          - `symbol` string
        - `value` number: Decimal monetary value.
      - `onSale` boolean
      - `salePrice` MonetaryAmount: A monetary amount with currency code and decimal value.
        - `currency` object: ISO 4217 currency code.
          - `currencyCode` string
          - `defaultFractionDigits` integer
          - `displayName` string
          - `numericCode` integer
          - `numericCodeAsString` string
          - `symbol` string
        - `value` number: Decimal monetary value.
    - `stock` ProductStock: Available stock for the variant. Present for PHYSICAL products only.
      - `quantity` integer: Number of units that can be purchased.
      - `unlimited` boolean: Indicates whether the variant has unlimited stock.

## Other responses

- `400`: Bad request. The request body does not conform to the required specification.
- `404`: Not found. The requested Product was not found.
- `405`: Method not allowed. The Product requested does not support variants.
- `409`: Conflict. The provided SKU is already in use by the requested Product, or the Product has reached its limit of 250 variants.

---

[API](https://skmtc.dev/squarespace/apis/commerce-api.md) - [All operations](https://skmtc.dev/squarespace/apis/commerce-api/llms.txt) - [OpenAPI document](https://skmtc.dev/squarespace/apis/commerce-api/revisions/5dd4b1b7cd38?raw)
