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

# Create Product Variant

> Create a new product variant.



## OpenAPI

````yaml post /products/{productId}/product-variants
openapi: 3.1.0
info:
  title: Products API
  version: v1
  description: >-
    The Products API allows managing your shop's products within the Loop
    Platform.


    ### Resource identifier format


    Resource identifiers (the `id` field and related global-identifier fields)
    are returned as JSON

    integers by default. To receive them as strings instead, send the

    `X-Loop-Global-Identifier-Type: string` request header.
  contact:
    name: Loop Returns
    url: https://loopreturns.com/
servers:
  - url: https://api.loopreturns.com/api/v1
security: []
tags:
  - name: Products
  - name: Product Variants
paths:
  /products/{productId}/product-variants:
    post:
      tags:
        - Product Variants
      summary: Create Product Variant
      description: Create a new product variant.
      operationId: createProductVariant
      parameters:
        - schema:
            type: integer
          name: productId
          in: path
          required: true
          description: The unique Loop identifier of the parent product.
          example: 1234567890
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/CreateProductVariantRequest'
      responses:
        '200':
          description: Success
          content:
            application/json:
              schema:
                type: object
                properties:
                  product_variant:
                    $ref: '#/components/schemas/ProductVariantResponse'
        '401':
          description: Unauthorized
          content:
            application/json:
              schema:
                $ref: '#/components/responses/Unauthorized'
      security:
        - write: []
