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

# Update Variant

> Update an existing variant

<Note>
  There is **no per-variant update endpoint on the OAuth App API** (`/api/v1/`).

  * For the **first** variant only, an installed app can update `price`,
    `compare_at_price`, and `inventory_quantity` through
    [`PUT /api/v1/products/{id}.json`](/api-reference/products/update) by
    passing a `variants[0]` object — those values are mirrored onto the
    product. Per-variant attributes (option value, SKU, weight, image) are
    **not** addressable that way.
  * To update an arbitrary variant by ID, use the **merchant admin** route
    documented here (`PATCH /variants/update-single-variant/{id}`). It is also
    what the MCP `update_variant` tool calls.
</Note>

## Authentication

Merchant JWT (`Authorization: Bearer <merchant-token>`); roles
`MERCHANT`, `STAFF_ADMIN`, `SUPER_ADMIN`, or `MANAGER`.

## Request Format

`Content-Type: multipart/form-data`. A variant image may be attached as the
`mainImage` file field; all other fields are sent as form fields.

## Path Parameters

<ParamField path="id" type="string" required>
  The variant ID to update
</ParamField>

## Body Parameters

All fields are optional — send only what you want to change.

<ParamField body="name" type="string">
  Option name (e.g. "Size")
</ParamField>

<ParamField body="value" type="string">
  Option value (e.g. "Medium")
</ParamField>

<ParamField body="price" type="number">
  Variant price
</ParamField>

<ParamField body="discountPrice" type="number">
  Discounted / sale price
</ParamField>

<ParamField body="stock" type="number">
  Stock quantity
</ParamField>

<ParamField body="stockStatus" type="string">
  Stock status (e.g. `IN_STOCK`)
</ParamField>

<ParamField body="skuId" type="string">
  SKU
</ParamField>

<ParamField body="weight" type="number">
  Weight
</ParamField>

<ParamField body="weightUnit" type="string">
  Weight unit (`g`, `kg`, `lb`, `oz`)
</ParamField>

<ParamField body="mainImage" type="file">
  Variant image (multipart file field). When supplied it is uploaded and the
  resulting URL is stored as `mainImageUrl`.
</ParamField>

## Response

The platform response envelope is `{ status, state, message, data }`, where
`data` is the updated variant record.

<ResponseExample>
  ```json theme={null}
  {
    "status": 200,
    "state": "success",
    "message": null,
    "data": {
      "varientId": "8f1c2d34-...",
      "productId": "prod_xyz789",
      "name": "Size",
      "value": "Medium",
      "price": 24.99,
      "discountPrice": 24.99,
      "stock": 75,
      "stockStatus": "IN_STOCK",
      "skuId": "TSHIRT-RED-M-UPDATED",
      "weight": 0.2,
      "weightUnit": "kg",
      "mainImageUrl": "https://assets.launchmystore.io/...",
      "updatedAt": "2024-01-25T10:30:00.000Z"
    }
  }
  ```
</ResponseExample>

<Note>
  If the variant is not found the endpoint returns `status: 400`,
  `state: "error"`, `message: "Variant Not Found"`.
</Note>
