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

# Dávková synchronizácia produktov

POST https://segat-test.webland.sk/api/v1/elall/products/sync
Content-Type: application/json

Odošle do 5000 položiek v jednom requeste (minimum z MAX_SYNC_PRODUCTS a MAX_CATALOG_SYNC_PRODUCTS). Vhodné pre hromadné exporty, výdajky alebo kritické syncy. Identifikátor každej položky: **stock_code** (povinný) a voliteľný **ean** (lookup v `product_catalog`). `segat_quantity` je **absolútny** stav skladu Segat po doklade, nie delta. Neznámy kľúč sa uloží do `pending_products` a vráti sa v `unknown_products`. Duplicitný kľúč v jednom batchi → 400. Retry pri chybe: rovnaké `request_id`.

Reference: https://docs.elall.webland.sk/api/products/sync

## Authentication

- `X-API-Key` header (required) — Hodnota premennej prostredia ELALL_API_KEY na strane Segat Sync.

## Request

### Headers

- `X-API-Key` (string, required)

### Body (application/json)

This endpoint expects an ElallSyncRequest.

- `products` (list of ElallProductItem, required)
- `request_id` (string, optional, nullable)
- `sync_context` (ElallSyncContext, optional, nullable) — Dôvod / kontext syncu na úrovni requestu (príjemka, výdajka, …).

## Response

### 200

Successful Response

- `success` (boolean, required)
- `products_received` (integer, required)
- `products_updated` (integer, required)
- `request_id` (string, optional, nullable)
- `unknown_products` (integer, optional, default: 0)

## Errors

### 400 Bad Request Error

Neplatný request (príliš veľa položiek, duplicitný kľúč, validácia polí)

- `any`

### 401 Unauthorized Error

Neplatný alebo chýbajúci X-API-Key

- `any`

### 422 Unprocessable Entity Error

Chýba alebo je prázdny stock_code

- `any`

## Types

### ElallProductItem

Položka v dávkovom sync — bez interného item_id (resolve cez ean + stock_code).

- `stock_code` (string, required) — Skladové číslo z Elall — povinný identifikátor (s EAN tvorí kompozitný kľúč).
- `status` (string, required)
- `segat_quantity` (integer, required)
- `catalog_price` (double, required) — Cenníková / listová cena
- `eshop_price` (double, required) — E-shop cena
- `ean` (string, optional, nullable) — EAN — voliteľný. Ak je uvedený, lookup je podľa páru (ean, stock_code); ak chýba alebo je prázdny, lookup je len podľa stock_code.
- `name` (string, optional, nullable)
- `section_width_mm` (string, optional, nullable) — Šírka (mm) — číslo alebo ľubovoľný reťazec z exportu (napr. 215, P245, 30X9.5).
- `aspect_ratio` (string, optional, nullable) — Profil — číslo alebo ľubovoľný reťazec z exportu (napr. 55, 50Z, 31X10.5).
- `rim_inch` (string, optional, nullable) — Priemer ráfika v palcoch (ETRTO). Môže byť číslo (napr. 16), s prefixom R (napr. R21) alebo záporná hodnota (napr. -16).
- `tread_name` (string, optional, nullable) — Názov dezénu
- `name_suffix` (string, optional, nullable) — Doplnok k názvu (variant, ročník, marketingový text).
- `load_index` (string, optional, nullable)
- `speed_index` (string, optional, nullable)
- `special_marking` (string, optional, nullable) — Špeciálne označenie
- `run_on_flat` (boolean, optional, nullable) — ROF
- `brand` (string, optional, nullable) — Výrobca / značka
- `usage` (string, optional, nullable) — Trieda použitia plášťa (napr. osobné, SUV, ľahký úžitkový).
- `season` (string, optional, nullable) — Sezónnosť plášťa — ľubovoľný reťazec (max 32 znakov), bez validácie enumu. Bežné hodnoty napr. summer / winter / all_season, ale aj kódy dodávateľa, lokalizované texty (letná, zimná) alebo skratky podľa vášho katalógu.
- `on_promotion` (boolean, optional, nullable) — Akcia
- `on_clearance` (boolean, optional, nullable) — Výpredaj / clearance (ostatné zásoby).
- `dot_code` (string, optional, nullable) — DOT
- `weight_kg` (ElallProductItemWeightKg, optional, nullable) — Hmotnosť plášťa v kg (technický list, EU štítok).
- `discontinued` (boolean, optional, nullable) — Nepoužívať / nevyrába sa
- `eu_label` (string, optional, nullable) — EU štítok

### ElallSyncContext

Dôvod / kontext syncu na úrovni requestu (príjemka, výdajka, …).

