> 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 departments for all stores

POST https://api.fiftytwo.com/masterdata/departments/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/departments/ecdp

## Request

### Path parameters

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

### Body (application/json)

This endpoint expects a departments.

- `departments` (list of DepartmentsDepartmentsItems, required)

## Response

### 202

Accepted

## Errors

### 400 Bad Request Error

Bad Request

- `string`

## Types

### DepartmentsDepartmentsItems

- `departmentId` (integer, required) — The ID of the department.
- `description` (string, optional) — Short text information about the department.
- `account` (string, optional) — Account to use for on accounting journals relating to the department.
- `vatCode` (integer, optional) — Used for the following purposes:Deduction of VAT for export salesRecalculation of price in case of VAT changesSpecification of VAT for special customersCalculation of gross profit on departments
- `variantIds` (list of integer, optional) — A list of variant groups that this department uses. Each ID refers to a variant such as Color or Size. Adding a variant here makes it available for all articles belonging to this department.
- `modifierIds` (list of integer, optional) — A list of modifier groups available within this department. Modifiers represent optional add-ons—such as gift wrapping or extra components—that can be selected when handling articles in this department.
- `specificationIds` (list of integer, optional) — A list of specification groups relevant to this department. Specifications describe product features or technical attributes, such as display type or performance characteristics.

## Examples

**Request**

```json
{
  "departments": [
    {
      "departmentId": 10,
      "description": "department 10",
      "account": "1234567890",
      "vatCode": 2,
      "variantIds": [
        201,
        202
      ],
      "modifierIds": [
        301,
        302
      ],
      "specificationIds": [
        401
      ]
    },
    {
      "departmentId": 11,
      "description": "department 11",
      "account": "0987654321",
      "vatCode": 3,
      "variantIds": [
        203
      ],
      "modifierIds": [
        303,
        304
      ],
      "specificationIds": [
        402,
        403
      ]
    }
  ]
}
```

**Response**

```json
{}
```

**SDK Code**

```python Departments_ECDP_example
import requests

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

payload = { "departments": [
        {
            "departmentId": 10,
            "description": "department 10",
            "account": "1234567890",
            "vatCode": 2,
            "variantIds": [201, 202],
            "modifierIds": [301, 302],
            "specificationIds": [401]
        },
        {
            "departmentId": 11,
            "description": "department 11",
            "account": "0987654321",
            "vatCode": 3,
            "variantIds": [203],
            "modifierIds": [303, 304],
            "specificationIds": [402, 403]
        }
    ] }
headers = {"Content-Type": "application/json"}

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

print(response.json())
```

```javascript Departments_ECDP_example
const url = 'https://api.fiftytwo.com/masterdata/departments/v1/chain/1';
const options = {
  method: 'POST',
  headers: {'Content-Type': 'application/json'},
  body: '{"departments":[{"departmentId":10,"description":"department 10","account":"1234567890","vatCode":2,"variantIds":[201,202],"modifierIds":[301,302],"specificationIds":[401]},{"departmentId":11,"description":"department 11","account":"0987654321","vatCode":3,"variantIds":[203],"modifierIds":[303,304],"specificationIds":[402,403]}]}'
};

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

```go Departments_ECDP_example
package main

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

