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

# Get Product Variants by ID

> Variants are different options of an item such as size, color, and materials. For example, there are 12 variants for a laptop that comes in three sizes (13, 15, and 17 inches) and four colors (red, blue, grey, and white). By adding variants to products, you can offer more options to shoppers . **Note**: <br /> 1. At least one variant must be specified. <br /> 2. If you don't have product ID, use the corresponding SKU-based endpoint - `GET /products/sku/{sku}/variants`.<br /> 3. The `status` parameter is applicable to the `id` passed in path parameter and not for the variants. That is, the variants returned as part of the response are either the variants attached to the Live or Draft version of the product based on the `status` parameter.



## OpenAPI

````yaml product.openapi get /products/{id}/variants
openapi: 3.0.0
info:
  title: Product Catalog API
  description: >-
    Product Catalog API, a subset of fabric **Product Catalog**, is designed to
    improve product management. At fabric, the term Product refers to an Item,
    Variant, and/or Bundle. Items are stand-alone and sold individually.
    Variants are the different variations of an item. For example, a Laptop that
    comes in three different sizes (13”, 15”, 17”) and four different colors
    (red, blue, grey, and white) has 12 variations. Variants are nested under a
    parent item, allowing the different options to appear for the item on the
    Storefront. Bundles are collections of two or more products sold exclusively
    together or as individual products. Product Catalog API enables you to
    create items, add variants to an item, create a bundle, add items to a
    bundle, update product attributes, get details of one or more products,
    delete products, find products, and more.
  version: 3.0.0
  x-audience: external-public
  contact:
    email: support@fabric.inc
    name: Product Team
  license:
    name: fabric API License
    url: https://fabric.inc/api-license
  termsOfService: https://fabric.inc/terms-of-use
servers:
  - url: https://api.fabric.inc/v3
    description: Production URL
security:
  - authorization: []
tags:
  - name: Product Operations by ID
    description: >-
      Products operations based on product IDs. You can use these endpoints to
      perform product operations outside of Storefront.
  - name: Product Operations by SKU
    description: >-
      Products operations based on product SKUs. Merchants are requested to map
      a unique product identifier against fabric standard `SKU` before using
      these endpoints.
  - name: General Product Operations
    description: Supports CRUD operations and product search
externalDocs:
  description: Find out more about Product (Previously called PIM)
  url: https://developer.fabric.inc/docs/products-overview
paths:
  /products/{id}/variants:
    get:
      tags:
        - Product Operations by ID
      summary: Get Product Variants by ID
      description: >-
        Variants are different options of an item such as size, color, and
        materials. For example, there are 12 variants for a laptop that comes in
        three sizes (13, 15, and 17 inches) and four colors (red, blue, grey,
        and white). By adding variants to products, you can offer more options
        to shoppers . **Note**: <br /> 1. At least one variant must be
        specified. <br /> 2. If you don't have product ID, use the corresponding
        SKU-based endpoint - `GET /products/sku/{sku}/variants`.<br /> 3. The
        `status` parameter is applicable to the `id` passed in path parameter
        and not for the variants. That is, the variants returned as part of the
        response are either the variants attached to the Live or Draft version
        of the product based on the `status` parameter.
      operationId: getProductVariantsById
      parameters:
        - in: path
          name: id
          schema:
            type: string
          required: true
          example: 64184766610c0e32a86d8758
          description: 24-character system-generated product ID.
        - $ref: '#/components/parameters/offset'
        - $ref: '#/components/parameters/limit'
        - $ref: '#/components/parameters/locales'
        - $ref: '#/components/parameters/x-fabric-tenant-id'
        - $ref: '#/components/parameters/x-fabric-request-id'
        - $ref: '#/components/parameters/statusesQueryParam'
      responses:
        '200':
          description: OK
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/getVariantByIdsResponse'
              examples:
                Variant:
                  $ref: '#/components/examples/variantListExample'
          headers:
            x-fabric-request-id:
              $ref: '#/components/headers/x-fabric-request-id-header'
        '400':
          $ref: '#/components/responses/badRequest'
        '401':
          $ref: '#/components/responses/notAuthorized'
        '403':
          $ref: '#/components/responses/forbidden'
        '404':
          $ref: '#/components/responses/notFoundError'
        '413':
          $ref: '#/components/responses/payloadLimitExceededError'
        '500':
          $ref: '#/components/responses/internalServerError'