- `source_type` (enum, required)
  - Allowed values: `stock_receipt`, `stock_issue`, `customer_sale`, `catalog_sync`, `stock_adjustment`, `manual`, `scheduled`, `other`
- `source_ref` (string, optional, nullable)
- `note` (string, optional, nullable)
- `actor` (string, optional, nullable)

### ElallProductItemWeightKg

Hmotnosť plášťa v kg (technický list, EU štítok).

## Examples

### Katalóg — rim_inch ako reťazec

**Request**

```json
{
  "products": [
    {
      "stock_code": "ELALL-SKU-001",
      "status": "active",
      "segat_quantity": 10,
      "catalog_price": 129.9,
      "eshop_price": 119,
      "ean": "5452000792440",
      "name": "205/55 R16 91V",
      "section_width_mm": "205",
      "aspect_ratio": "55",
      "rim_inch": "R21"
    }
  ],
  "request_id": "CATALOG-2025-001",
  "sync_context": {
    "source_type": "catalog_sync",
    "source_ref": "initial-import"
  }
}
```

**Response**

```json
{
  "success": true,
  "products_received": 1,
  "products_updated": 1,
  "request_id": "string",
  "unknown_products": 0
}
```

**SDK Code**

```python Katalóg — rim_inch ako reťazec
import requests

url = "https://segat-test.webland.sk/api/v1/elall/products/sync"

payload = {
    "products": [
        {
            "stock_code": "ELALL-SKU-001",
            "status": "active",
            "segat_quantity": 10,
            "catalog_price": 129.9,
            "eshop_price": 119,
            "ean": "5452000792440",
            "name": "205/55 R16 91V",
            "section_width_mm": "205",
            "aspect_ratio": "55",
            "rim_inch": "R21"
        }
    ],
    "request_id": "CATALOG-2025-001",
    "sync_context": {
        "source_type": "catalog_sync",
        "source_ref": "initial-import"
    }
}
headers = {
    "X-API-Key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript Katalóg — rim_inch ako reťazec
const url = 'https://segat-test.webland.sk/api/v1/elall/products/sync';
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"products":[{"stock_code":"ELALL-SKU-001","status":"active","segat_quantity":10,"catalog_price":129.9,"eshop_price":119,"ean":"5452000792440","name":"205/55 R16 91V","section_width_mm":"205","aspect_ratio":"55","rim_inch":"R21"}],"request_id":"CATALOG-2025-001","sync_context":{"source_type":"catalog_sync","source_ref":"initial-import"}}'
};

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

```go Katalóg — rim_inch ako reťazec
package main

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

