Save Discount
save_discountCreate or edit a catalog discount, as the Discounts page does. Omit discountId to create (name, type and discountPercentage required); pass it to edit, where every omitted field keeps its value and a supplied items/brandIds/categoryIds list replaces the old one. type: general (everyone), coupon (couponCode required, unique) or business (businessDiscountGroupId from list_discounts). validFrom and validUntil are YYYY-MM-DD days in the tenant's calendar and both are included: validUntil is the last day the discount applies. validFrom defaults to today. Limits are ANDed: an item must match every non-empty list. The preview shows the discount, what changes and how many items it matches; affected items' discounted prices update on commit. Requires an operator (unpinned) credential.
Tool call template
Replace each placeholder with a value matching the input schema. Only required parameters are included; add optional parameters as needed.
{
"id": 1,
"jsonrpc": "2.0",
"method": "tools/call",
"params": {
"arguments": {
"input": "<input>"
},
"name": "save_discount"
}
}Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| input | Yes | The discount fields to set. | |
| preview | No | Step 1 of the required two-step write: set true to validate and receive a structured preview plus a single-use previewReceipt. Nothing changes until the commit call. | |
| discountId | No | The discount id (GUID) to edit; omit to create. | |
| idempotencyKey | No | Caller-generated idempotency key; required with previewReceipt to commit. | |
| previewReceipt | No | Step 2 of the required two-step write: the receipt returned by the preview call. Supply together with a fresh idempotencyKey to commit; calls without it are refused. |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| ok | No | ||
| deleted | No | ||
| preview | No | ||
| discount | No | ||
| expiresAt | No | ||
| actionItemId | No | ||
| confirmation | No | ||
| correlationId | No | ||
| approvalResult | No | ||
| idempotencyKey | No | ||
| previewReceipt | No | ||
| idempotentReplay | No |