Skip to content

Public API v2: Bulk & idempotency

POST …/rules/bulk-upsert takes {"rules": [ … ]}, up to 250; an element with id replaces that rule, without it creates one. POST …/rules/bulk-delete takes {"ids": [ … ]}. Each element succeeds or fails on its own; the answer is 200 with a result per element, in the order sent.

bulk-upsert 200

Request body

{
"rules": [
{
"name": "Buy 2 get 1 half price B",
"priority": 1,
"status": "disabled",
"apply_to": "customer_tags",
"customer_tags": [
"wholesale"
],
"buy_type": "products",
"buy_product_ids": [
"8123456787001"
],
"buy_minimum_type": "quantity",
"buy_minimum_value": "2",
"get_type": "products",
"get_product_ids": [
"8123456788001"
],
"get_quantity": 1,
"get_discount_type": "percentage",
"get_discount_value": "50",
"start_at": "2026-11-01T00:00:00Z"
},
{
"name": "Buy 2 get 1 half price (bulk)",
"priority": 1,
"status": "disabled",
"apply_to": "customer_tags",
"customer_tags": [
"wholesale"
],
"buy_type": "products",
"buy_product_ids": [
"8123456787001"
],
"buy_minimum_type": "quantity",
"buy_minimum_value": "2",
"get_type": "products",
"get_product_ids": [
"8123456788001"
],
"get_quantity": 1,
"get_discount_type": "percentage",
"get_discount_value": "50",
"start_at": "2026-11-01T00:00:00Z",
"id": "7"
}
]
}

Response

{
"success": true,
"status": "success",
"data": {
"results": [
{
"index": 0,
"id": "8",
"result": "created"
},
{
"index": 1,
"id": "7",
"result": "updated"
}
],
"summary": {
"total": 2,
"succeeded": 2,
"failed": 0
}
},
"meta": {
"timestamp": "2026-10-21T09:34:23.729Z",
"version": "v2",
"request_id": "d7ad0f4c-4e15-4102-a5ec-9605d32ed3f9",
"rate_limit": {
"cost": 11,
"limit": 600,
"remaining": 589,
"restore_rate": 10
}
}
}
bulk-delete with an unknown id 200

Request body

{
"ids": [
"8",
"999999999"
]
}

Response

{
"success": true,
"status": "success",
"data": {
"results": [
{
"index": 0,
"id": "8",
"result": "deleted"
},
{
"index": 1,
"id": "999999999",
"result": "error",
"error": {
"code": "RESOURCE_NOT_FOUND",
"message": "Resource not found"
}
}
],
"summary": {
"total": 2,
"succeeded": 1,
"failed": 1
}
},
"meta": {
"timestamp": "2026-10-21T09:34:25.037Z",
"version": "v2",
"request_id": "44a67d6d-e5fe-4c37-bf97-bd5c6e6ba6dd",
"rate_limit": {
"cost": 11,
"limit": 600,
"remaining": 589,
"restore_rate": 10
}
}
}
  • One bulk request or upload of a store runs at a time; a second one gets 409 RESOURCE_CONFLICT and costs nothing.
  • A batch that would take the store past 10,000 rules of the module is refused whole with 422.
  • Price List has no bulk-upsert of rules; use its item routes for large lists.
  • Add Idempotency-Key: <unique value> (1–255 characters) to any POST.
  • The same key and body within 24 hours return the first answer again, with Idempotent-Replayed: true, and nothing runs twice.
  • The same key with a different body is refused with 422; a key whose first request is still running gets 409.
  • Failed requests are not remembered: retrying with the same key runs again.