> This page is for API Reference.

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

# Insert/update list of discount families for all stores

POST https://api.fiftytwo.com/masterdata/articlefamilies/v1/chain/{chain}
Content-Type: application/json

Only supported when master data is distributed by the 52ViKING enterprise service.

Reference: https://fiftytwo-demo.ferndocs.com/api/master-data/reference/article-families/ecag

## Request

### Path parameters

- `chain` (integer, required) — The ID of the chain

### Body (application/json)

This endpoint expects an articleFamilies.

- `articleFamilies` (list of ArticleFamiliesArticleFamiliesItems, required)

## Response

### 202

Accepted

## Errors

### 400 Bad Request Error

Bad Request

- `string`

## Types

### ArticleFamiliesArticleFamiliesItems

- `articleFamilyId` (integer, required) — The ID of the discount family.
- `description` (string, optional) — A text that describes the discount family.
- `familyDiscount` (list of ArticleFamiliesArticleFamiliesItemsFamilyDiscountItems, optional) — Definition of the discount family's discount ladder (that can have from one to five steps).
- `discountCode` (integer, optional) — Defines the meaning of the amount field in the familyDiscount ladder. 0 = Amount is the discount given when selling the required quantity of articles. Example: Example: Buy three and save EUR 5.00.1 = Amount is the total price for the required quantity of articles. Example: Buy three for EUR 20.00.2 = Amount is the discount percentage given when buying the required quantity of articles. Example: Buy three and save 10%.3 = Amount is the percentage to pay for the cheapest article. Example: Buy three and pay 30% for the cheapest (so 0 means get the cheapest article for free).
- `discountInSets` (enum, optional) — Defines if the discount should only be triggered each time the required quantity of articles is reached.\<ul>\<li>0 = Minimum buy, discount is triggered for all articles after required quantity is reached.\</li>\<li>1 = Set-wise, discount is triggered for multiplums of the required quantity\</li>\</ul>\<p>Example where required quantity is three and customer buys four articles:\<ul>\<li>discountInSets = 0, discount is given for all four articles.\</li>\<li>discountInSets = 1, discount is only given for three articles.\</ul>\</li>\</p>
  - Allowed values: `0`, `1`
- `discountMaximum` (integer, optional) — The maximum number of articles in the discount family that can be sold on one receipt at the discounted price. When the maximum is exceeded, additional articles are sold with no discount.
- `clubId` (integer, optional) — Defines if discount only applies to members of the club with the defined ID. If 0, the discount applies to everyone, regardless of club membership.
- `receiptTextId` (integer, optional) — If you require a special receipt discount text for use with the discount family, you can specify a reference to the required text. The text must be present in the 52ViKING text segments table with the name RTX_yyy, where yyy is the value of the field. Ask your Fiftytwo consultant if you're in doubt.
- `receiptGroup` (integer, optional) — Print group reference for sorting receipts. Print groups are maintained by Fiftytwo consultants.

### ArticleFamiliesArticleFamiliesItemsFamilyDiscountItems

- `quantity` (integer, optional) — Quantity of articles that customer is required to buy for each step in the discount ladder.
- `amount` (double, optional) — See discountCode in the following for an explanation of this field.

## Examples

**Request**

```json
{
  "articleFamilies": [
    {
      "articleFamilyId": 123,
      "description": "articlefamily 123",
      "familyDiscount": [
        {
          "quantity": 1,
          "amount": 16
        },
        {
          "quantity": 2,
          "amount": 8
        },
        {
          "quantity": 4,
          "amount": 4
        },
        {
          "quantity": 8,
          "amount": 2
        },
        {
          "quantity": 16,
          "amount": 1
        }
      ],
      "discountInSets": 1,
      "discountMaximum": 16,
      "clubId": 1,
      "receiptTextId": 99,
      "receiptGroup": 12
    }
  ]
}
```

**Response**

```json
{}
```

**SDK Code**

```python ArticleFamilies_ECAG_example
import requests

url = "https://api.fiftytwo.com/masterdata/articlefamilies/v1/chain/1"

payload = { "articleFamilies": [
        {
            "articleFamilyId": 123,
            "description": "articlefamily 123",
            "familyDiscount": [
                {
                    "quantity": 1,
                    "amount": 16
                },
                {
                    "quantity": 2,
                    "amount": 8
                },
                {
                    "quantity": 4,
                    "amount": 4
                },
                {
                    "quantity": 8,
                    "amount": 2
                },
                {
                    "quantity": 16,
                    "amount": 1
                }
            ],
            "discountInSets": 1,
            "discountMaximum": 16,
            "clubId": 1,
            "receiptTextId": 99,
            "receiptGroup": 12
        }
    ] }
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript ArticleFamilies_ECAG_example
const url = 'https://api.fiftytwo.com/masterdata/articlefamilies/v1/chain/1';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"articleFamilies":[{"articleFamilyId":123,"description":"articlefamily 123","familyDiscount":[{"quantity":1,"amount":16},{"quantity":2,"amount":8},{"quantity":4,"amount":4},{"quantity":8,"amount":2},{"quantity":16,"amount":1}],"discountInSets":1,"discountMaximum":16,"clubId":1,"receiptTextId":99,"receiptGroup":12}]}'
};

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

```go ArticleFamilies_ECAG_example
package main

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

