> For clean Markdown of any page, append .md to the page URL.
> For a complete documentation index, see https://docs.tiankii.com/llms.txt.
> For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.tiankii.com/_mcp/server.

# Replace modifier

PUT https://api.md.tiankii.com/v1/product-modifiers/{id}
Content-Type: application/json

## Replace modifier

Replaces the modifier `:id`: it updates the `name` and **rebuilds the whole options list** — every existing option is deleted and recreated from the body. This is a full replacement (`PUT`), not a patch.

### Authentication

* Merchant API key in **`x-api-key`** (alias `x-account-api-key`).
* Requires **`Merchant.product.update`**.

### Path params

* `id` — the modifier UUID.

### Body (application/json)

Same shape as create (`CreateModifierDto`): `name` (required) and `options` (required). Each option requires `name` and `price`; `imageUrl` and `enabled` are optional.

### Behavior & side-effects

* If the modifier does not exist or belongs to another store: **400 Bad Request** (`Not Found`).
* `options: { deleteMany: {}, create: [...] }` — the previous options are **destroyed** and new rows (with new UUIDs) are created. Any option id you held before the call is no longer valid.

Returns the updated modifier including its new options.

***

**Notas:** Handler: modifierService.update. Uses the same CreateModifierDto as POST — there is no partial update. Options are wiped and recreated on every call, so option ids change.

Reference: https://docs.tiankii.com/api-reference/tiankii-api-api-key/products/modifiers/replace

## Authentication

- `x-api-key` header (required)

## Request

### Path parameters

- `id` (string, required) — The modifier UUID. Must belong to the authenticated store.

### Headers

- `x-application-account-id` (string, optional) — Scope the request to a specific store / account instead of the one resolved from the API key. Aliases: the `x-account-id` header, or the `application_account_id` / `account_id` query parameter.

### Body (application/json)

- `name` (string, required)
- `options` (list of object, required)
  - `name` (string, required)
  - `price` (integer, required)

## Examples

**Request**

```json
{
  "name": "Coffee Size",
  "options": [
    {
      "name": "Small",
      "price": 1000
    },
    {
      "name": "Large",
      "price": 1500
    }
  ]
}
```

**SDK Code**

```python
import requests

url = "https://api.md.tiankii.com/v1/product-modifiers/a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d"

payload = {
    "name": "Coffee Size",
    "options": [
        {
            "name": "Small",
            "price": 1000
        },
        {
            "name": "Large",
            "price": 1500
        }
    ]
}
headers = {
    "x-application-account-id": "acct_3f9a21c7",
    "x-api-key": "<apiKey>",
    "Content-Type": "application/json"
}

response = requests.put(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.md.tiankii.com/v1/product-modifiers/a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d';
const options = {
  method: 'PUT',
  headers: {
    'x-application-account-id': 'acct_3f9a21c7',
    'x-api-key': '<apiKey>',
    'Content-Type': 'application/json'
  },
  body: '{"name":"Coffee Size","options":[{"name":"Small","price":1000},{"name":"Large","price":1500}]}'
};

try {
  const response = await fetch(url, options);
  const data = await response.json();
  console.log(data);
} catch (error) {
  console.error(error);
}
```

```go
package main

import (
	"fmt"
	"strings"
	"net/http"
	"io"
)

func main() {

	url := "https://api.md.tiankii.com/v1/product-modifiers/a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d"

	payload := strings.NewReader("{\n  \"name\": \"Coffee Size\",\n  \"options\": [\n    {\n      \"name\": \"Small\",\n      \"price\": 1000\n    },\n    {\n      \"name\": \"Large\",\n      \"price\": 1500\n    }\n  ]\n}")

	req, _ := http.NewRequest("PUT", url, payload)

	req.Header.Add("x-application-account-id", "acct_3f9a21c7")
	req.Header.Add("x-api-key", "<apiKey>")
	req.Header.Add("Content-Type", "application/json")

	res, _ := http.DefaultClient.Do(req)

	defer res.Body.Close()
	body, _ := io.ReadAll(res.Body)

	fmt.Println(res)
	fmt.Println(string(body))

}
```

```ruby
require 'uri'
require 'net/http'

url = URI("https://api.md.tiankii.com/v1/product-modifiers/a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d")

http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true

request = Net::HTTP::Put.new(url)
request["x-application-account-id"] = 'acct_3f9a21c7'
request["x-api-key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"name\": \"Coffee Size\",\n  \"options\": [\n    {\n      \"name\": \"Small\",\n      \"price\": 1000\n    },\n    {\n      \"name\": \"Large\",\n      \"price\": 1500\n    }\n  ]\n}"

response = http.request(request)
puts response.read_body
```

```java
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.put("https://api.md.tiankii.com/v1/product-modifiers/a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d")
  .header("x-application-account-id", "acct_3f9a21c7")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Coffee Size\",\n  \"options\": [\n    {\n      \"name\": \"Small\",\n      \"price\": 1000\n    },\n    {\n      \"name\": \"Large\",\n      \"price\": 1500\n    }\n  ]\n}")
  .asString();
```

```php
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('PUT', 'https://api.md.tiankii.com/v1/product-modifiers/a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d', [
  'body' => '{
  "name": "Coffee Size",
  "options": [
    {
      "name": "Small",
      "price": 1000
    },
    {
      "name": "Large",
      "price": 1500
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'x-api-key' => '<apiKey>',
    'x-application-account-id' => 'acct_3f9a21c7',
  ],
]);

echo $response->getBody();
```

```csharp
using RestSharp;

var client = new RestClient("https://api.md.tiankii.com/v1/product-modifiers/a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d");
var request = new RestRequest(Method.PUT);
request.AddHeader("x-application-account-id", "acct_3f9a21c7");
request.AddHeader("x-api-key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"name\": \"Coffee Size\",\n  \"options\": [\n    {\n      \"name\": \"Small\",\n      \"price\": 1000\n    },\n    {\n      \"name\": \"Large\",\n      \"price\": 1500\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "x-application-account-id": "acct_3f9a21c7",
  "x-api-key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "name": "Coffee Size",
  "options": [
    [
      "name": "Small",
      "price": 1000
    ],
    [
      "name": "Large",
      "price": 1500
    ]
  ]
] as [String : Any]

let postData = JSONSerialization.data(withJSONObject: parameters, options: [])

let request = NSMutableURLRequest(url: NSURL(string: "https://api.md.tiankii.com/v1/product-modifiers/a1b2c3d4-e5f6-4a7b-8c9d-0e1f2a3b4c5d")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "PUT"
request.allHTTPHeaderFields = headers
request.httpBody = postData as Data

let session = URLSession.shared
let dataTask = session.dataTask(with: request as URLRequest, completionHandler: { (data, response, error) -> Void in
  if (error != nil) {
    print(error as Any)
  } else {
    let httpResponse = response as? HTTPURLResponse
    print(httpResponse)
  }
})

dataTask.resume()
```