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

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

## Create product

Creates a new product under the authenticated merchant's store. Optionally links the product to existing apps (POS/store apps) and modifiers in the same store.

### Authentication

Requires a Merchant API key sent in the `x-api-key` header (alias `x-account-api-key`). The key must carry the `Merchant.product.create` scope.

To scope the key to a specific store/account you may also send the optional `x-application-account-id` header (alias `x-account-id`) or the `application_account_id` / `account_id` query param.

### Body

JSON body (`application/json`) described by `CreateProductDto`:

* `name` (required) — product name, max 200 chars.
* `description` (optional) — max 255 chars.
* `imageUrl` (optional) — product image URL.
* `sku` (optional) — unique SKU; when supplied it must be globally unique or the request fails with 400.
* `price` (required) — price in SATS; must be a positive number.
* `productCategoryId` (optional) — UUID of an existing product category.
* `appsIds` (optional) — array of unique app IDs to link; every ID must belong to your store.
* `modifiersIds` (optional) — array of unique modifier UUIDs to link; every ID must belong to your store.

### Side effects & status

* Validates SKU uniqueness (400 `The SKU '<sku>' is already in use.` if taken).
* Creates the product, then in a transaction creates `productApps` and `productModifiers` join rows for the supplied IDs.
* If any supplied app or modifier does not belong to your store, responds 403 `Some apps do not belong to your store` / `Some modifiers do not belong to your store` (the product row may already have been created before this validation).

Returns a simple confirmation message, not the created entity.

***

**Notas:** Only `name` and `price` are required (`sku` is @IsOptionalString in CreateProductDto). Returns only a confirmation message, not the created product. SKU uniqueness is enforced globally (unique column). App/modifier ownership is validated against the caller's store; note the product row is created before the join-table ownership checks run, so a 403 can occur after the product already exists.

Reference: https://docs.tiankii.com/api-reference/tiankii-api-api-key/products/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)
- `price` (integer, required)

## Examples

**Request**

```json
{
  "name": "Espresso Coffee",
  "price": 1236
}
```

**SDK Code**

```python
import requests

url = "https://api.md.tiankii.com/v1/products"

payload = {
    "name": "Espresso Coffee",
    "price": 1236
}
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/products';
const options = {
  method: 'POST',
  headers: {
    'x-application-account-id': 'acct_3f9a21c7',
    'x-api-key': '<apiKey>',
    'Content-Type': 'application/json'
  },
  body: '{"name":"Espresso Coffee","price":1236}'
};

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/products"

	payload := strings.NewReader("{\n  \"name\": \"Espresso Coffee\",\n  \"price\": 1236\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/products")

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\": \"Espresso Coffee\",\n  \"price\": 1236\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/products")
  .header("x-application-account-id", "acct_3f9a21c7")
  .header("x-api-key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"name\": \"Espresso Coffee\",\n  \"price\": 1236\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.md.tiankii.com/v1/products', [
  'body' => '{
  "name": "Espresso Coffee",
  "price": 1236
}',
  '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/products");
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\": \"Espresso Coffee\",\n  \"price\": 1236\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": "Espresso Coffee",
  "price": 1236
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.md.tiankii.com/v1/products")! 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()
```