func main() {

	url := "https://api.fiftytwo.com/masterdata/articlefamilies/v1/chain/1"

	payload := strings.NewReader("{\n  \"articleFamilies\": [\n    {\n      \"articleFamilyId\": 123,\n      \"description\": \"articlefamily 123\",\n      \"familyDiscount\": [\n        {\n          \"quantity\": 1,\n          \"amount\": 16\n        },\n        {\n          \"quantity\": 2,\n          \"amount\": 8\n        },\n        {\n          \"quantity\": 4,\n          \"amount\": 4\n        },\n        {\n          \"quantity\": 8,\n          \"amount\": 2\n        },\n        {\n          \"quantity\": 16,\n          \"amount\": 1\n        }\n      ],\n      \"discountInSets\": 1,\n      \"discountMaximum\": 16,\n      \"clubId\": 1,\n      \"receiptTextId\": 99,\n      \"receiptGroup\": 12\n    }\n  ]\n}")

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

	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 ArticleFamilies_ECAG_example
require 'uri'
require 'net/http'

url = URI("https://api.fiftytwo.com/masterdata/articlefamilies/v1/chain/1")

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

request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n  \"articleFamilies\": [\n    {\n      \"articleFamilyId\": 123,\n      \"description\": \"articlefamily 123\",\n      \"familyDiscount\": [\n        {\n          \"quantity\": 1,\n          \"amount\": 16\n        },\n        {\n          \"quantity\": 2,\n          \"amount\": 8\n        },\n        {\n          \"quantity\": 4,\n          \"amount\": 4\n        },\n        {\n          \"quantity\": 8,\n          \"amount\": 2\n        },\n        {\n          \"quantity\": 16,\n          \"amount\": 1\n        }\n      ],\n      \"discountInSets\": 1,\n      \"discountMaximum\": 16,\n      \"clubId\": 1,\n      \"receiptTextId\": 99,\n      \"receiptGroup\": 12\n    }\n  ]\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.fiftytwo.com/masterdata/articlefamilies/v1/chain/1")
  .header("Content-Type", "application/json")
  .body("{\n  \"articleFamilies\": [\n    {\n      \"articleFamilyId\": 123,\n      \"description\": \"articlefamily 123\",\n      \"familyDiscount\": [\n        {\n          \"quantity\": 1,\n          \"amount\": 16\n        },\n        {\n          \"quantity\": 2,\n          \"amount\": 8\n        },\n        {\n          \"quantity\": 4,\n          \"amount\": 4\n        },\n        {\n          \"quantity\": 8,\n          \"amount\": 2\n        },\n        {\n          \"quantity\": 16,\n          \"amount\": 1\n        }\n      ],\n      \"discountInSets\": 1,\n      \"discountMaximum\": 16,\n      \"clubId\": 1,\n      \"receiptTextId\": 99,\n      \"receiptGroup\": 12\n    }\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.fiftytwo.com/masterdata/articlefamilies/v1/chain/1', [
  'body' => '{
  "articleFamilies": [
    {
      "articleFamilyId": 123,
      "description": "articlefamily 123",
      "familyDiscount": [
        {
          "quantity": 1,
          "amount": 16
        },
        {
          "quantity": 2,
          "amount": 8
        },
        {
          "quantity": 4,
          "amount": 4
        },
        {
          "quantity": 8,
          "amount": 2
        },
        {
          "quantity": 16,
          "amount": 1
        }
      ],
      "discountInSets": 1,
      "discountMaximum": 16,
      "clubId": 1,
      "receiptTextId": 99,
      "receiptGroup": 12
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp ArticleFamilies_ECAG_example
using RestSharp;

var client = new RestClient("https://api.fiftytwo.com/masterdata/articlefamilies/v1/chain/1");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"articleFamilies\": [\n    {\n      \"articleFamilyId\": 123,\n      \"description\": \"articlefamily 123\",\n      \"familyDiscount\": [\n        {\n          \"quantity\": 1,\n          \"amount\": 16\n        },\n        {\n          \"quantity\": 2,\n          \"amount\": 8\n        },\n        {\n          \"quantity\": 4,\n          \"amount\": 4\n        },\n        {\n          \"quantity\": 8,\n          \"amount\": 2\n        },\n        {\n          \"quantity\": 16,\n          \"amount\": 1\n        }\n      ],\n      \"discountInSets\": 1,\n      \"discountMaximum\": 16,\n      \"clubId\": 1,\n      \"receiptTextId\": 99,\n      \"receiptGroup\": 12\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift ArticleFamilies_ECAG_example
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = ["articleFamilies": [
    [
      "articleFamilyId": 123,
      "description": "articlefamily 123",
      "familyDiscount": [
        [
          "quantity": 1,
          "amount": 16
        ],
        [
          "quantity": 2,
          "amount": 8
        ],
        [
          "quantity": 4,
          "amount": 4
        ],
        [
          "quantity": 8,
          "amount": 2
        ],
        [
          "quantity": 16,
          "amount": 1
        ]
      ],
      "discountInSets": 1,
      "discountMaximum": 16,
      "clubId": 1,
      "receiptTextId": 99,
      "receiptGroup": 12
    ]
  ]] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://api.fiftytwo.com/masterdata/articlefamilies/v1/chain/1")! 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()
```