# Update product variant

`PUT /api/v1/Tenants/{tenantId}/Products/{productId}/variants/{variantId}`

Core API · Products · base URL `https://core-api.ancon.io` · auth: `Access-Token` header · docs: https://ancon.dev/api/core/products/update-product-variant

## Path parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `tenantId` | string (uuid) | yes |  |
| `productId` | string (uuid) | yes |  |
| `variantId` | string (uuid) | yes |  |

## Header parameters

| Name | Type | Required | Description |
| --- | --- | --- | --- |
| `correlationId` | string | no | Correlation Id for the request |

## Request body

Content type: `application/json`

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `name` | string | yes |  |
| `isMainProductVariant` | boolean | yes |  |
| `isOpenPrice` | boolean | yes |  |
| `variantPrice` | object | yes |  |
| `variantPrice.unitPrice` | number (double) | no | Gets or sets the price per unit. For example 10 per piece. Or 50 per cl. It depends on the unit of the product. |
| `variantPrice.additionalPrice` | number (double) | no | Gets or sets the additional price. For example 50 per cl + 10 additional price. |
| `materialCost` | object or null | no |  |
| `materialCost.unitPrice` | number (double) | no | Gets or sets the price per unit. For example 10 per piece. Or 50 per cl. It depends on the unit of the product. |
| `materialCost.additionalPrice` | number (double) | no | Gets or sets the additional price. For example 50 per cl + 10 additional price. |
| `position` | integer (int32) | yes |  |

### Example (from schema)

```json
{
  "name": "string",
  "isMainProductVariant": true,
  "isOpenPrice": true,
  "variantPrice": {
    "unitPrice": 0,
    "additionalPrice": 0
  },
  "materialCost": {
    "unitPrice": 0,
    "additionalPrice": 0
  },
  "position": 0
}
```

## Responses

| Status | Description |
| --- | --- |
| 200 | OK |
| 400 | Bad Request |
| 401 | Unauthorized |
| 404 | Not Found |
| 423 | Locked |

### 200 response (`application/json`)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `message` | string or null | no |  |

#### Example (from schema)

```json
{
  "message": "string"
}
```

### 400 response (`application/json`)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `message` | string or null | no |  |
| `errorCode` | string (uuid) | no |  |
| `additionalData` | any or null | no |  |

#### Delivery request is not valid

```json
{
  "message": "Delivery information is not valid!",
  "errorCode": "41fcedd1-dfef-4d0d-a5b3-2e28da7dfc9a",
  "additionalData": null
}
```

### 401 response (`application/json`)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `message` | string or null | no |  |

#### Example (from schema)

```json
{
  "message": "string"
}
```

### 404 response (`application/json`)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `message` | string or null | no |  |
| `errorCode` | string (uuid) | no |  |

#### Example (from schema)

```json
{
  "message": "string",
  "errorCode": "3fa85f64-5717-4562-b3fc-2c963f66afa6"
}
```

### 423 response (`application/json`)

| Field | Type | Required | Description |
| --- | --- | --- | --- |
| `objectId` | string (uuid) | no |  |
| `objectType` | string or null | no |  |
| `timeout` | string or null | no |  |
| `reason` | string or null | no |  |

#### Example (from schema)

```json
{
  "objectId": "3fa85f64-5717-4562-b3fc-2c963f66afa6",
  "objectType": "string",
  "timeout": "string",
  "reason": "string"
}
```

## Example request

```bash
curl -X PUT "https://core-api.ancon.io/api/v1/Tenants/{tenantId}/Products/{productId}/variants/{variantId}" \
  -H "Access-Token: $ANCON_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{
  "name": "string",
  "isMainProductVariant": true,
  "isOpenPrice": true,
  "variantPrice": {
    "unitPrice": 0,
    "additionalPrice": 0
  },
  "materialCost": {
    "unitPrice": 0,
    "additionalPrice": 0
  },
  "position": 0
}'
```
