---
title: "Get a product variant "
description: "Get the product variant information based on the variant ID."
doc_type: openapi
doc_category: openapi
doc_version: v20260901
source_url:
  html: 'https://developer.shopline.com/docs/admin-rest-api/product/product-variant/get-a-product-variant'
  md: 'https://developer.shopline.com/docs/admin-rest-api/product/product-variant/get-a-product-variant.md'
---
# Get a product variant 

Get the product variant information based on the variant ID. 

- **Base URL:** `https://{handle}.myshopline.com/admin/openapi`
- **Required Scopes:** `read_products`
- **API Version:** v20260901
- **API Type:** Admin
- **API Protocol:** RESTful

## Endpoint

```http
GET /products/variants/:variant_id.json
```

## Base URL

* `https://{handle}.myshopline.com/admin/openapi`

  * `{handle}`: `handle` : The store's unique identifier, which is the prefix of the store's domain name. For example, if a store's domain name is `open001.myshopline.com` , the store handle is `open001` .

## Required Permissions

* `read_products`

## Request

### Path Parameters

* `variant_id`

  string (required)

  The unique identifier for a variant.<br/>
  Maximum length：64 

### Query Parameters

* `fields`

  string (optional)

  Specify the fields to be returned, with multiple fields separated by commas. For available fields, refer to the top-level child parameters under the `variant` object in the response. 

### Request Headers

* `Content-Type`

  string (required)

  The field must be set to the fixed value `application/json; charset=utf-8`.

