> 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.

# Create modifier

POST https://api.md.tiankii.com/v1/product-modifiers
Content-Type: application/json

## Create modifier

Creates a **modifier** (a variation or extra applied to products: size, ingredients, add-ons…) together with its options, scoped to the authenticated merchant's store. The `storeId` is taken from the API key context and a UUID `id` is generated server-side for the modifier and for every option.

### Authentication
- Send the merchant API key in the **`x-api-key`** header (alias `x-account-api-key`).
- Requires the scope: **`Merchant.product.create`**.
- Optionally scope the key with **`x-application-account-id`** (alias `x-account-id`) or the `application_account_id` / `account_id` query param.

### Body (application/json)
- `name` (required) — modifier name, max 50 chars.
- `options` (required) — array of options. Each option requires `name` (max 50 chars) and `price` (in SATS); `imageUrl` and `enabled` are optional.

Returns the created modifier record.

---
**Notas:** Handler: modifierService.create. `options` is @IsDefined + @IsArray, so it must be present (an empty array is accepted by validation). Options are created through a nested createMany; each option gets a server-generated UUID. Optional option fields: imageUrl, enabled.

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

## Authentication

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

## Request

### 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"

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.post(url, json=payload, headers=headers)

print(response.json())
```

```javascript
const url = 'https://api.md.tiankii.com/v1/product-modifiers';
const options = {
  method: 'POST',
  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"

	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("POST", 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")

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

request = Net::HTTP::Post.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.post("https://api.md.tiankii.com/v1/product-modifiers")
  .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('POST', 'https://api.md.tiankii.com/v1/product-modifiers', [
  '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");
var request = new RestRequest(Method.POST);
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")! as URL,
                                        cachePolicy: .useProtocolCachePolicy,
                                    timeoutInterval: 10.0)
request.httpMethod = "POST"
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()
```