components:
  parameters:
    offset:
      in: query
      name: offset
      description: >-
        Number of records to skip before returning records. For example,
        `offset=20, limit=10` returns records 21-30.
      schema:
        type: integer
        format: int32
        default: 0
        example: 0
      required: false
    limit:
      in: query
      name: limit
      description: Maximum number of records per page
      schema:
        type: integer
        format: int32
        default: 10
        example: 10
    locales:
      in: query
      name: locales
      schema:
        type: string
        example: fr-CA%2Cen-US
      description: >-
        Comma-separated locale codes of product. The service throws a 400 error
        if the locale isn't supported. Standard locales can be found at
        https://www.rfc-editor.org/rfc/rfc5646. <br /> **Note**: The recommended
        way to get the locale is by invoking multi-channel service.
      required: false
    x-fabric-tenant-id:
      name: x-fabric-tenant-id
      in: header
      description: >-
        A header used by fabric to identify the tenant making the request. You
        must include tenant id in the authentication header for an API request
        to access any of fabric’s endpoints. You can retrieve the tenant id ,
        which is also called account id, from
        [Copilot](/v3/platform/settings/account-details/getting-the-account-id).
        This header is required.
      schema:
        type: string
        example: 517fa9dfd42d8b00g1o3k312
    x-fabric-request-id:
      name: x-fabric-request-id
      in: header
      description: Unique request ID
      schema:
        type: string
        example: 263e731c-45c8-11ed-b878-0242ac120002
      required: false
    statusesQueryParam:
      in: query
      name: statuses
      schema:
        type: string
        example: DRAFT
        default: DRAFT,LIVE
      description: >-
        Comma-separated statuses indicating the preferred order of the product
        versions considered for this operation (endpoint action). For example,
        <br />1. When the status is `DRAFT`, this operations will only apply to
        the Draft version of product, if it exists <br />2. When the status is
        `LIVE`, this operation will only apply to the Live version of the
        product, if it exists <br />3 When the status is `LIVE,DRAFT`, this
        operation will prioritize Live version first, if it exists. Otherwise,
        the Draft version is considered. <br />4 When the status is `DRAFT,LIVE`
        this operation will prioritize the Draft version first, if it exists.
        Otherwise, the Live version is considered.
      required: false
      allowReserved: true
  schemas:
    getVariantByIdsResponse:
      description: Details of variants by IDs
      type: object
      properties:
        data:
          type: array
          items:
            $ref: '#/components/schemas/idBasedVariant'
    idBasedVariant:
      type: object
      description: Variant details by ID
      properties:
        id:
          $ref: '#/components/schemas/productId'
        sku:
          $ref: '#/components/schemas/sku'
        type:
          $ref: '#/components/schemas/productType'
        isActive:
          type: boolean
          example: true
          description: 'true: Variant is active <br /> false: Variant is inactive'
        hasDraft:
          $ref: '#/components/schemas/hasDraft'
        hasLive:
          $ref: '#/components/schemas/hasLive'
        status:
          $ref: '#/components/schemas/status'
        attributes:
          type: array
          description: Product attributes
          items:
            $ref: '#/components/schemas/productAttributeValue'
        localizedProperties:
          $ref: '#/components/schemas/productProperties'
        parentProduct:
          $ref: '#/components/schemas/parentProductId'
        categoryId:
          type: string
          example: 617329dfd5288b0011332311
          description: 24-character system-generated category ID of product
        createdAt:
          type: string
          example: '2021-09-14T22:10:30.618Z'
          description: Time of variant creation (UTC)
        updatedAt:
          type: string
          example: '2021-09-14T22:10:30.618Z'
          description: Time of last update to variant (UTC)
    genericError:
      type: object
      properties:
        message:
          type: string
          description: Place holder error message for all 4xx, 5xx errors
          example: Request is invalid
        type:
          type: string
          description: Place holder for error types such as 4xx, 5xx
          example: Bad request
        errors:
          type: array
          items:
            type: object
            properties:
              type:
                type: string
                description: Error type
                example: CLIENT_ERROR
              message:
                type: string
                description: Error message
                example: Invalid request. Unable to find or create product
    productId:
      type: string
      example: AASSBCC12334FCD12334V
      description: Product ID
    sku:
      type: string
      example: XP-123345
      description: >-
        Unique product ID that maps to fabric's standard attribute called `SKU`.
        <br /> <b>Note:</b> `sku` shouldn't include `;` or `=`
      pattern: ^[^;=]*$
    productType:
      type: string
      enum:
        - ITEM
        - VARIANT
        - BUNDLE
      example: ITEM
      description: Supported product types
    hasDraft:
      type: boolean
      example: true
      description: >-
        true: Product has a Draft version <br /> false: Product doesn't have a
        Draft version
    hasLive:
      type: boolean
      example: true
      description: >-
        true: Product has a Live version <br /> false: Product doesn't have a
        Live version
    status:
      type: string
      description: >-
        Represents the current status of product. This value takes precedence
        over `isActive` if both are sent in the request.
      enum:
        - DRAFT
        - LIVE
      example: LIVE
    productAttributeValue:
      type: object
      description: Details of product attributes
      properties:
        id:
          $ref: '#/components/schemas/productId'
        name:
          type: string
          example: color
          description: Attribute name
        type:
          type: string
          example: string
          description: Attribute type
        validation:
          type: object
          description: Attribute validation - date
          properties:
            dateFormat:
              type: string
              description: Date format. <br> Applicable when `attributeType` is `DATETIME`.
              example: MM-DD-YYYY
        isDeleted:
          type: boolean
          nullable: true
          example: false
          description: >-
            true: Attributes are inherited from parent product <br /> false:
            Attributes aren't inherited from parent product **Note**: Attributes
            are soft deleted when a product is moved from one category to
            another.
        isInherited:
          type: boolean
          nullable: true
          example: true
          description: >-
            true: Attributes are inherited from parent product <br /> false:
            Attributes aren't inherited from parent product
        value:
          anyOf:
            - $ref: '#/components/schemas/booleanSchema'
            - $ref: '#/components/schemas/stringSchema'
            - $ref: '#/components/schemas/integerSchema'
            - $ref: '#/components/schemas/doubleSchema'
            - $ref: '#/components/schemas/arrayOfStrings'
          example: blue
          description: Attribute value
    productProperties:
      type: object
      description: Localized attribute names
      additionalProperties:
        type: object
        properties:
          attributes:
            type: array
            items:
              $ref: '#/components/schemas/productAttributeValue'
      example:
        en-US:
          attributes:
            - id: 4e7329dfd5288b0011332366
              name: Color
              type: string
              isDeleted: false
              value: blue
              isInherited: true
    parentProductId:
      description: Parent item ID of the Variant
      type: object
      properties:
        id:
          $ref: '#/components/schemas/productId'
    booleanSchema:
      type: boolean
      nullable: true
      description: Sample `boolean` schema
      example: true
    stringSchema:
      type: string
      nullable: true
      description: Sample `string` schema
      example: blue
    integerSchema:
      type: integer
      nullable: true
      format: int32
      description: Sample `integer` schema
      example: 1
    doubleSchema:
      type: number
      nullable: true
      format: double
      description: Sample `double` schema
      example: 1
    arrayOfStrings:
      type: array
      description: Array of strings
      items:
        $ref: '#/components/schemas/stringSchema'
  examples:
    variantListExample:
      value:
        data:
          - id: 527329dfd5288b001133235
            sku: QWE56DDFFVVV
            type: VARIANT
            isActive: true
            hasDraft: false
            hasLive: true
            status: LIVE
            attributes:
              - id: 567329dfd5288b0011332341
                name: Color
                type: string
                isDeleted: false
                value: blue,
                isInherited: true
            localizedProperties:
              en-US:
                attributes:
                  - id: 517329dfd5288b0011332341
                    name: Color
                    type: string
                    isDeleted: false
                    value: blue
                    isInherited: true
              en-IN:
                attributes:
                  - id: 5e7329dfd5288b0011332318
                    name: Colour
                    type: string
                    isDeleted: false
                    value: blue
                    isInherited: true
            parentProduct:
              id: 8e7329dfd5288b0011332315
            categoryId: 7e7329dfd5288b0011332354
            createdAt: '2021-09-14T22:10:30.618Z'
            updatedAt: '2021-09-14T22:10:30.618Z'
        offset: 5
        limit: 10
        count: 100
  headers:
    x-fabric-request-id-header:
      description: Unique request ID
      schema:
        type: string
        example: 263e731c-45c8-11ed-b878-0242ac120002
  responses:
    badRequest:
      description: Request is invalid or malformed
      headers:
        x-fabric-request-id:
          $ref: '#/components/headers/x-fabric-request-id-header'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/genericError'
    notAuthorized:
      description: Request is unauthorized
      headers:
        x-fabric-request-id:
          $ref: '#/components/headers/x-fabric-request-id-header'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/genericError'
          example:
            type: UNAUTHORIZED_ERROR
            message: The requester is unauthorized
    forbidden:
      description: User isn't allowed to perform the action
      headers:
        x-fabric-request-id:
          $ref: '#/components/headers/x-fabric-request-id-header'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/genericError'
          example:
            type: REQUEST_DENIED
            message: User doesn't have the required permission
    notFoundError:
      description: The entity requested for isn't found
      headers:
        x-fabric-request-id:
          $ref: '#/components/headers/x-fabric-request-id-header'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/genericError'
          example:
            type: NOT_FOUND
            message: Resource not found
    payloadLimitExceededError:
      description: Payload limit exceeded (> 10MB)
      headers:
        x-fabric-request-id:
          $ref: '#/components/headers/x-fabric-request-id-header'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/genericError'
          example:
            type: PAYLOAD_LIMIT_EXCEEDED_ERROR
            message: Payload exceeds maximum configured size
    internalServerError:
      description: Internal server error
      headers:
        x-fabric-request-id:
          $ref: '#/components/headers/x-fabric-request-id-header'
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/genericError'
          example:
            message: Internal Server Error
            type: SERVER_ERROR
  securitySchemes:
    authorization:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: S2S access token (JWT) from fabric Identity service (during Login)

````