components:
  schemas:
    CreateProductVariantRequest:
      type: object
      properties:
        external_id:
          type:
            - string
            - 'null'
          maxLength: 64
          description: >-
            The provided `external_id` must be unique. If a non-unique
            `external_id` is provided, the API will respond with an error.
          examples:
            - 564400c7-7a6b-4f29-b6a5-7bb580b2992c
        sku:
          type:
            - string
            - 'null'
          maxLength: 255
          description: The SKU of the product variant.
          examples:
            - SHOES-US44-M-Brwn
        name:
          type: string
          maxLength: 255
          description: The name of the product variant.
          examples:
            - Classic Brown Dress Shoes - Size 12
        weight_grams:
          type:
            - integer
            - 'null'
          description: The weight of the product variant in grams.
          examples:
            - 440
        barcode:
          type:
            - string
            - 'null'
          maxLength: 255
          description: The barcode of the product variant.
          examples:
            - 712345000019
        price:
          anyOf:
            - $ref: '#/components/schemas/MoneySet'
            - type: 'null'
          description: >-
            The price of the product variant in minor units, such as cents, with
            its corresponding currency.
        images:
          type:
            - array
            - 'null'
          items:
            type: string
            format: uri
            examples:
              - https://example.com/example.jpg
            minLength: 1
        options:
          type:
            - array
            - 'null'
          description: >-
            An array of optional features or characteristics of the product
            variant that can be selected by the customer.
          items:
            $ref: '#/components/schemas/ProductVariantOption'
        logistics_information:
          description: >-
            The logistics information for the product variant such as code
            classification, shipping, and cost.
          anyOf:
            - $ref: '#/components/schemas/ProductVariantLogisticsInformation'
            - type: 'null'
        dimensions:
          description: >-
            The dimensions of the product variant, interpreted as inches.
            Optional and nullable. When provided, `depth`, `width`, and `height`
            are all required.
          anyOf:
            - $ref: '#/components/schemas/ProductVariantDimensions'
            - type: 'null'
      required:
        - name
      x-stoplight:
        id: 4pa0jndzw1qig
    ProductVariantResponse:
      title: ProductVariantResponse
      type: object
      properties:
        id:
          type: integer
          format: int64
          minimum: 1
          description: >-
            The unique integer identifier for the product variant, created by
            Loop.
          examples:
            - 810772
          readOnly: true
        external_id:
          type:
            - string
            - 'null'
          description: >-
            The identifier used by an external source to identify the product
            variant.
          examples:
            - 564400c7-7a6b-4f29-b6a5-7bb580b2992c
        sku:
          type:
            - string
            - 'null'
          description: The SKU of the product variant.
          examples:
            - SHOES-US44-M-Brwn
        name:
          type: string
          description: The name of the product variant.
          examples:
            - Classic Brown Dress Shoes - Size 12
        weight_grams:
          type:
            - integer
            - 'null'
          format: int32
          description: The weight of the product variant in grams.
          examples:
            - 500
        barcode:
          type:
            - string
            - 'null'
          description: The barcode of the product variant.
          examples:
            - 1234asdf324
        product:
          description: The details associated with the parent product.
          anyOf:
            - $ref: '#/components/schemas/ProductDetails'
            - type: 'null'
        price:
          anyOf:
            - $ref: '#/components/schemas/MoneySet'
            - type: 'null'
          description: >-
            The price of the product variant in minor units, such as cents, with
            its corresponding currency.
        images:
          type:
            - array
            - 'null'
          description: An array of links to images of the product variant.
          items:
            type: string
            format: uri
            examples:
              - https://example.com/example.jpg
        inventories:
          description: The record of available count and location by product variant.
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/Inventory'
        options:
          type:
            - array
            - 'null'
          description: >-
            An array of optional features or characteristics of the product
            variant that can be selected by the customer.
          items:
            $ref: '#/components/schemas/ProductVariantOption'
        logistics_information:
          description: >-
            The logistics information for the product variant such as code
            classification, shipping, and cost.
          anyOf:
            - $ref: '#/components/schemas/ProductVariantLogisticsInformation'
            - type: 'null'
        dimensions:
          description: >-
            The dimensions of the product variant, interpreted as inches, or
            `null` when none are stored.
          anyOf:
            - $ref: '#/components/schemas/ProductVariantDimensions'
            - type: 'null'
    MoneySet:
      type: object
      examples:
        - amount: 50000
          currency_code: USD
        - amount: 25000
        - amount: 1500
          currency_code: EUR
      properties:
        amount:
          type: integer
          format: int32
          examples:
            - 25000
        currency_code:
          type: string
          default: USD
          examples:
            - EUR
      required:
        - amount
        - currency_code
    ProductVariantOption:
      title: ProductVariantOption
      type: object
      properties:
        position:
          type: integer
          format: int32
          examples:
            - 1
        value:
          type: string
          examples:
            - Red
      required:
        - position
        - value
    ProductVariantLogisticsInformation:
      title: ProductVariantLogisticsInformation
      type: object
      properties:
        origin_country_code:
          type:
            - string
            - 'null'
          examples:
            - US
          minLength: 2
          maxLength: 2
          description: >-
            The ISO 3166-1 alpha-2 country code of the country where the product
            variant is manufactured.
        origin_region_code:
          type:
            - string
            - 'null'
          examples:
            - CA
          minLength: 2
          maxLength: 2
          description: >-
            The ISO 3166-2 alpha-2 region code of the region where the product
            variant is manufactured.
        default_hs_code:
          type:
            - string
            - 'null'
          examples:
            - '1234567890'
          minLength: 6
          maxLength: 13
          description: >-
            The default Harmonized System (HS) code of the product variant. This
            code is used for any country that does not have a corresponding
            entry in the `destination_country_hs_codes` array.
        requires_shipping:
          type:
            - boolean
            - 'null'
          description: >-
            The value that determines whether the product variant requires
            shipping.
        cost:
          anyOf:
            - $ref: '#/components/schemas/MoneySet'
            - type: 'null'
          description: >-
            The cost of the product variant in minor units, such as cents, with
            its corresponding currency.
        destination_country_hs_codes:
          type:
            - array
            - 'null'
          items:
            $ref: '#/components/schemas/DestinationCountryHsCode'
          description: >-
            The list of destination country-specific HS codes for the product
            variant (each country code may occur only once in the list).
    ProductVariantDimensions:
      title: ProductVariantDimensions
      type: object
      description: >-
        The dimensions of the product variant. Values are unitless on the wire
        and interpreted as inches. Dimensions are all-or-nothing: when a
        `dimensions` object is provided, `depth`, `width`, and `height` are all
        required.
      properties:
        depth:
          type: number
          format: float
          exclusiveMinimum: 0
          maximum: 9999.9999
          multipleOf: 0.0001
          examples:
            - 8.5
          description: >-
            The depth of the product variant, in inches. Must be greater than 0,
            at most 9999.9999, and have no more than 4 decimal places.
        width:
          type: number
          format: float
          exclusiveMinimum: 0
          maximum: 9999.9999
          multipleOf: 0.0001
          examples:
            - 6
          description: >-
            The width of the product variant, in inches. Must be greater than 0,
            at most 9999.9999, and have no more than 4 decimal places.
        height:
          type: number
          format: float
          exclusiveMinimum: 0
          maximum: 9999.9999
          multipleOf: 0.0001
          examples:
            - 2.25
          description: >-
            The height of the product variant, in inches. Must be greater than
            0, at most 9999.9999, and have no more than 4 decimal places.
      required:
        - depth
        - width
        - height
    ProductDetails:
      type: object
      properties:
        id:
          type: integer
          format: int64
          minimum: 1
          examples:
            - 810772
          readOnly: true
        external_id:
          type:
            - string
            - 'null'
          examples:
            - 564400c7-7a6b-4f29-b6a5-7bb580b2992c
        sku:
          type:
            - string
            - 'null'
          examples:
            - SHOES-US44-M-Brwn
        name:
          type: string
    Inventory:
      type: object
      properties:
        id:
          type: integer
          format: int64
          minimum: 1
          examples:
            - 127302
          readOnly: true
        available_count:
          type: integer
          format: int32
          examples:
            - 10
        location:
          anyOf:
            - $ref: '#/components/schemas/Location'
            - type: 'null'
    DestinationCountryHsCode:
      title: DestinationCountryHsCode
      type: object
      properties:
        destination_country_code:
          type: string
          examples:
            - US
          minLength: 2
          maxLength: 2
          description: The ISO 3166-1 alpha-2 country code of the destination country.
        hs_code:
          type: string
          examples:
            - '1234567890'
          minLength: 6
          maxLength: 13
          description: >-
            The Harmonized System (HS) code of the product variant for the
            destination country.
    Location:
      type: object
      properties:
        id:
          type: integer
          format: int64
          minimum: 1
          examples:
            - 182973
          readOnly: true
        external_id:
          type:
            - string
            - 'null'
          examples:
            - 564400c7-7a6b-4f29-b6a5-7bb580b2992c
        name:
          oneOf:
            - type: string
  responses:
    Unauthorized:
      description: >-
        Example response if request submitted without a valid API Key in
        X-Authorization.
      content:
        application/json:
          schema:
            type: object
            required:
              - errors
            properties:
              errors:
                type: string
                examples:
                  - Unauthorized.
      headers:
        X-Loop-Request-ID:
          schema:
            type: string
            examples:
              - 5a748e7c-5fcc-4fb0-a777-6a4d28e60d4c
            format: uuid
          description: UUID to aid in debugging API issues
  securitySchemes:
    write:
      name: X-Authorization
      type: apiKey
      in: header
      description: 'API Scope: "Product (write)"'

````