func main() {

	url := "https://segat-test.webland.sk/api/v1/elall/products/sync"

	payload := strings.NewReader("{\n  \"products\": [\n    {\n      \"stock_code\": \"ELALL-SKU-001\",\n      \"status\": \"active\",\n      \"segat_quantity\": 10,\n      \"catalog_price\": 129.9,\n      \"eshop_price\": 119,\n      \"ean\": \"5452000792440\",\n      \"name\": \"205/55 R16 91V\",\n      \"section_width_mm\": \"205\",\n      \"aspect_ratio\": \"55\",\n      \"rim_inch\": \"R21\"\n    }\n  ],\n  \"request_id\": \"CATALOG-2025-001\",\n  \"sync_context\": {\n    \"source_type\": \"catalog_sync\",\n    \"source_ref\": \"initial-import\"\n  }\n}")

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

	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 Katalóg — rim_inch ako reťazec
require 'uri'
require 'net/http'

url = URI("https://segat-test.webland.sk/api/v1/elall/products/sync")

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

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"products\": [\n    {\n      \"stock_code\": \"ELALL-SKU-001\",\n      \"status\": \"active\",\n      \"segat_quantity\": 10,\n      \"catalog_price\": 129.9,\n      \"eshop_price\": 119,\n      \"ean\": \"5452000792440\",\n      \"name\": \"205/55 R16 91V\",\n      \"section_width_mm\": \"205\",\n      \"aspect_ratio\": \"55\",\n      \"rim_inch\": \"R21\"\n    }\n  ],\n  \"request_id\": \"CATALOG-2025-001\",\n  \"sync_context\": {\n    \"source_type\": \"catalog_sync\",\n    \"source_ref\": \"initial-import\"\n  }\n}"

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

```java Katalóg — rim_inch ako reťazec
import com.mashape.unirest.http.HttpResponse;
import com.mashape.unirest.http.Unirest;

HttpResponse<String> response = Unirest.post("https://segat-test.webland.sk/api/v1/elall/products/sync")
  .header("X-API-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"products\": [\n    {\n      \"stock_code\": \"ELALL-SKU-001\",\n      \"status\": \"active\",\n      \"segat_quantity\": 10,\n      \"catalog_price\": 129.9,\n      \"eshop_price\": 119,\n      \"ean\": \"5452000792440\",\n      \"name\": \"205/55 R16 91V\",\n      \"section_width_mm\": \"205\",\n      \"aspect_ratio\": \"55\",\n      \"rim_inch\": \"R21\"\n    }\n  ],\n  \"request_id\": \"CATALOG-2025-001\",\n  \"sync_context\": {\n    \"source_type\": \"catalog_sync\",\n    \"source_ref\": \"initial-import\"\n  }\n}")
  .asString();
```

```php Katalóg — rim_inch ako reťazec
<?php
require_once('vendor/autoload.php');

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://segat-test.webland.sk/api/v1/elall/products/sync', [
  'body' => '{
  "products": [
    {
      "stock_code": "ELALL-SKU-001",
      "status": "active",
      "segat_quantity": 10,
      "catalog_price": 129.9,
      "eshop_price": 119,
      "ean": "5452000792440",
      "name": "205/55 R16 91V",
      "section_width_mm": "205",
      "aspect_ratio": "55",
      "rim_inch": "R21"
    }
  ],
  "request_id": "CATALOG-2025-001",
  "sync_context": {
    "source_type": "catalog_sync",
    "source_ref": "initial-import"
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-Key' => '<apiKey>',
  ],
]);

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

```csharp Katalóg — rim_inch ako reťazec
using RestSharp;

var client = new RestClient("https://segat-test.webland.sk/api/v1/elall/products/sync");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"products\": [\n    {\n      \"stock_code\": \"ELALL-SKU-001\",\n      \"status\": \"active\",\n      \"segat_quantity\": 10,\n      \"catalog_price\": 129.9,\n      \"eshop_price\": 119,\n      \"ean\": \"5452000792440\",\n      \"name\": \"205/55 R16 91V\",\n      \"section_width_mm\": \"205\",\n      \"aspect_ratio\": \"55\",\n      \"rim_inch\": \"R21\"\n    }\n  ],\n  \"request_id\": \"CATALOG-2025-001\",\n  \"sync_context\": {\n    \"source_type\": \"catalog_sync\",\n    \"source_ref\": \"initial-import\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift Katalóg — rim_inch ako reťazec
import Foundation

let headers = [
  "X-API-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "products": [
    [
      "stock_code": "ELALL-SKU-001",
      "status": "active",
      "segat_quantity": 10,
      "catalog_price": 129.9,
      "eshop_price": 119,
      "ean": "5452000792440",
      "name": "205/55 R16 91V",
      "section_width_mm": "205",
      "aspect_ratio": "55",
      "rim_inch": "R21"
    ]
  ],
  "request_id": "CATALOG-2025-001",
  "sync_context": [
    "source_type": "catalog_sync",
    "source_ref": "initial-import"
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://segat-test.webland.sk/api/v1/elall/products/sync")! 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()
```

### Example 2

**Request**

```json
{
  "products": [
    {
      "stock_code": "ELALL-SKU-001",
      "status": "active",
      "segat_quantity": 48,
      "catalog_price": 129.9,
      "eshop_price": 119,
      "ean": "5452000792440"
    }
  ],
  "request_id": "PR-2025-00123",
  "sync_context": {
    "source_type": "stock_receipt",
    "source_ref": "PR-2025-00123",
    "note": "Chunk 1/2"
  }
}
```

**Response**

```json
{
  "success": true,
  "products_received": 1,
  "products_updated": 1,
  "request_id": "string",
  "unknown_products": 0
}
```

**SDK Code**

```python
import requests

url = "https://segat-test.webland.sk/api/v1/elall/products/sync"

payload = {
    "products": [
        {
            "stock_code": "ELALL-SKU-001",
            "status": "active",
            "segat_quantity": 48,
            "catalog_price": 129.9,
            "eshop_price": 119,
            "ean": "5452000792440"
        }
    ],
    "request_id": "PR-2025-00123",
    "sync_context": {
        "source_type": "stock_receipt",
        "source_ref": "PR-2025-00123",
        "note": "Chunk 1/2"
    }
}
headers = {
    "X-API-Key": "<apiKey>",
    "Content-Type": "application/json"
}

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

print(response.json())
```

```javascript
const url = 'https://segat-test.webland.sk/api/v1/elall/products/sync';
const options = {
  method: 'POST',
  headers: {'X-API-Key': '<apiKey>', 'Content-Type': 'application/json'},
  body: '{"products":[{"stock_code":"ELALL-SKU-001","status":"active","segat_quantity":48,"catalog_price":129.9,"eshop_price":119,"ean":"5452000792440"}],"request_id":"PR-2025-00123","sync_context":{"source_type":"stock_receipt","source_ref":"PR-2025-00123","note":"Chunk 1/2"}}'
};

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://segat-test.webland.sk/api/v1/elall/products/sync"

	payload := strings.NewReader("{\n  \"products\": [\n    {\n      \"stock_code\": \"ELALL-SKU-001\",\n      \"status\": \"active\",\n      \"segat_quantity\": 48,\n      \"catalog_price\": 129.9,\n      \"eshop_price\": 119,\n      \"ean\": \"5452000792440\"\n    }\n  ],\n  \"request_id\": \"PR-2025-00123\",\n  \"sync_context\": {\n    \"source_type\": \"stock_receipt\",\n    \"source_ref\": \"PR-2025-00123\",\n    \"note\": \"Chunk 1/2\"\n  }\n}")

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

	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://segat-test.webland.sk/api/v1/elall/products/sync")

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

request = Net::HTTP::Post.new(url)
request["X-API-Key"] = '<apiKey>'
request["Content-Type"] = 'application/json'
request.body = "{\n  \"products\": [\n    {\n      \"stock_code\": \"ELALL-SKU-001\",\n      \"status\": \"active\",\n      \"segat_quantity\": 48,\n      \"catalog_price\": 129.9,\n      \"eshop_price\": 119,\n      \"ean\": \"5452000792440\"\n    }\n  ],\n  \"request_id\": \"PR-2025-00123\",\n  \"sync_context\": {\n    \"source_type\": \"stock_receipt\",\n    \"source_ref\": \"PR-2025-00123\",\n    \"note\": \"Chunk 1/2\"\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://segat-test.webland.sk/api/v1/elall/products/sync")
  .header("X-API-Key", "<apiKey>")
  .header("Content-Type", "application/json")
  .body("{\n  \"products\": [\n    {\n      \"stock_code\": \"ELALL-SKU-001\",\n      \"status\": \"active\",\n      \"segat_quantity\": 48,\n      \"catalog_price\": 129.9,\n      \"eshop_price\": 119,\n      \"ean\": \"5452000792440\"\n    }\n  ],\n  \"request_id\": \"PR-2025-00123\",\n  \"sync_context\": {\n    \"source_type\": \"stock_receipt\",\n    \"source_ref\": \"PR-2025-00123\",\n    \"note\": \"Chunk 1/2\"\n  }\n}")
  .asString();
```

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

$client = new \GuzzleHttp\Client();

$response = $client->request('POST', 'https://segat-test.webland.sk/api/v1/elall/products/sync', [
  'body' => '{
  "products": [
    {
      "stock_code": "ELALL-SKU-001",
      "status": "active",
      "segat_quantity": 48,
      "catalog_price": 129.9,
      "eshop_price": 119,
      "ean": "5452000792440"
    }
  ],
  "request_id": "PR-2025-00123",
  "sync_context": {
    "source_type": "stock_receipt",
    "source_ref": "PR-2025-00123",
    "note": "Chunk 1/2"
  }
}',
  'headers' => [
    'Content-Type' => 'application/json',
    'X-API-Key' => '<apiKey>',
  ],
]);

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

```csharp
using RestSharp;

var client = new RestClient("https://segat-test.webland.sk/api/v1/elall/products/sync");
var request = new RestRequest(Method.POST);
request.AddHeader("X-API-Key", "<apiKey>");
request.AddHeader("Content-Type", "application/json");
request.AddParameter("application/json", "{\n  \"products\": [\n    {\n      \"stock_code\": \"ELALL-SKU-001\",\n      \"status\": \"active\",\n      \"segat_quantity\": 48,\n      \"catalog_price\": 129.9,\n      \"eshop_price\": 119,\n      \"ean\": \"5452000792440\"\n    }\n  ],\n  \"request_id\": \"PR-2025-00123\",\n  \"sync_context\": {\n    \"source_type\": \"stock_receipt\",\n    \"source_ref\": \"PR-2025-00123\",\n    \"note\": \"Chunk 1/2\"\n  }\n}", ParameterType.RequestBody);
IRestResponse response = client.Execute(request);
```

```swift
import Foundation

let headers = [
  "X-API-Key": "<apiKey>",
  "Content-Type": "application/json"
]
let parameters = [
  "products": [
    [
      "stock_code": "ELALL-SKU-001",
      "status": "active",
      "segat_quantity": 48,
      "catalog_price": 129.9,
      "eshop_price": 119,
      "ean": "5452000792440"
    ]
  ],
  "request_id": "PR-2025-00123",
  "sync_context": [
    "source_type": "stock_receipt",
    "source_ref": "PR-2025-00123",
    "note": "Chunk 1/2"
  ]
] as [String : Any]

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

let request = NSMutableURLRequest(url: NSURL(string: "https://segat-test.webland.sk/api/v1/elall/products/sync")! 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()
```