Catalog upsert (batch)
Preview documentation / simulated contract (draft). Schemas and examples reflect the planned Commerce API v1 — final values will be confirmed when the production contract is frozen.
POST /products/batch
Description
Idempotent upsert of up to 500 products with variants/categories. Base URL: https://api.callbotagent.ai/api/v1/commerce.
Required scope
catalog:write
Headers
| Header | Value | Required |
|---|---|---|
Content-Type |
application/json (gdy body) |
when body present |
X-CBA-Key-Id |
key identifier (in examples: cba_test_••••••••) |
yes |
X-CBA-Timestamp |
RFC 3339 UTC | yes |
X-CBA-Nonce |
unique nonce within the 300 s window | yes |
X-CBA-Content-SHA256 |
SHA-256 hex surowego body (e3b0c44… dla pustego) |
yes |
X-CBA-Signature |
hmac-sha256=<hex> |
yes |
Idempotency-Key |
idempotency key | mutations: yes |
Body parameters
| Field | Type | Required | Description |
|---|---|---|---|
products[] |
array | yes | Product list (max 500) |
products[].external_product_id |
string | yes | Stable partner product ID |
products[].variants[] |
array | yes | Max 100 variants; price+currency required |
products[].source_version |
string | yes | Monotonic source version |
Example request
curl -X POST https://api.callbotagent.ai/api/v1/commerce/products/batch \
-H "X-CBA-Key-Id: cba_test_••••••••" \
-H "X-CBA-Timestamp: 2026-07-11T10:00:00Z" \
-H "X-CBA-Nonce: n_8f3a2c1b" \
-H "X-CBA-Content-SHA256: <sha256-body>" \
-H "X-CBA-Signature: hmac-sha256=<hex>" \
-H "Idempotency-Key: idem-products-batch-post" \
-H "Content-Type: application/json" \
-d '{"products":[{"external_product_id":"SKU-ROUTER-01","title":"Router Mesh Home","category":"sieci/routery","status":"active","availability":"in_stock","source_version":"2026-07-11T09:00:00Z","variants":[{"external_variant_id":"SKU-ROUTER-01-BLK","price":"349.00","currency":"PLN","inventory":42,"min_quantity":1,"max_quantity":5}]}]}'const res = await fetch("https://api.callbotagent.ai/api/v1/commerce/products/batch", {
method: "POST",
headers: {
"X-CBA-Key-Id": "cba_test_••••••••",
"X-CBA-Timestamp": "2026-07-11T10:00:00Z",
"X-CBA-Nonce": "n_8f3a2c1b",
"X-CBA-Content-SHA256": "<sha256-body>",
"X-CBA-Signature": "hmac-sha256=<hex>",
"Idempotency-Key": "idem-products-batch-post",
"Content-Type": "application/json",
},
body: JSON.stringify({"products":[{"external_product_id":"SKU-ROUTER-01","title":"Router Mesh Home","category":"sieci/routery","status":"active","availability":"in_stock","source_version":"2026-07-11T09:00:00Z","variants":[{"external_variant_id":"SKU-ROUTER-01-BLK","price":"349.00","currency":"PLN","inventory":42,"min_quantity":1,"max_quantity":5}]}]}),
});
const data = await res.json();Example response
{
"accepted": 1,
"rejected": 0,
"results": [
{
"external_product_id": "SKU-ROUTER-01",
"outcome": "upserted"
}
]
}
Possible errors
| Status | code |
Meaning |
|---|---|---|
| 401 | invalid_signature / expired_timestamp / replay_nonce |
HMAC / replay window |
| 403 | insufficient_scope |
missing required scope |
| 404 | resource_not_found |
resource unavailable for principal |
| 409 | idempotency_key_reused / stale_source_version |
idempotency / version conflict |
| 422 | validation_failed |
body does not match schema / invariants |
| 429 | rate_limited |
limits — see Retry-After |