* `Authorization`

  string (required)

   The access token for the API resource. Refer to [App authorization](https://developer.shopline.com/docs/apps/api-instructions-for-use/app-authorization.md?lang=en) to obtain the access token, and then pass the obtained token in the Bearer format. 

## Response

### Status Codes

* `200`

  For the complete list of codes and messages, see [Http status code](https://developer.shopline.com/docs/apps/api-instructions-for-use/http-status-code.md?lang=en).

* `401`

  

* `429`

  

### Response Headers

* `traceId`

  A globally unique identifier for the request. It is used to track the request flow throughout the system, allowing for easy location and debugging when issues arise.

### Response Body

#### 200

* `variant`

  object

  Variant information.

  * `price`

    string

    The selling price of the variant. The value is rounded to two decimal places.

  * `required_shipping`

    boolean

    Indicates whether the variant is required to be shipped.
    - `true`: Shipping is required.
    - `false`: Shipping is not required.

  * `title`

    string

    The title of the variant, assembled from the option value of the variant.

  * `barcode`

    string

    The barcode of the variant.

  * `weight_unit`

    string

    The unit of weight for the variant. Valid values are:
    - `g`: gram
    - `kg`: kilogram
    - `lb`: pound
    - `oz`: ounce
    - `zh_kg`: kilogram

  * `compare_at_price`

    string

    The original price of the variant. The value is rounded to two decimal places.

  * `image`

    object

    The image of the variant.

    * `src`

      string

      The link to the variant image, represented as a URL.

    * `alt`

      string

      The alternative textual description of the variant image, usually a word or phrase with the characteristics or content of the image.

    * `id`

      string

      The unique identifier for the variant image.

  * `inventory_policy`

    string

    Indicates whether the variant is allowed to be oversold.
    - `deny`: Does not allow overselling.
    - `continue`: Allow overselling.

  * `inventory_quantity`

    integer

    The total inventory quantity at all storage locations.

  * `inventory_tracker`

    boolean

    Indicates whether the inventory tracking is enabled.
    - ` true`: Inventory tracking is enabled.
    - ` false`: Inventory tracking is not enabled.

  * `option3`

    string

    Information of the third option of the variant.

  * `product_id`

    string

    The unique identifier for the product corresponding to the variant.

  * `id`

    string

    The unique identifier for the variant.

  * `inventory_item_id`

    string

    The unique identifier for the inventory item.

  * `option1`

    string

    Information of the first option of the variant.

  * `option2`

    string

    Information of the second option of the variant.

  * `option4`

    string

    Information of the fourth option of the variant.

  * `sku`

    string

    The product SKU. It is distinct from `variant.id` returned by SHOPLINE.

  * `taxable`

    boolean

    Indicates whether the variant is subject to tax.
    - `true`: Tax is required.
    - `false`: Tax is not required.

  * `weight`

    string

    The weight of the variant. The value is rounded up if it exceeds two decimal places.

  * `option5`

    string

    Information of the fifth option of the variant.


#### 401

* `errors`

  string

  Error message. 


#### 429

* `errors`

  string

  Error message. 


## OpenAPI Definition

```json
{
  "tags": [
    "Get a product variant "
  ],
  "description": "Get the product variant information based on the variant ID. ",
  "externalDocs": {
    "description": "Permission point used by the interface is `read_products` , For more information about the use of permission points, see",
    "url": "ec20/3cv5d7wpfgr6a8z5/xabczf5442284vkq?lang=en",
    "errorTableDescription": "| Error Code | HTTP Status Code | Error Description |\n|------------|------------------|-------------------|\n| DATA_NOT_EXIST | 404 | The requested data does not exist. |\n| SUCCESS | 200 | request success |\n| SERVICE_BLOCKED | 403 | Service blocked |\n| SYSTEM_ERROR | 500 | system error |\n| PARAM_ILLEGAL | 422 | illegal param |\n"
  },
  "operationId": "GKoQk4QN",
  "parameters": [
    {
      "name": "variant_id",
      "in": "path",
      "description": "The unique identifier for a variant.<br/>\nMaximum length：64 ",
      "required": true,
      "style": "simple",
      "schema": {
        "name": "variant_id",
        "description": "The unique identifier for a variant.<br/>\nMaximum length：64 ",
        "type": "string",
        "example": "18057039439794751459380282"
      },
      "example": "18057039439794751459380282",
      "examples": {
        "Get all information about a product variant": {
          "value": "18060895302863070249743144"
        }
      }
    },
    {
      "name": "fields",
      "in": "query",
      "description": "Specify the fields to be returned, with multiple fields separated by commas. For available fields, refer to the top-level child parameters under the `variant` object in the response. ",
      "style": "form",
      "explode": true,
      "schema": {
        "name": "fields",
        "description": "Specify the fields to be returned, with multiple fields separated by commas. For available fields, refer to the top-level child parameters under the `variant` object in the response. ",
        "type": "string",
        "example": "id,title"
      },
      "example": "id,title",
      "examples": {
        "Get all information about a product variant": {
          "value": ""
        }
      }
    },
    {
      "name": "Content-Type",
      "in": "header",
      "description": "The field must be set to the fixed value `application/json; charset=utf-8`.",
      "required": true,
      "schema": {
        "name": "Content-Type",
        "type": "string",
        "example": "application/json; charset=utf-8"
      }
    },
    {
      "name": "Authorization",
      "in": "header",
      "description": " The access token for the API resource. Refer to [App authorization](https://developer.shopline.com/docs/apps/api-instructions-for-use/app-authorization.md?lang=en) to obtain the access token, and then pass the obtained token in the Bearer format. ",
      "required": true,
      "style": "string",
      "schema": {
        "name": "Authorization",
        "description": " The access token for the API resource. Refer to [App authorization](https://developer.shopline.com/docs/apps/api-instructions-for-use/app-authorization.md?lang=en) to obtain the access token, and then pass the obtained token in the Bearer format. ",
        "type": "string",
        "example": "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6MCwiYXBwS2V5IjoiNzU2ZjI1NWE2NjdlZTcwNTk1MzM0ZjVjYzk4NzU5MzBmN2E3NGZjMSIsImV4cCI6MTg3OTQ4MjA3NiwiaXNzIjoieXNvdWwiLCJzZWxsZXJJZCI6IjIwMDAyMzQ4ODAiLCJzdG9yZUlkIjoiMTY3MjM2OTcyOTYwNiIsInRpbWVzdGFtcCI6MTc4NDc4NzY3NjY2MSwidmVyc2lvbiI6IlYyIn0.3ZzbGAH4cLU1QR2VPEvMOQInUDvus-C4amkINSQIPuNVlXsFKj0sAt1c0KnUy9MWUOFV9cHlkf7J90r2y1FzpA"
      },
      "example": "Bearer eyJhbGciOiJIUzUxMiIsInR5cCI6IkpXVCJ9.eyJhcHBJZCI6MCwiYXBwS2V5IjoiNzU2ZjI1NWE2NjdlZTcwNTk1MzM0ZjVjYzk4NzU5MzBmN2E3NGZjMSIsImV4cCI6MTg3OTQ4MjA3NiwiaXNzIjoieXNvdWwiLCJzZWxsZXJJZCI6IjIwMDAyMzQ4ODAiLCJzdG9yZUlkIjoiMTY3MjM2OTcyOTYwNiIsInRpbWVzdGFtcCI6MTc4NDc4NzY3NjY2MSwidmVyc2lvbiI6IlYyIn0.3ZzbGAH4cLU1QR2VPEvMOQInUDvus-C4amkINSQIPuNVlXsFKj0sAt1c0KnUy9MWUOFV9cHlkf7J90r2y1FzpA"
    }
  ],
  "responses": {
    "200": {
      "description": "For the complete list of codes and messages, see [Http status code](https://developer.shopline.com/docs/apps/api-instructions-for-use/http-status-code.md?lang=en).",
      "headers": {
        "traceId": {
          "description": "A globally unique identifier for the request. It is used to track the request flow throughout the system, allowing for easy location and debugging when issues arise."
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "name": "body",
            "type": "object",
            "properties": {
              "variant": {
                "name": "variant",
                "description": "Variant information.",
                "type": "object",
                "properties": {
                  "price": {
                    "name": "price",
                    "description": "The selling price of the variant. The value is rounded to two decimal places.",
                    "type": "string",
                    "example": "90.22"
                  },
                  "required_shipping": {
                    "name": "required_shipping",
                    "description": "Indicates whether the variant is required to be shipped.\n- `true`: Shipping is required.\n- `false`: Shipping is not required.",
                    "type": "boolean"
                  },
                  "title": {
                    "name": "title",
                    "description": "The title of the variant, assembled from the option value of the variant.",
                    "type": "string",
                    "example": "red · xl"
                  },
                  "barcode": {
                    "name": "barcode",
                    "description": "The barcode of the variant.",
                    "type": "string",
                    "example": "T00000001"
                  },
                  "weight_unit": {
                    "name": "weight_unit",
                    "description": "The unit of weight for the variant. Valid values are:\n- `g`: gram\n- `kg`: kilogram\n- `lb`: pound\n- `oz`: ounce\n- `zh_kg`: kilogram",
                    "type": "string"
                  },
                  "compare_at_price": {
                    "name": "compare_at_price",
                    "description": "The original price of the variant. The value is rounded to two decimal places.",
                    "type": "string",
                    "example": "129.99"
                  },
                  "image": {
                    "name": "image",
                    "description": "The image of the variant.",
                    "type": "object",
                    "properties": {
                      "src": {
                        "name": "src",
                        "description": "The link to the variant image, represented as a URL.",
                        "type": "string",
                        "example": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
                      },
                      "alt": {
                        "name": "alt",
                        "description": "The alternative textual description of the variant image, usually a word or phrase with the characteristics or content of the image.",
                        "type": "string",
                        "example": "This is an image alt."
                      },
                      "id": {
                        "name": "id",
                        "description": "The unique identifier for the variant image.",
                        "type": "string",
                        "example": "5785060242207917075"
                      }
                    },
                    "example": {
                      "id": "5785060242207917075",
                      "src": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png",
                      "alt": "This is an image alt."
                    }
                  },
                  "inventory_policy": {
                    "name": "inventory_policy",
                    "description": "Indicates whether the variant is allowed to be oversold.\n- `deny`: Does not allow overselling.\n- `continue`: Allow overselling.",
                    "type": "string"
                  },
                  "inventory_quantity": {
                    "name": "inventory_quantity",
                    "description": "The total inventory quantity at all storage locations.",
                    "type": "integer",
                    "example": 99
                  },
                  "inventory_tracker": {
                    "name": "inventory_tracker",
                    "description": "Indicates whether the inventory tracking is enabled.\n- ` true`: Inventory tracking is enabled.\n- ` false`: Inventory tracking is not enabled.",
                    "type": "boolean"
                  },
                  "option3": {
                    "name": "option3",
                    "description": "Information of the third option of the variant.",
                    "type": "string",
                    "example": "cotton"
                  },
                  "product_id": {
                    "name": "product_id",
                    "description": "The unique identifier for the product corresponding to the variant.",
                    "type": "string",
                    "example": "16057039432335097907370282"
                  },
                  "id": {
                    "name": "id",
                    "description": "The unique identifier for the variant.",
                    "type": "string",
                    "example": "18057039439794751459380282"
                  },
                  "inventory_item_id": {
                    "name": "inventory_item_id",
                    "description": "The unique identifier for the inventory item.",
                    "type": "string",
                    "example": "5785060242375689228"
                  },
                  "option1": {
                    "name": "option1",
                    "description": "Information of the first option of the variant.",
                    "type": "string",
                    "example": "red"
                  },
                  "option2": {
                    "name": "option2",
                    "description": "Information of the second option of the variant.",
                    "type": "string",
                    "example": "xl"
                  },
                  "option4": {
                    "name": "option4",
                    "description": "Information of the fourth option of the variant.",
                    "type": "string",
                    "example": "short"
                  },
                  "sku": {
                    "name": "sku",
                    "description": "The product SKU. It is distinct from `variant.id` returned by SHOPLINE.",
                    "type": "string",
                    "example": "S0000000001"
                  },
                  "taxable": {
                    "name": "taxable",
                    "description": "Indicates whether the variant is subject to tax.\n- `true`: Tax is required.\n- `false`: Tax is not required.",
                    "type": "boolean"
                  },
                  "weight": {
                    "name": "weight",
                    "description": "The weight of the variant. The value is rounded up if it exceeds two decimal places.",
                    "type": "string",
                    "example": "0.23"
                  },
                  "option5": {
                    "name": "option5",
                    "description": "Information of the fifth option of the variant.",
                    "type": "string",
                    "example": "casual"
                  }
                },
                "example": {
                  "sku": "S0000000001",
                  "id": "18057039439794751459380282",
                  "option1": "red",
                  "option3": "cotton",
                  "option5": "casual",
                  "product_id": "16057039432335097907370282",
                  "title": "red · xl",
                  "weight_unit": null,
                  "inventory_policy": null,
                  "inventory_quantity": 99,
                  "inventory_tracker": null,
                  "required_shipping": null,
                  "taxable": null,
                  "weight": "0.23",
                  "barcode": "T00000001",
                  "compare_at_price": "129.99",
                  "inventory_item_id": "5785060242375689228",
                  "option2": "xl",
                  "image": {
                    "alt": "This is an image alt.",
                    "id": "5785060242207917075",
                    "src": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png"
                  },
                  "option4": "short",
                  "price": "90.22"
                }
              }
            },
            "example": {
              "variant": {
                "barcode": "T00000001",
                "inventory_item_id": "5785060242375689228",
                "required_shipping": null,
                "compare_at_price": "129.99",
                "inventory_policy": null,
                "option5": "casual",
                "taxable": null,
                "weight": "0.23",
                "id": "18057039439794751459380282",
                "inventory_quantity": 99,
                "inventory_tracker": null,
                "option2": "xl",
                "option4": "short",
                "product_id": "16057039432335097907370282",
                "weight_unit": null,
                "image": {
                  "src": "https://img.myshopline.com/image/official/e46e6189dd5641a3b179444cacdcdd2a.png",
                  "alt": "This is an image alt.",
                  "id": "5785060242207917075"
                },
                "option1": "red",
                "option3": "cotton",
                "price": "90.22",
                "sku": "S0000000001",
                "title": "red · xl"
              }
            }
          },
          "examples": {
            "Get all information about a product variant": {
              "description": "Get all information about a product variant.",
              "value": {
                "variant": {
                  "inventory_item_id": "6089530288991379429",
                  "inventory_tracker": true,
                  "option2": "White",
                  "price": "90.00",
                  "taxable": true,
                  "compare_at_price": "99.00",
                  "id": "18060895302863070249743144",
                  "inventory_quantity": 0,
                  "option1": "L",
                  "required_shipping": true,
                  "sku": "S0000001",
                  "title": "L · White",
                  "weight_unit": "kg",
                  "barcode": "T0000001",
                  "image": {
                    "alt": "my image alt",
                    "id": "6089530275430875206",
                    "src": "https://img-va.myshopline.com/image/store/2001026666/1653474941510/e46e6189dd5641a3b179444cacdcdd2a_15.png?w=1024&h=1024"
                  },
                  "inventory_policy": "deny",
                  "weight": "0.20",
                  "product_id": "16060895302856191591063144"
                }
              }
            }
          }
        }
      }
    },
    "401": {
      "headers": {
        "traceId": {
          "description": "A globally unique identifier for the request. It is used to track the request flow throughout the system, allowing for easy location and debugging when issues arise."
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "errors": {
                "description": "Error message. ",
                "type": "string"
              }
            },
            "required": [
              "errors"
            ]
          }
        }
      }
    },
    "429": {
      "headers": {
        "traceId": {
          "description": "A globally unique identifier for the request. It is used to track the request flow throughout the system, allowing for easy location and debugging when issues arise."
        }
      },
      "content": {
        "application/json": {
          "schema": {
            "type": "object",
            "properties": {
              "errors": {
                "description": "Error message. ",
                "type": "string"
              }
            },
            "required": [
              "errors"
            ]
          }
        }
      }
    }
  },
  "security": [
    {
      "oauth2": []
    }
  ],
  "method": "get",
  "path": "/products/variants/:variant_id.json",
  "servers": [
    {
      "url": "https://{handle}.myshopline.com/admin/openapi",
      "variables": {
        "handle": {
          "default": "openapiceshidianpu",
          "description": "`handle` : The store's unique identifier, which is the prefix of the store's domain name. For example, if a store's domain name is `open001.myshopline.com` , the store handle is `open001` ."
        }
      }
    }
  ],
  "info": {
    "title": "Get a product variant ",
    "version": "v20260901"
  },
  "authIndexes": [
    "read_products"
  ]
}
```