func main() {

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

	payload := strings.NewReader("{\n  \"departments\": [\n    {\n      \"departmentId\": 10,\n      \"description\": \"department 10\",\n      \"account\": \"1234567890\",\n      \"vatCode\": 2,\n      \"variantIds\": [\n        201,\n        202\n      ],\n      \"modifierIds\": [\n        301,\n        302\n      ],\n      \"specificationIds\": [\n        401\n      ]\n    },\n    {\n      \"departmentId\": 11,\n      \"description\": \"department 11\",\n      \"account\": \"0987654321\",\n      \"vatCode\": 3,\n      \"variantIds\": [\n        203\n      ],\n      \"modifierIds\": [\n        303,\n        304\n      ],\n      \"specificationIds\": [\n        402,\n        403\n      ]\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 Departments_ECDP_example
require 'uri'
require 'net/http'

url = URI("https://api.fiftytwo.com/masterdata/departments/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  \"departments\": [\n    {\n      \"departmentId\": 10,\n      \"description\": \"department 10\",\n      \"account\": \"1234567890\",\n      \"vatCode\": 2,\n      \"variantIds\": [\n        201,\n        202\n      ],\n      \"modifierIds\": [\n        301,\n        302\n      ],\n      \"specificationIds\": [\n        401\n      ]\n    },\n    {\n      \"departmentId\": 11,\n      \"description\": \"department 11\",\n      \"account\": \"0987654321\",\n      \"vatCode\": 3,\n      \"variantIds\": [\n        203\n      ],\n      \"modifierIds\": [\n        303,\n        304\n      ],\n      \"specificationIds\": [\n        402,\n        403\n      ]\n    }\n  ]\n}"

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

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

HttpResponse<String> response = Unirest.post("https://api.fiftytwo.com/masterdata/departments/v1/chain/1")
  .header("Content-Type", "application/json")
  .body("{\n  \"departments\": [\n    {\n      \"departmentId\": 10,\n      \"description\": \"department 10\",\n      \"account\": \"1234567890\",\n      \"vatCode\": 2,\n      \"variantIds\": [\n        201,\n        202\n      ],\n      \"modifierIds\": [\n        301,\n        302\n      ],\n      \"specificationIds\": [\n        401\n      ]\n    },\n    {\n      \"departmentId\": 11,\n      \"description\": \"department 11\",\n      \"account\": \"0987654321\",\n      \"vatCode\": 3,\n      \"variantIds\": [\n        203\n      ],\n      \"modifierIds\": [\n        303,\n        304\n      ],\n      \"specificationIds\": [\n        402,\n        403\n      ]\n    }\n  ]\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://api.fiftytwo.com/masterdata/departments/v1/chain/1', [
  'body' => '{
  "departments": [
    {
      "departmentId": 10,
      "description": "department 10",
      "account": "1234567890",
      "vatCode": 2,
      "variantIds": [
        201,
        202
      ],
      "modifierIds": [
        301,
        302
      ],
      "specificationIds": [
        401
      ]
    },
    {
      "departmentId": 11,
      "description": "department 11",
      "account": "0987654321",
      "vatCode": 3,
      "variantIds": [
        203
      ],
      "modifierIds": [
        303,
        304
      ],
      "specificationIds": [
        402,
        403
      ]
    }
  ]
}',
  'headers' => [
    'Content-Type' => 'application/json',
  ],
]);

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

```csharp Departments_ECDP_example
using RestSharp;

var client = new RestClient("https://api.fiftytwo.com/masterdata/departments/v1/chain/1");
var request = new RestRequest(Method.POST);
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"departments\": [\n    {\n      \"departmentId\": 10,\n      \"description\": \"department 10\",\n      \"account\": \"1234567890\",\n      \"vatCode\": 2,\n      \"variantIds\": [\n        201,\n        202\n      ],\n      \"modifierIds\": [\n        301,\n        302\n      ],\n      \"specificationIds\": [\n        401\n      ]\n    },\n    {\n      \"departmentId\": 11,\n      \"description\": \"department 11\",\n      \"account\": \"0987654321\",\n      \"vatCode\": 3,\n      \"variantIds\": [\n        203\n      ],\n      \"modifierIds\": [\n        303,\n        304\n      ],\n      \"specificationIds\": [\n        402,\n        403\n      ]\n    }\n  ]\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Departments_ECDP_example
import Foundation

let headers = ["Content-Type": "application/json"]
let parameters = ["departments": [
    [
      "departmentId": 10,
      "description": "department 10",
      "account": "1234567890",
      "vatCode": 2,
      "variantIds": [201, 202],
      "modifierIds": [301, 302],
      "specificationIds": [401]
    ],
    [
      "departmentId": 11,
      "description": "department 11",
      "account": "0987654321",
      "vatCode": 3,
      "variantIds": [203],
      "modifierIds": [303, 304],
      "specificationIds": [402, 403]
    ]
  ]] as [String : Any]

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

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